Secrets: hard-fail unsupported SecretRef policy and fix gateway restart token drift#58141
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9baed0c580
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Greptile SummaryThis PR fixes two related issues: (1) false-positive token drift warnings during Key changes:
Two minor observations: (1) Confidence Score: 5/5Safe to merge — all remaining findings are P2 style/UX observations that do not affect runtime correctness. Both identified issues are P2: (1) policy issues being silently dropped when legacy issues exist is an ergonomic concern only — no data loss, no silent auth bypass, the policy is still enforced via validateConfigObjectRaw at load time; and (2) the coerceSecretRef defaults inconsistency is masked by schema validation in every realistic case. The core fixes — async drift check with merged env, OAuth+SecretRef hard-fail, and mutable-surface policy guard — are correctly implemented, well-tested, and handle the targeted error paths cleanly. src/config/validation.ts — two minor observations around policyIssues being dropped in the legacyIssues early-return path and the coerceSecretRef defaults inconsistency; neither blocks merge.
|
|
Addressed the review feedback in What changed:
Files:
Validation run (pass):
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6316fd3584
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
07aff24 to
66a7d64
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e6077393d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
4e60773 to
e07eb9a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f996f68c58
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…rt token drift (openclaw#58141) * Secrets: enforce C2 SecretRef policy and drift resolution * Tests: add gateway auth startup/reload SecretRef runtime coverage * Docs: sync C2 SecretRef policy and coverage matrix * Config: hard-fail parent SecretRef policy writes * Secrets: centralize unsupported SecretRef policy metadata * Daemon: test service-env precedence for token drift refs * Config: keep per-ref dry-run resolvability errors * Docs: clarify config-set parent-object policy checks * Gateway: fix drift fallback and schema-key filtering * Gateway: align drift fallback with credential planner * changelog Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com> --------- Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com>
…rt token drift (openclaw#58141) * Secrets: enforce C2 SecretRef policy and drift resolution * Tests: add gateway auth startup/reload SecretRef runtime coverage * Docs: sync C2 SecretRef policy and coverage matrix * Config: hard-fail parent SecretRef policy writes * Secrets: centralize unsupported SecretRef policy metadata * Daemon: test service-env precedence for token drift refs * Config: keep per-ref dry-run resolvability errors * Docs: clarify config-set parent-object policy checks * Gateway: fix drift fallback and schema-key filtering * Gateway: align drift fallback with credential planner * changelog Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com> --------- Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com>
…rt token drift (openclaw#58141) * Secrets: enforce C2 SecretRef policy and drift resolution * Tests: add gateway auth startup/reload SecretRef runtime coverage * Docs: sync C2 SecretRef policy and coverage matrix * Config: hard-fail parent SecretRef policy writes * Secrets: centralize unsupported SecretRef policy metadata * Daemon: test service-env precedence for token drift refs * Config: keep per-ref dry-run resolvability errors * Docs: clarify config-set parent-object policy checks * Gateway: fix drift fallback and schema-key filtering * Gateway: align drift fallback with credential planner * changelog Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com> --------- Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com>
…rt token drift (openclaw#58141) * Secrets: enforce C2 SecretRef policy and drift resolution * Tests: add gateway auth startup/reload SecretRef runtime coverage * Docs: sync C2 SecretRef policy and coverage matrix * Config: hard-fail parent SecretRef policy writes * Secrets: centralize unsupported SecretRef policy metadata * Daemon: test service-env precedence for token drift refs * Config: keep per-ref dry-run resolvability errors * Docs: clarify config-set parent-object policy checks * Gateway: fix drift fallback and schema-key filtering * Gateway: align drift fallback with credential planner * changelog Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com> --------- Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com>
…rt token drift (openclaw#58141) * Secrets: enforce C2 SecretRef policy and drift resolution * Tests: add gateway auth startup/reload SecretRef runtime coverage * Docs: sync C2 SecretRef policy and coverage matrix * Config: hard-fail parent SecretRef policy writes * Secrets: centralize unsupported SecretRef policy metadata * Daemon: test service-env precedence for token drift refs * Config: keep per-ref dry-run resolvability errors * Docs: clarify config-set parent-object policy checks * Gateway: fix drift fallback and schema-key filtering * Gateway: align drift fallback with credential planner * changelog Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com> --------- Signed-off-by: joshavant <830519+joshavant@users.noreply.github.com>
Summary
gateway.auth.tokenused SecretRef, and unsupported runtime-mutable SecretRef surfaces were not consistently hard-failed early.gateway install --forcefile/plist SecretRef handling.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
C2 Cluster Coverage Matrix
Fully addressed:
Partially addressed:
gateway install --forceplaintext projection concern in LaunchAgent plist handling.gateway.auth.tokenSecretRef.Additional post-review blocker fix:
config setpolicy hard-fail (setting parent objects likehooks/channels.discordwith nested unsupported SecretRef values).6316fd3584: removed requested-path gating and now runs unsupported SecretRef policy validation unconditionally on post-mutation config before write.src/cli/config-cli.test.tsfails early when parent-object writes include unsupported SecretRef objectsdoes not duplicate policy errors in --dry-run --json mode for parent-object writesRoot Cause / Regression History (if applicable)
git blame, prior PR, issue, or refactor if known): open bug threads [Bug]: openclaw gateway restart cannot verify gateway.auth.token drift when token is configured via SecretRef env provider, even though the env var is available #55029/[Bug]: gateway restart false-positive token drift warning with SecretRef-backed gateway.auth.token #57211 and open PRs fix(gateway): resolve env-backed SecretRef in restart drift-check (#55029) #55448/fix(gateway): suppress false-positive token drift warning for SecretRef-backed auth tokens #57411 identified the restart drift check path.Regression Test Plan (if applicable)
src/cli/daemon-cli/gateway-token-drift.test.tssrc/cli/daemon-cli/lifecycle-core.test.tssrc/config/validation.policy.test.tssrc/secrets/runtime-auth-profiles-oauth-policy.test.tssrc/secrets/runtime.integration.test.tsUser-visible / Behavior Changes
openclaw gateway restartdrift checks now resolvegateway.auth.tokenSecretRefs with merged service+process env inputs and reduce false-positive drift warnings.gateway.auth.modedisables token auth (password,none,trusted-proxy).Diagram (if applicable)
Security Impact (required)
Yes/No): NoYes/No): YesYes/No): NoYes/No): NoYes/No): NoYes, explain risk + mitigation:Repro + Verification
Environment
gateway.auth.tokenSecretRef via env/file provider, auth profile mode combinationsSteps
gateway.auth.tokenas SecretRef and set service env token source.Expected
Actual
Evidence
Attach at least one:
Scoped verification command (pass):
pnpm test -- src/config/validation.policy.test.ts src/cli/config-cli.test.ts src/cli/daemon-cli/gateway-token-drift.test.ts src/cli/daemon-cli/lifecycle-core.test.ts src/agents/auth-profiles/oauth.test.ts src/secrets/runtime-auth-profiles-oauth-policy.test.ts src/secrets/runtime.integration.test.ts src/commands/doctor-gateway-services.test.ts src/secrets/target-registry.test.tsHuman Verification (required)
password), unresolved active refs, reload keeps last-known-good snapshot.Review Conversations
Compatibility / Migration
Yes/No): Yes (for valid supported configs)Yes/No): NoYes/No): NoRisks and Mitigations