Mission-critical audit remediation: OTLP, TraceKit, and OpenTelemetry edge-case hardening#12
Closed
christopherkarani wants to merge 2 commits into
Closed
Mission-critical audit remediation: OTLP, TraceKit, and OpenTelemetry edge-case hardening#12christopherkarani wants to merge 2 commits into
christopherkarani wants to merge 2 commits into
Conversation
- Normalize OpenTelemetry install configuration before idempotency checks so non-finite sampling ratios do not break same-config installs. - Sanitize and clamp sampling ratios consistently during install and sampler construction. - Replace UUID-based anonymization fallback key generation with SystemRandomNumberGenerator bytes. - Make HTTPAIInstrumentation default OpenClaw gateway hosts use the documented constant. - Make TraceFileLocator accept numeric-prefix filenames via TraceFileNameParser for parser/locator consistency. - Convert TraceFileReader to bounded streaming reads to enforce max file size without TOCTOU race. - Harden OTLP zlib decompression to fail on zero-progress/incomplete payloads and require terminal stream status. - Confine OTLPHTTPServer public state access (start/stop/deinit/port) to the internal serial queue. - Add regression tests for: * composite trace filename discovery, * truncated deflate payload rejection, * drop redaction behavior, * strict same-config concurrent OpenTelemetry install, * non-finite sampling ratio idempotency. - Validation performed: swift build, full swift test (XCTest + Swift Testing suites).
Owner
Author
|
Superseded by #15, which consolidates the still-valid changes from the current open PR set onto main and intentionally skips stale or conflicting churn. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR remediates mission-critical correctness and safety issues identified in the Swift audit across Terra core runtime, TraceKit ingestion, and HTTP instrumentation.
Fixes implemented
traceSamplingRatio(NaN,±Inf) now canonicalizes tonil[0, 1]for deterministic behaviorCOMPRESSION_STATUS_ENDTraceFileLocatornow accepts numeric-prefix filenames viaTraceFileNameParser(consistent withTraceparsing)TraceFileReadernow performs bounded streaming reads with in-flight max-size enforcementstart,stop,deinit, andportSystemRandomNumberGeneratorHTTPAIInstrumentation.installnow usesdefaultOpenClawGatewayHostsas the default argumentTests added/updated
TraceKitTestsOTLPRequestDecoderTestsTerraRedactionPolicyTests.dropredaction behavior testTerraOpenTelemetryInstallConcurrencyTests== 2successes)Validation
swift build✅swift test✅Notes