Skip to content

test(security): cover credentials added to reference-only auth profiles - #12314

Closed
jyaunches wants to merge 6 commits into
mainfrom
codex/fix-brev-credential-boundary
Closed

jyaunches wants to merge 6 commits into
mainfrom
codex/fix-brev-credential-boundary

Conversation

@jyaunches

@jyaunches jyaunches commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Preserve a local credential-scanner regression test that accepts a reference-only auth profile, then detects a synthetic credential inserted into the same file without exposing its value.

Test behavior

In test/e2e/support/sandbox-credential-boundary.test.ts, the test:

  • Writes an auth-profiles.json profile with an environment-variable keyRef and verifies that scanning produces no findings.
  • Adds a synthetic API key to that same profile and scans again.
  • Requires the scanner to report only the file path and omit the credential value.

This is a local support test using temporary files and the actual scanner command. It requires no cloud resources, network calls, or model inference.

Preserved patch and status

The standalone test patch is the remaining change worth carrying forward. At extraction, git apply --check passed against main's target test file; the extracted test was not executed or merged.

This PR remains closed. Its original branch diff also contains inference-retry and launch-diagnostic changes superseded by merged #12389; that diff has not been reduced to the standalone test. The linked patch isolates the test for follow-up.


Signed-off-by: Julie Yaunches jyaunches@nvidia.com

Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@jyaunches jyaunches self-assigned this Sep 24, 2026
@copy-pr-bot

copy-pr-bot Bot commented Sep 24, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: NVIDIA/NemoClaw/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d902b9db-3d08-4bda-8ad7-5dc64f3343dc

📥 Commits

Reviewing files that changed from the base of the PR and between 2e162f2 and 39001a8.

📒 Files selected for processing (8)
  • test/e2e/README.md
  • test/e2e/live/full-e2e-inference-probe.ts
  • test/e2e/live/full-e2e.test.ts
  • test/e2e/live/launch-agent-turn.ts
  • test/e2e/support/full-e2e-inference-probe.test.ts
  • test/e2e/support/launch-agent-turn-session-evidence.test.ts
  • test/e2e/support/launch-agent-turn.test.ts
  • test/e2e/support/sandbox-credential-boundary.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

The full E2E inference probe retries once after a qualifying HTTP 503 result and records attempt evidence. Empty-message diagnostics now include normalized, allowlisted provider error metadata. Tests cover retry behavior, diagnostic sanitization, and credential-scan boundaries.

Changes

Inference availability retry

Layer / File(s) Summary
Retry policy and validation
test/e2e/live/full-e2e-inference-probe.ts, test/e2e/support/full-e2e-inference-probe.test.ts
The command wrapper retries once after five seconds only when curl exits with code 22, stdout is empty, and stderr exactly matches the HTTP 503 error. Tests cover recovery, exhaustion, exceptions, and outcomes that must not retry.
Live E2E integration and documentation
test/e2e/live/full-e2e.test.ts, test/e2e/README.md
The live test records evidence and uses attempt-specific artifact names. The README documents the retry conditions, request limits, and evidence rules.

Empty-message diagnostics

Layer / File(s) Summary
Normalize transcript failure metadata
test/e2e/live/launch-agent-turn.ts
JSONL- and SQLite-derived message records now include normalized failure metadata.
Report and validate empty-message metadata
test/e2e/live/launch-agent-turn.ts, test/e2e/support/launch-agent-turn-session-evidence.test.ts, test/e2e/support/launch-agent-turn.test.ts, test/e2e/README.md
Empty-content diagnostics include failure metadata. Tests check the reported fields and confirm that unknown values and provider error text are omitted.

Credential scan boundary

Layer / File(s) Summary
Credential scan boundary test
test/e2e/support/sandbox-credential-boundary.test.ts
The test checks that an environment-variable key reference is not reported, while a credential value is reported without exposing the value.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant FullE2eTest
  participant runFullE2eInferenceCommand
  participant runBoundedRetry
  participant sandbox.exec
  participant onEvidence
  FullE2eTest->>runFullE2eInferenceCommand: Pass command and evidence callbacks
  runFullE2eInferenceCommand->>runBoundedRetry: Configure two attempts and 5-second delay
  runBoundedRetry->>sandbox.exec: Run inference command for an attempt
  sandbox.exec-->>runBoundedRetry: Return command result
  runBoundedRetry->>onEvidence: Forward attempt evidence
