Skip to content

fix(plugin-sdk): bound Anthropic Vertex ADC credential read#111120

Merged
steipete merged 2 commits into
openclaw:mainfrom
xydt-juyaohui:fix/anthropic-vertex-auth-presence-adc-bound
Jul 21, 2026
Merged

fix(plugin-sdk): bound Anthropic Vertex ADC credential read#111120
steipete merged 2 commits into
openclaw:mainfrom
xydt-juyaohui:fix/anthropic-vertex-auth-presence-adc-bound

Conversation

@xydt-juyaohui

@xydt-juyaohui xydt-juyaohui commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The original PR found an unbounded ADC credential read in src/plugin-sdk/anthropic-vertex-auth-presence.ts.

Current-main review showed that this file was no longer a Plugin SDK surface or runtime path: it had no package export, no entrypoint manifest entry, and no production caller. Only its two colocated tests remained. The real Anthropic Vertex plugin already owns the bounded 1 MiB ADC reader in extensions/anthropic-vertex/region.ts.

Why This Change Was Made

The branch now removes the orphaned duplicate helper and its tests instead of adding a second copy of the provider-owned size policy. This is the clean owner-boundary fix: the only live Anthropic Vertex auth path remains bounded, and unreachable Plugin SDK code cannot drift again.

The tooling routing fixture was retargeted to an existing Plugin SDK test so it continues to prove the full Plugin SDK Vitest lane.

User Impact

No user-visible or public SDK behavior changes. The deleted module was not package-exported and had no production caller. Anthropic Vertex discovery continues through the plugin-owned bounded ADC implementation.

Evidence

  • Repository-wide caller and package-export searches found no consumer or public subpath for the deleted helper.
  • node scripts/run-vitest.mjs src/scripts/test-projects.test.ts — 85 passed.
  • node scripts/run-vitest.mjs extensions/anthropic-vertex/region.adc.test.ts — 2 passed.
  • node --max-old-space-size=8192 scripts/plugin-sdk-surface-report.mjs --check — 313 SDK entrypoints, 0 forbidden package exports, no surface delta.
  • Full Node 24 changed-check plan passed across core and extension types, lint, SDK export/baseline/surface gates, dependency guards, and import-cycle checks.
  • git diff --check passed.

Credit: original unbounded-read report and bounded-reader patch by @xydt-juyaohui.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Jul 19, 2026
@clawsweeper

clawsweeper Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 19, 2026, 9:49 PM ET / July 20, 2026, 01:49 UTC.

Summary
The branch replaces the plugin SDK’s unbounded Anthropic Vertex ADC presence read with the shared 1 MiB bounded secret-file reader and adds oversize regression coverage.

PR surface: Source +11, Tests +14. Total +25 across 3 files.

Reproducibility: yes. The focused regression path writes a real 2 MiB ADC file through GOOGLE_APPLICATION_CREDENTIALS and verifies that current unbounded behavior is replaced by a false preflight result, while a normal file remains detected.

Review metrics: 1 noteworthy metric.

  • Credential-read bound: 1 unbounded presence read changed to a 1 MiB bounded read. The only user-visible semantic change is the intentional rejection of oversized ADC files, which matches the prior owner-local hardening.

Stored data model
Persistent data-model change detected: serialized state: src/plugin-sdk/anthropic-vertex-auth-presence.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] An existing installation whose explicit ADC file exceeds 1 MiB will now be treated as unavailable during the preflight instead of readable; this is an intentional compatibility change that matches the already-merged provider-local Anthropic Vertex policy.

Maintainer options:

  1. Keep the established ADC size bound (recommended)
    Accept the deliberate change that oversized ADC files are unavailable in preflight, consistent with the merged provider-local Anthropic Vertex reader.

Next step before merge

  • No automated repair is needed; the branch has no concrete review finding and awaits ordinary maintainer merge review.

Security
Cleared: The patch narrows credential-file resource consumption through the existing secret-file helper and introduces no new dependency, permission, execution, or secret-exposure path.

Review details

Best possible solution:

Merge the narrow shared-reader reuse while retaining the established 1 MiB rejection behavior and its normal-size/oversize regression coverage.

Do we have a high-confidence way to reproduce the issue?

Yes. The focused regression path writes a real 2 MiB ADC file through GOOGLE_APPLICATION_CREDENTIALS and verifies that current unbounded behavior is replaced by a false preflight result, while a normal file remains detected.

Is this the best way to solve the issue?

Yes. Reusing the existing shared bounded secret-file reader is the narrowest maintainable fix and aligns the plugin-SDK duplicate with the previously merged Anthropic Vertex reader contract.

AGENTS.md: unclear because the file could not be read completely.

Codex review notes: model internal, reasoning high; reviewed against 27f05c8993fb.

Label changes

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded credential-file hardening fix with limited blast radius in Anthropic Vertex auth preflight.
  • merge-risk: 🚨 compatibility: An oversized existing ADC path changes from detected-readable to unavailable, even though that outcome matches the existing provider-local bound.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides after-fix terminal output from a real temporary-file scenario showing normal-size detection is preserved and a 2 MiB file is rejected; redact any local paths or credentials in future proof updates.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix terminal output from a real temporary-file scenario showing normal-size detection is preserved and a 2 MiB file is rejected; redact any local paths or credentials in future proof updates.
Evidence reviewed

PR surface:

Source +11, Tests +14. Total +25 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 14 3 +11
Tests 2 24 10 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 38 13 +25

What I checked:

Likely related people:

  • steipete: Authored the merged prior credential-reader hardening that established the 1 MiB Anthropic Vertex ADC bound this PR mirrors. (role: introduced sibling bounded-reader policy; confidence: high; commits: 04c31f453cfc; files: extensions/anthropic-vertex/region.ts, src/plugin-sdk/secret-file-runtime.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (6 earlier review cycles)
  • reviewed 2026-07-19T02:02:48.596Z sha d71e69c :: needs maintainer review before merge. :: none
  • reviewed 2026-07-19T02:29:05.828Z sha f60cc5f :: needs maintainer review before merge. :: none
  • reviewed 2026-07-19T02:50:20.982Z sha 640e24f :: needs maintainer review before merge. :: none
  • reviewed 2026-07-19T09:26:22.120Z sha 640e24f :: needs maintainer review before merge. :: none
  • reviewed 2026-07-19T09:34:03.817Z sha 6a25181 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-19T10:16:28.805Z sha 6a25181 :: needs maintainer review before merge. :: none

@xydt-juyaohui
xydt-juyaohui force-pushed the fix/anthropic-vertex-auth-presence-adc-bound branch from f60cc5f to 640e24f Compare July 19, 2026 02:47
@xydt-juyaohui

Copy link
Copy Markdown
Contributor Author

CI is red on two unrelated flaky timing tests, not on this change.

1. checks-node-compact-small-7src/cli/acp-cli-exit.process.test.ts (exits promptly after ['acp','--help'])

  • Spawns node --import tsx src/entry.ts acp --help with timeout: 5_000 + killSignal: "SIGKILL" (added in fix(acp): exit help and EOF cleanly #111091). acp --help via tsx cold-start is ~5 s on CI, so it's killed just past the 5 s mark on slower/loaded runners. This run's shard took 34 s (vs ~5 s normally) — a slow/loaded runner, which also broke the third acp-cli-exit case (spawnSync AssertionError).
  • Verified locally: acp --help exits 0 with this branch — just slow (tsx cold-start; ~25 s on my Windows/Node 22 box, ~5 s on CI Linux/Node 24, borderline).
  • This change lives in src/plugin-sdk/anthropic-vertex-auth-presence.ts (ADC presence detection). That module has no runtime importers (only its own tests), so it is not in the acp --help load path and cannot affect its startup timing.

2. checks-node-compact-large-5src/system-agent/setup-inference-detection.test.ts (keeps HTTP responsive while a detect…)

  • An HTTP-responsiveness timing assertion in a different module (src/system-agent/); unrelated to this change.

Green on this change: check-lint ✓ (fixed one redundant String() flagged by oxlint's no-unnecessary-type-conversion), Critical Quality (plugin-boundary) ✓, Critical Quality (plugin-sdk-package-contract) ✓, Security High (core-auth-secrets) ✓, Real behavior proof ✓ (success), and the network-runtime-boundary / core-auth-secrets CodeQL fast-scans were skipped (no proxy/secret tokens touched). Locally: vitest 3/3, tsgo:core:test clean, proof PASS. main HEAD CI is green on both flaky tests.

I couldn't re-run the failed jobs via the API (needs admin rights on the repo). Could you re-run checks-node-compact-small-7 and checks-node-compact-large-5, or merge if you're comfortable with the timing flakes? Happy to rebase or adjust otherwise.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Jul 19, 2026
@xydt-juyaohui
xydt-juyaohui force-pushed the fix/anthropic-vertex-auth-presence-adc-bound branch from 640e24f to 6a25181 Compare July 19, 2026 09:30
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Jul 19, 2026
@steipete steipete self-assigned this Jul 21, 2026
xydt-juyaohui and others added 2 commits July 20, 2026 20:14
canReadAnthropicVertexAdc read the entire GOOGLE_APPLICATION_CREDENTIALS
file via unbounded fs.readFileSync solely to check readability (the
contents are discarded). The provider-local copy of this logic in
extensions/anthropic-vertex/region.ts was already bounded with
tryReadSecretFileSync + a 1 MiB limit in openclaw#109260 ("reject oversized
credential files in remaining readers"); this standalone plugin-sdk
preflight helper is a duplicate that sweep missed.

Mirror the region.ts bound: replace the unbounded readFileSync with
tryReadSecretFileSync(..., { maxBytes: 1 MiB, rejectHardlinks: false }),
wrapped in try/catch (the helper throws FsSafeError on oversize) so an
oversized credential file is rejected instead of slurped into memory.
Presence-check semantics are unchanged for normal-sized files.
@steipete
steipete force-pushed the fix/anthropic-vertex-auth-presence-adc-bound branch from 16483c1 to 190f136 Compare July 21, 2026 03:15
@clawsweeper

clawsweeper Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(plugin-sdk): bound Anthropic Vertex ADC credential read This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit 9061aa8 into openclaw:main Jul 21, 2026
124 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 21, 2026
…#111120)

* fix(plugin-sdk): bound Anthropic Vertex ADC credential read

canReadAnthropicVertexAdc read the entire GOOGLE_APPLICATION_CREDENTIALS
file via unbounded fs.readFileSync solely to check readability (the
contents are discarded). The provider-local copy of this logic in
extensions/anthropic-vertex/region.ts was already bounded with
tryReadSecretFileSync + a 1 MiB limit in openclaw#109260 ("reject oversized
credential files in remaining readers"); this standalone plugin-sdk
preflight helper is a duplicate that sweep missed.

Mirror the region.ts bound: replace the unbounded readFileSync with
tryReadSecretFileSync(..., { maxBytes: 1 MiB, rejectHardlinks: false }),
wrapped in try/catch (the helper throws FsSafeError on oversize) so an
oversized credential file is rejected instead of slurped into memory.
Presence-check semantics are unchanged for normal-sized files.

* refactor(plugin-sdk): remove orphaned vertex auth helper

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants