feat(sandbox): debug-gated L7 egress request/response header logging#9
Merged
Conversation
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
Adds DEBUG-gated, secret-free L7 egress request/response header logging to the in-container supervisor, plus the activation path to reach it. Enables capturing billing-relevant headers (
anthropic-beta/oauth-2025-04-20on requests;anthropic-ratelimit-unified-*incl.overage-statuson responses) for testing — without leaking anything in normal runs.Fast-forwards onto
main(4 commits appended; no rewrite).Related Issue
Fork delta tracked downstream in openlock (
bd openlock-dlv). No upstream issue.Changes
l7/rest.rs: behindtracing::enabled!(DEBUG)(off by default), loganthropic-betaon the request and theanthropic-ratelimit-*/overage-statusfamily on the response. Never logsAuthorizationor any credential. Header value is embedded in the message string (the shorthand layer drops structured fields for non-OCSF events).main.rs: the rolling file log layer now follows the configured level (floored atinfo), so--log-level debugsurfaces the debug header lines in/var/log/openshell.*.log(previously hardcoded toinfo). Adds a unit-testedfile_log_levelhelper.cli:--log-levelonopenshell sandbox createsetsSandboxSpec.log_level(existing proto field; drivers already pass it through asOPENSHELL_LOG_LEVEL).No proto field-number changes.
Testing
cargo test -p openshell-sandbox(incl.file_log_levelhelper) — passcargo clippy -p openshell-sandboxand-p openshell-cli --all-targets --features openshell-prover/bundled-z3— cleananthropic-beta: …,oauth-2025-04-20,…andanthropic-ratelimit-unified-overage-status: rejectedviaopenlock logs.Checklist