Loading

Possibly related PRs

  • NVIDIA/NemoClaw#9179: Adds the bounded retry policy and evidence contract used by this inference probe.

Suggested labels: chore

Suggested reviewers: cv, prekshivyas

Merge Risk: ⚪ Minimal · up to 39001

The bounded retry preserves the final response checks. No identified issue needs resolution before merge; live Brev E2E validation remains outstanding.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 7 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary changes: handling inference unavailability and retaining launch diagnostics.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 7 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@github-code-quality

github-code-quality Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall line coverage in commit 39001a8 in the codex/fix-brev-crede... branch remains at 96%, unchanged from commit 2e162f2 in the main branch.

TypeScript / code-coverage/cli

The overall line coverage in commit 39001a8 in the codex/fix-brev-crede... branch remains at 84%, unchanged from commit 2e162f2 in the main branch.

Show a line coverage summary of the most impacted files.
File main 2e162f2 codex/fix-brev-crede... 39001a8 +/-
src/lib/inferen...anaged-state.ts 75% 71% -4%
src/lib/onboard...-mount/index.ts 96% 92% -4%
src/lib/core/process-exit.ts 90% 86% -4%
src/lib/onboard...ence-routing.ts 92% 89% -3%
src/lib/onboard...-transaction.ts 86% 84% -2%
src/lib/inferen...hugging-face.ts 96% 96% 0%
src/lib/onboard...ma-inference.ts 81% 81% 0%
src/lib/onboard...ma-authority.ts 82% 82% 0%
src/lib/actions...ce-route-api.ts 98% 98% 0%
src/lib/onboard...cs/redaction.ts 91% 95% +4%

Updated September 24, 2026 05:02 UTC

Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@jyaunches jyaunches changed the title test(e2e): accept reference-only sandbox auth profiles test(e2e): distinguish auth references from stored credentials Sep 24, 2026
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@jyaunches jyaunches changed the title test(e2e): distinguish auth references from stored credentials test(e2e): preserve credential coverage and launch diagnostics Sep 24, 2026
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@jyaunches jyaunches changed the title test(e2e): preserve credential coverage and launch diagnostics test(e2e): handle inference unavailability and retain launch diagnostics Sep 24, 2026
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Review Advisor finished for commit 39001a8. Include the Advisor findings in the complete PR feedback collection. Verify and group valid findings before repair.

Request review only when Require no Advisor blockers is green.

All previous runs

