Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/e2e-vitest-scenarios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,50 @@ jobs:
if-no-files-found: ignore
retention-days: 14

hermes-sandbox-secret-boundary-vitest:
needs: generate-matrix
if: ${{ (inputs.jobs == '' && inputs.scenarios == '') || contains(format(',{0},', inputs.jobs), ',hermes-sandbox-secret-boundary-vitest,') || contains(format(',{0},', inputs.scenarios), ',hermes-sandbox-secret-boundary,') }}
runs-on: ubuntu-latest
timeout-minutes: 60
env:
FREE_STANDING_VITEST_JOB: "1"
FREE_STANDING_SCENARIO_ID: "hermes-sandbox-secret-boundary"
E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts/vitest/hermes-sandbox-secret-boundary
NEMOCLAW_RUN_E2E_SCENARIOS: "1"
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false

- name: Set up Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.0.0
with:
node-version: 22
cache: npm

- name: Install root dependencies
run: npm ci --ignore-scripts

- name: Run Hermes sandbox secret-boundary live test
# Migrated from test/e2e/test-hermes-sandbox-secret-boundary.sh. This
# builds the real Hermes images unless prebuilt NEMOCLAW_HERMES_* image
# env vars are supplied, then probes image and startup secret boundaries.
run: |
set -euo pipefail
npx vitest run --project e2e-scenarios-live \
test/e2e-scenario/live/hermes-sandbox-secret-boundary.test.ts \
--silent=false --reporter=default

- name: Upload Hermes sandbox secret-boundary artifacts
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: e2e-vitest-scenarios-hermes-sandbox-secret-boundary
path: e2e-artifacts/vitest/hermes-sandbox-secret-boundary/
include-hidden-files: false
if-no-files-found: ignore
retention-days: 14

inference-routing-vitest:
needs: generate-matrix
if: ${{ (inputs.jobs == '' && inputs.scenarios == '') || contains(format(',{0},', inputs.jobs), ',inference-routing-vitest,') || contains(format(',{0},', inputs.scenarios), ',inference-routing,') }}
Expand Down Expand Up @@ -5326,6 +5370,7 @@ jobs:
hermes-slack-vitest,
hermes-discord-vitest,
hermes-root-entrypoint-smoke-vitest,
hermes-sandbox-secret-boundary-vitest,
network-policy-vitest,
common-egress-agent-vitest,
shields-config-vitest,
Expand Down
41 changes: 25 additions & 16 deletions test/e2e-scenario/fixtures/docker-probe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ export type DockerProbeRunner = (
options: SpawnSyncOptionsWithStringEncoding,
) => SpawnSyncReturns<string>;

type DockerProbeRunOptions = {
artifactName: string;
timeoutMs?: number;
artifactRedactionValues?: string[];
returnRaw?: boolean;
};

const DOCKER_ENV_ALLOWLIST = [
"DOCKER_HOST",
"DOCKER_CONTEXT",
Expand Down Expand Up @@ -98,7 +105,7 @@ export class DockerProbe {

async run(
args: string[],
options: { artifactName: string; timeoutMs?: number } = { artifactName: "docker" },
options: DockerProbeRunOptions = { artifactName: "docker" },
): Promise<DockerCommandResult> {
fs.mkdirSync(this.dockerConfigDir, { recursive: true });
const command = ["docker", ...args];
Expand All @@ -109,30 +116,32 @@ export class DockerProbe {
maxBuffer: 10 * 1024 * 1024,
timeout: options.timeoutMs ?? 30_000,
});
const commandResult = redactDockerProbeResult(
{
command,
exitCode: result.status,
signal: result.signal,
stdout: result.stdout ?? "",
stderr: result.stderr ?? "",
error: result.error instanceof Error ? result.error.message : undefined,
},
this.redact,
const rawCommandResult = {
command,
exitCode: result.status,
signal: result.signal,
stdout: result.stdout ?? "",
stderr: result.stderr ?? "",
error: result.error instanceof Error ? result.error.message : undefined,
};
const commandResult = redactDockerProbeResult(rawCommandResult, (text) =>
this.redact(text, options.artifactRedactionValues ?? []),
);
const artifactBase = `docker/${String(++this.sequence).padStart(3, "0")}-${safeName(
options.artifactName,
)}`;
await this.artifacts.writeText(`${artifactBase}.stdout.txt`, commandResult.stdout);
await this.artifacts.writeText(`${artifactBase}.stderr.txt`, commandResult.stderr);
await this.artifacts.writeJson(`${artifactBase}.result.json`, commandResult);
return commandResult;
return options.returnRaw === true ? rawCommandResult : commandResult;
}

async expect(
args: string[],
options: { artifactName: string; timeoutMs?: number },
): Promise<DockerCommandResult> {
async expect(args: string[], options: DockerProbeRunOptions): Promise<DockerCommandResult> {
if (options.returnRaw === true) {
throw new Error(
"DockerProbe.expect cannot return raw Docker output; use run(..., { returnRaw: true }) only for explicit leak assertions that never log the raw result.",
);
}
const result = await this.run(args, options);
if (result.exitCode !== 0) {
throw new Error(resultText(result));
Expand Down
Loading