@jyaunches
jyaunches marked this pull request as ready for review September 27, 2026 11:10
rsliter pushed a commit that referenced this pull request Sep 29, 2026
…retries (#12389)

## Outcome

Readiness-publication failures now retain fixed stage and reason labels
instead of discarding their cause. Brev E2E retains safe inference
diagnostics and retries narrowly classified transient provider failures
within fixed limits. The launch harness avoids login-shell logout hooks
that can break cleanup and prevent an otherwise eligible retry.

## Reason

The [original Brev
failure](https://github.com/NVIDIA/NemoClaw/actions/runs/36341308665/job/108682308249)
occurred during readiness publication after image construction,
onboarding, and inference passed. The retained generic error could not
establish its root cause. Readiness has passed in subsequent diagnostic
runs; this PR does not claim to have proven or fixed that original
cause.

Subsequent runs exposed HTTP 503 responses, an overly restrictive
provider-error classifier, and a cleanup failure that prevented retries.
The [sixth
run](https://github.com/NVIDIA/NemoClaw/actions/runs/36471884669/job/109097637491)
retained `local: can only be used in a function` followed by `mode:
unbound variable` in both cleanup calls. Ubuntu Bash 5.1 with a failing
`.bash_logout` reproduces that exact failure. The host harness is
self-contained and now uses `bash -c` with its supplied environment.

## Changes

- Map publication authority, final observation, storage, lock, and clock
failures to fixed diagnostic labels. Print them in the existing CLI
failure path without exposing raw exception text.
- Retain allowlisted empty-assistant metadata for JSONL and SQLite
sessions. Unknown provider details remain unclassified. Reuse the
focused diagnostic from #12314.
- Reuse the shared bounded-retry helper for the stateless arithmetic
probe: retry only exact curl HTTP 503 failures once after five seconds.
Preserve separate attempt artifacts and log aggregate evidence before
artifact writing.
- Recognize structured managed-inference HTTP 503 without requiring a
provider-specific exception prefix. Keep authentication, policy,
conflicting error classes, malformed evidence, and cleanup failures
terminal.
- Retain bounded cleanup diagnostics and execute baseline and PTY
cleanup independently. Invoke the host harness without login/logout
files. Successful cleanup remains mandatory before the existing
two-attempt launch retry.
- Extend existing support tests for redaction, retry eligibility,
recovery, exhaustion, artifact-write failure, fatal cleanup, and a
failing logout hook. Live acceptance still requires two nonempty
user/assistant turn pairs per successful launch.

## Verification

- Focused readiness, observation-timing, connect-flow, and lease-storage
tests: 175 passed across four files.
- Session-evidence classifier suite: 66 passed, with before-fix
reproductions for JSONL and SQLite HTTP 503 records.
- Inference-probe support suite: 29 passed, including retry exhaustion,
recovery, and failed artifact writes.
- `vitest run --project e2e-support
test/e2e/support/launch-agent-turn.test.ts`: 6 passed on macOS; 40 Linux
cases skipped. The socket test passed across the required execution
boundary after sandbox isolation blocked its first attempt.
- Isolated Linux tests using the real producer and support fixture with
Ubuntu Bash 5.1.16: the prior login-shell invocation reproduces the live
cleanup failure; the repaired invocation cleans up and succeeds on its
second attempt; a genuine cleanup denial still stops after one attempt.
No PTY or host-process residue remained in the recovery case.
- [Third Brev
run](https://github.com/NVIDIA/NemoClaw/actions/runs/36445843350):
arithmetic HTTP 503 recovered on its second attempt. Structured launch
HTTP 503 supplied the classifier regression evidence.
- [Sixth Brev
run](https://github.com/NVIDIA/NemoClaw/actions/runs/36471884669): image
build, fresh-boot qualification, exact clean provenance, onboarding,
arithmetic inference, readiness, and first logical launch passed. Second
launch exposed the logout/cleanup failure repaired here. Brev workspace
absence was verified.
- [Seventh Brev
run](https://github.com/NVIDIA/NemoClaw/actions/runs/36479536230) passed
on `006d984`: the image producer, fresh-boot qualification, exact clean
provenance, and full E2E passed. The temporary Brev workspace was
verified absent.
- Follow-up support tests after updating three stale shell-argument
expectations and integrating the current base: 151 passed on macOS (41
Linux-only skips); all 192 cases passed on Linux after supplying the
generated shared JavaScript outputs. The stale assertion was reproduced
before correction. The four readiness-related files also passed all 175
tests after the base update.
- Diff inspection: no secrets, API keys, credentials, or unrelated
feature changes. Normal publication validation and all three TypeScript
pre-push checks passed for `655c06b5d9`. Current-head hosted CI and
review are pending.

## Review notes

All ordinary CI and [all nine Advisor
specialists](https://github.com/NVIDIA/NemoClaw/actions/runs/36473980213)
passed for `7c5a399`. Every specialist summary, finding ledger, and E2E
recommendation was read, along with paginated PR comments, reviews, and
inline comments. There were no actionable findings. Earlier valid
Advisor findings about log-retention order and documentation were
repaired and reviewed in that candidate.

The logout repair has local before/after and denial evidence plus a
successful live Brev run. Its initial ordinary CI failures were three
stale `-lc` assertions; the follow-up changes them to `-c`. Local Docker
Advisor completed all nine specialists with no findings for the final
tree of `655c06b5d9db4b82181aa293b9d0b914232c358e` against
`946fb1611be605f14af3bc7a78d964c0b331463f`. Its disposable snapshot tree
`d67ef1e59bc86496339b6d0279811863ea34651f` was verified identical to the
candidate; all summaries, finding ledgers, and E2E recommendations were
read. Review sandboxes and gateway were cleaned up. Current-head hosted
CI and review are pending. The PR remains a draft; no merge approval is
claimed.

---
Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Launch-readiness failures now include a diagnostic stage and a safe,
classified reason when available, making failures easier to understand
without exposing sensitive error details.
* Live inference checks now retry once after a specific temporary
service-unavailable response. Other failures remain non-retryable, and
availability evidence is retained even if writing an artifact fails.
* Launch cleanup now reports progress and continues independent cleanup
steps when one fails.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Julie Yaunches <jyaunches@nvidia.com>
@wscurran wscurran added area: e2e End-to-end tests, nightly failures, or validation infrastructure area: security Security controls, permissions, secrets, or hardening chore Build, CI, dependency, or tooling maintenance integration: openclaw OpenClaw integration behavior needs: rebase PR needs rebase or conflict resolution labels Oct 6, 2026
@jyaunches

Copy link
Copy Markdown
Contributor Author

Closing as mostly superseded by #12389, which incorporated the bounded HTTP-503 retry and sanitized launch diagnostics. The full conflicting PR does not need revival.

The remaining regression test is NOT considered redundant: it accepts a reference-only auth profile, inserts a synthetic credential into that same file, and requires path-only detection without exposing the value. Current main does not contain this specific case.

Preserved below is the exact standalone test patch extracted from this PR, so it can be applied independently. git apply --check passes against the current main version of the target test file. This preserves the test for follow-up; it has not been merged or executed as part of this closure.

diff --git a/test/e2e/support/sandbox-credential-boundary.test.ts b/test/e2e/support/sandbox-credential-boundary.test.ts
index 9405b7af7a9..2ed3ff0c9e0 100644
--- a/test/e2e/support/sandbox-credential-boundary.test.ts
+++ b/test/e2e/support/sandbox-credential-boundary.test.ts
@@ -60,6 +60,29 @@ function scanWithoutRootPrivileges(root: string): string {
 }
 
 describe("sandbox credential scan", () => {
+  it("accepts an auth reference and detects a credential added to the same file", () => {
+    const root = createScanRoot();
+    const canary = "nvapi-nemoclaw-auth-profile-credential-canary";
+    const file = path.join(root, ".openclaw/agents/main/agent/auth-profiles.json");
+    const profile: Record<string, Record<string, unknown>> = {
+      "inference:manual": {
+        type: "api_key",
+        provider: "inference",
+        keyRef: { source: "env", id: "NVIDIA_INFERENCE_API_KEY" },
+        profileId: "inference:manual",
+      },
+    };
+    fs.mkdirSync(path.dirname(file), { recursive: true });
+    fs.writeFileSync(file, JSON.stringify(profile));
+    expect(scan(root)).toBe("");
+
+    profile["inference:manual"].key = canary;
+    fs.writeFileSync(file, JSON.stringify(profile));
+    const output = scan(root);
+    expect(output.trim()).toBe(file);
+    expect(output).not.toContain(canary);
+  });
+
   it("rejects fixture paths outside the temporary scan root", () => {
     const root = createScanRoot();
 

@jyaunches jyaunches closed this Oct 12, 2026
@jyaunches jyaunches changed the title test(e2e): handle inference unavailability and retain launch diagnostics test(security): cover credentials added to reference-only auth profiles Oct 12, 2026
@cv
cv deleted the codex/fix-brev-credential-boundary branch November 21, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: e2e End-to-end tests, nightly failures, or validation infrastructure area: security Security controls, permissions, secrets, or hardening chore Build, CI, dependency, or tooling maintenance integration: openclaw OpenClaw integration behavior needs: rebase PR needs rebase or conflict resolution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants