mirror of
https://github.com/KeygraphHQ/shannon.git
synced 2026-11-25 21:54:35 +01:00
fix(worker): verify OpenAI cyber access through Daybreak before the scan (#540)
* feat(worker): verify OpenAI cyber access through Daybreak * docs: document the Daybreak cyber access check * docs: regenerate llms-full.txt
This commit is contained in:
1 parent
543c53248d
commit
892fda0282
7 files changed
+195
-4
No files matched your search
@@ -168,6 +168,7 @@ Around those phases:
|
||||
- **Prompts** — Per-phase templates in `apps/worker/prompts/` with variable substitution (`{{TARGET_URL}}`, `{{CONFIG_CONTEXT}}`). Shared partials in `apps/worker/prompts/shared/` via `apps/worker/src/services/prompt-manager.ts`, including `_code-path-rules.txt` (focus/avoid `[FILE]`/`[GLOB]` routing) and `_rules-of-engagement.txt` (free-text engagement rules). When `exploit: false`, `apps/worker/src/services/findings-renderer.ts` deterministically converts each `*_exploitation_queue.json` into a `*_findings.md` for report assembly — no LLM in the loop
|
||||
- **Agent Harness (pi)** — Uses the **pi harness** (`@earendil-works/pi-coding-agent`, requires Node ≥ 22.19) via `apps/worker/src/ai/pi/pi-executor.ts` (`runPiPrompt` → `createAgentSession`). Retry is split in `apps/worker/src/ai/pi/retry-settings.ts`: pi's agent-level loop is off so Temporal owns agent restarts, while `provider.maxRetries` stays on — pi reads the `provider` block independently of the `enabled` flag — so transport faults are absorbed in-session rather than costing a full agent re-run. `maxRetryDelayMs` is left at pi's 60s default. One model runs every phase, named by `SHANNON_AI_MODEL=<provider>:<model-id>` (default `anthropic:claude-sonnet-4-6`). `apps/worker/src/ai/models.ts` parses the spec — splitting on the **first** colon only, so Bedrock IDs keep theirs — and resolves it through pi's `ModelRuntime`. pi ships the `CredentialStore` interface but no in-memory implementation (its own reads `auth.json` from disk), so `RuntimeCredentialStore` in that file supplies one: credentials arrive as env vars in an ephemeral container and must never touch disk. `createModelRuntime(providerId, apiKey)` builds the runtime with `allowModelNetwork: true`, so `ModelRuntime.create()` refreshes the model catalogue over the network at scan start and a freshly released model resolves without a `--models-config` file. The fetch is bounded (10s) and falls back to the static catalogue on timeout, so an unreachable catalogue endpoint cannot hang the scan. The refresh does not override a `--models-config`: pi reloads and re-applies that file as a config overlay on every refresh (it reloads `this.config` at the top of `refresh()`), so custom definitions still win over the fetched catalogue; the merge semantics below are unchanged, just layered over a fresher base. `resolveModelSelection()` is **async** because `ModelRuntime.create()` is. Any pi-ai provider id is accepted — `parseModelSpec` no longer rejects against a hardcoded list, so pi's registry is the authority (an unknown provider/model surfaces as a clear "not found in pi registry" error at preflight, which points to the browsable catalogue at `pi.dev/models` — `PI_CATALOG_URL` in `apps/worker/src/ai/models.ts`, appended to the not-found errors and shown in the setup wizard's "Other provider" hint). Four providers are **curated** (`CURATED_PROVIDERS`: `anthropic`, `openai`, `xai`, `amazon-bedrock`) with their own credential variables, config sections, and setup flows; each provider's API key env var is declared once in `PROVIDER_API_KEY_ENV` — Shannon uses each vendor's own variable name (`OPENAI_API_KEY`, `XAI_API_KEY`, …), never an invented one; Bedrock's entry is `AWS_BEARER_TOKEN_BEDROCK`, paired with `AWS_REGION`, which preflight requires separately as provider config rather than a credential. Any other provider uses the **generic** credential path: `SHANNON_AI_API_KEY` (`GENERIC_API_KEY_ENV`) supplies the key for any provider whose credential is a plain API key. Curated providers' own variables take precedence over it, and it also works as a fallback for them — Bedrock is the sole exception (it authenticates through its AWS_ variables, so the generic key never stands in for it). The CLI forwards `SHANNON_AI_API_KEY` in `COMMON_FORWARD_VARS` (it is provider-neutral, binding to whatever `SHANNON_AI_MODEL` names, so the "only one provider configured" guard counts only named credentials), and stores it under a generic `[provider]` config.toml section (`provider.api_key`). `npx @keygraph/shannon setup` exposes this as the "Other provider" option: free-text provider id + model id + key (a curated provider id is rejected there, since it has its own option). A model pi's catalogue does not carry, such as a self-hosted model, is reachable without an SDK bump: `--models-config <file>` mounts a pi `models.json` read-only at `/app/models.json`. The mount is the entire CLI→worker protocol: nothing is forwarded through the environment, and `modelsConfigPath()` detects the file at that fixed path, exactly as `piAuthPresent()` detects the pi auth mount whose flag is likewise not forwarded (`MODELS_CONFIG_CONTAINER_PATH` in the CLI and `MODELS_CONFIG_PATH` in `apps/worker/src/paths.ts` must stay in sync). `createModelRuntime` always names `modelsPath` explicitly — the mounted path, or **`null` when no config was supplied**, which switches models.json off outright. It is never left to pi's default of `<agent dir>/models.json`, because that dir is shared with the pi auth mount, so a file landing there must not silently contribute model definitions to a scan that did not ask for one. `modelsStorePath` is pinned to the agent dir alongside it, since pi otherwise derives it from `dirname(modelsPath)` and would try to write beside a read-only mount. Custom definitions merge over the built-in catalogue: a matching model id replaces the built-in entry, a new id is added alongside, and `modelOverrides` adjusts a built-in without replacing the proviLine truncated
|
||||
- **Pi Credential Reuse** — `SHANNON_USE_PI_AUTH=1` opts into reusing the host's Pi login, including an `openai-codex` ChatGPT Plus/Pro subscription (`SHANNON_AI_MODEL=openai-codex:<model-id>`) or an `xai` Grok subscription (`SHANNON_AI_MODEL=xai:<model-id>`); the mechanism is provider-agnostic and works for any Pi login. `apps/cli/src/env.ts` requires `~/.pi/agent/auth.json`; `start.ts` passes its path to `spawnWorker`, which mounts only that file read-write at `/tmp/.pi/agent/auth.json`. The flag itself is not forwarded: the worker detects the file with `piAuthPresent()` and passes its path to `ModelRuntime.create`. CLI and worker API-key presence checks are skipped on this path, but the normal preflight model probe still validates the credential. The image and UID-remapping entrypoint keep `/tmp/.pi/agent` owned by `pentest` so adjacent Pi/Shannon configuration remains writable. Refreshed OAuth state is persisted to the host for subsequent scans.
|
||||
- **Cyber access verification**: the `runCyberAccessVerification` preflight activity (`apps/worker/src/temporal/activities.ts`, service in `apps/worker/src/services/cyber-access-verification.ts`) runs on every scan and under `--validate-model`, not under `--validate-auth`. `openai` and `openai-codex` get a deterministic Daybreak check instead of a model prompt: a minimal streamed Responses request carrying `access_programs.cyber`, tried with `daybreak_blue` then `daybreak_red`, using the credential pi resolves (`modelRuntime.getAuth`, so an API key or a Pi OAuth login). The URL is the model's base URL as given plus `/responses` (`openai`) or `/codex/responses` (`openai-codex`, which also sends `chatgpt-account-id` from the token). A program counts as accepted only on a 2xx stream with no `error` event, since a refusal can arrive inside a 200. Both refused fails with `OpenAiCyberAccessError`; any answer that cannot confirm access fails with `CyberAccessUnverifiedError`, retried first when transient (network, timeout, 429, 5xx). `gpt-5.4` runs without Daybreak and is skipped. Anthropic keeps the exploit-workload prompt, which gates only on a confirmed safeguard decline
|
||||
- **Terminal failure messages** — Every failure type that can end a scan is in the closed `WORKFLOW_FAILURE_TYPES` list (`apps/worker/src/types/workflow-failures.ts`) with a fixed user-safe message (`SAFE_WORKFLOW_FAILURE_MESSAGES`), an optional hint, and a reference code (the type plus the failure's `checkCode` detail). An ApplicationFailure's own `.message` is never shown. Throw sites name terminal types through `failureType(...)`, so a type missing from the list fails to compile. `formatWorkflowError` says "Resume failed" when the resume step refused. The workflow's terminal failure carries the type and check code as structured details (`TerminalFailureDetails`), so nothing parses display text. The CLI reads those details or the matching `PipelineState` fields and renders from its own copy of the messages (`WORKFLOW_FAILURE_MESSAGES` in `apps/cli/src/scan/safe-fields.ts`); the two tables must stay in sync
|
||||
- **Audit System** — Crash-safe append-only logging in `workspaces/{hostname}_{sessionId}/`. The run directory's top level holds the human-facing report in both formats (`Security-Assessment-Report.pdf` and `Security-Assessment-Report.md`, `FINAL_REPORT_PDF_FILENAME`/`FINAL_REPORT_MD_FILENAME` in `apps/worker/src/paths.ts`); everything else — deliverables, per-agent logs, prompts, `session.json`, `workflow.log`, and browser artifacts — is nested under a hidden `.shannon/` internals dir (`INTERNAL_DIR`) so a customer sees only the report. Audit path helpers route through `generateInternalPath` (`apps/worker/src/audit/utils.ts`); the CLI nests the overlay backing dirs under the same `.shannon/` (`apps/cli/src/docker.ts`, `start.ts`). `session.json`/`workflow.log` reads use dual-read resolvers (`resolveSessionJsonPath`, `resolveRunFile`) that prefer `.shannon/` and fall back to the legacy run-root layout, so pre-restructure workspaces stay listable (`scans`/`logs`) without migration. A pre-restructure workspace cannot be resumed: `classifyWorkspaceLaunch` (`apps/cli/src/commands/start.ts`) requires `.shannon/launch.json`, and its absence fails the launch as "created by an earlier version of Shannon" before anything on disk is touched. There is no in-place migration — the workspace's files and report are left untouched, and the operator starts a new scan under a different `-w` name. The report agent writes structured findings to `report.json`, from which `report-renderer.ts` renders the assembled markdown and `report-json-adapter.ts` produces the Typst-shaped JSON that `pdf-renderer.ts` compiles into `comprehensive_security_assessment_report.pdf` using the bundled `apps/worker/templates/typst/report.typ` template (the `typst` binary is installed in the worker image). `copyReportToRunRoot` (`apps/worker/src/services/reporting.ts`) surfaces both the PDF and the markdown to the run root as `Security-Assessment-Report.pdf` and `Security-Assessment-Report.md`; the deliverables-dir copies remain as the git-checkpointed sources. PDF compilation is best-effort — a failure is logged and the run still completes. WorkflowLogger (`apps/worker/src/audit/workflow-logger.ts`) provides unified human-readable per-workflow logs, backed by LogStream (`apps/worker/src/audit/log-stream.ts`) shared stream primitive. Every combined-log line is also projected into a per-agent file under `.shannon/agents/<slug>.log` (one per pipeline agent, one per Capella stage; subagents fold into the parent's file, and a stage's concurrent sessions share its file with an inline session label). The projection boundary is `apps/worker/src/audit/actor-projection.ts` (`projectActor` maps a `TraceActor` to its combined prefix and owning file slug — slugs come only from closed fields); fan-out is best-effort and never blocks the canonical combined log. A lifecycle owner holds a `LogStream` lease per agent file (the pipeline agent's `logAgent` span, or a Capella stage activity's `try/finally`) so per-line writes ride the reference count; `CapellaStageTrace.drain()` flushes a stage's trace queue before its activity returns. The CLI tails one file with `shannon logs --agent <name>` (`--list-agents` to enumerate); the default `shannon logs` path is unchanged
|
||||
- **Deliverables** — Saved to `.shannon/deliverables/` in the target repo. Agents emit structured output through collector tools (`apps/worker/src/collectors/`) and the exploitation-queue submit tool; the host renders each deliverable from those calls
|
||||
|
||||
@@ -307,6 +307,7 @@ const WORKFLOW_FAILURE_MESSAGES: Readonly<Record<string, string>> = Object.freez
|
||||
URLMismatchError: 'This workspace was created for a different target URL.',
|
||||
OpenAiCyberAccessError: 'OpenAI declined the security workload behind its cyber-access program.',
|
||||
AnthropicCyberAccessError: 'Anthropic declined the security workload behind its cyber-access program.',
|
||||
CyberAccessUnverifiedError: 'OpenAI cyber access could not be confirmed for the selected model.',
|
||||
TransientError: 'A scan step kept failing on temporary errors and ran out of retries.',
|
||||
PermanentError: 'A scan step failed with an error that cannot be retried.',
|
||||
UnknownError: 'A scan step failed with an unclassified error.',
|
||||
|
||||
@@ -191,3 +191,122 @@ export async function verifyCyberAccess(
|
||||
return { providerId, error: thrown.message };
|
||||
}
|
||||
}
|
||||
|
||||
// === DAYBREAK ACCESS ===
|
||||
|
||||
/** OpenAI's Daybreak cyber access programs, tried in order. */
|
||||
const DAYBREAK_PROGRAMS = ['daybreak_blue', 'daybreak_red'] as const;
|
||||
|
||||
const GPT_54_MODEL = 'gpt-5.4';
|
||||
|
||||
// Two pings must fit inside the preflight activity's 2-minute timeout.
|
||||
const DAYBREAK_PING_TIMEOUT_MS = 30_000;
|
||||
|
||||
const DAYBREAK_PROVIDERS: ReadonlySet<string> = new Set(['openai', 'openai-codex']);
|
||||
|
||||
export function usesDaybreakCheck(providerId: string): boolean {
|
||||
return DAYBREAK_PROVIDERS.has(providerId);
|
||||
}
|
||||
|
||||
export function runsWithoutDaybreak(model: Model<Api>): boolean {
|
||||
return model.id === GPT_54_MODEL;
|
||||
}
|
||||
|
||||
/** `transient`: a retry may fix the cause (network, timeout, 429, 5xx). */
|
||||
export type DaybreakAccess =
|
||||
| { readonly status: 'enabled' }
|
||||
| { readonly status: 'declined' }
|
||||
| { readonly status: 'unverified'; readonly transient: boolean; readonly checkCode: string };
|
||||
|
||||
function unverifiedPing(result: PingResult | undefined): DaybreakAccess {
|
||||
if (result === undefined) return { status: 'unverified', transient: true, checkCode: 'daybreak-request-failed' };
|
||||
const transient = result.status === 429 || result.status >= 500;
|
||||
return { status: 'unverified', transient, checkCode: `daybreak-http-${result.status}` };
|
||||
}
|
||||
|
||||
interface PingResult {
|
||||
readonly status: number;
|
||||
readonly body: string;
|
||||
}
|
||||
|
||||
interface DaybreakEndpoint {
|
||||
readonly url: string;
|
||||
readonly headers: Readonly<Record<string, string>>;
|
||||
}
|
||||
|
||||
/** Selects the ChatGPT workspace, since Daybreak access is per organization. */
|
||||
function codexAccountId(token: string): string | undefined {
|
||||
try {
|
||||
const payload = JSON.parse(Buffer.from(token.split('.')[1] ?? '', 'base64url').toString());
|
||||
const accountId = payload?.['https://api.openai.com/auth']?.chatgpt_account_id;
|
||||
return typeof accountId === 'string' ? accountId : undefined;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function daybreakEndpoint(providerId: string, baseUrl: string, token: string): DaybreakEndpoint {
|
||||
const headers: Record<string, string> = { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' };
|
||||
if (providerId !== 'openai-codex') {
|
||||
const url = baseUrl.endsWith('/') ? `${baseUrl}responses` : `${baseUrl}/responses`;
|
||||
return { url, headers };
|
||||
}
|
||||
|
||||
const accountId = codexAccountId(token);
|
||||
if (accountId !== undefined) headers['chatgpt-account-id'] = accountId;
|
||||
return { url: `${baseUrl}/codex/responses`, headers };
|
||||
}
|
||||
|
||||
/** Pi OAuth logins require list input, `store: false` and `stream: true`. */
|
||||
async function daybreakPing(
|
||||
endpoint: DaybreakEndpoint,
|
||||
modelId: string,
|
||||
program: string,
|
||||
): Promise<PingResult | undefined> {
|
||||
const body = {
|
||||
model: modelId,
|
||||
input: [{ role: 'user', content: 'ping' }],
|
||||
max_output_tokens: 16,
|
||||
store: false,
|
||||
stream: true,
|
||||
access_programs: { cyber: program },
|
||||
};
|
||||
try {
|
||||
const response = await fetch(endpoint.url, {
|
||||
method: 'POST',
|
||||
headers: endpoint.headers,
|
||||
body: JSON.stringify(body),
|
||||
signal: AbortSignal.timeout(DAYBREAK_PING_TIMEOUT_MS),
|
||||
});
|
||||
return { status: response.status, body: await response.text() };
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/** A streamed request can be refused after a 200, as an in-stream `error` event. */
|
||||
function programAccepted({ status, body }: PingResult): boolean {
|
||||
const succeeded = status >= 200 && status < 300;
|
||||
return succeeded && !body.includes('event: error');
|
||||
}
|
||||
|
||||
function tryNextProgram({ body }: PingResult): boolean {
|
||||
return body.includes('access_program_not_enabled') || body.includes('invalid_access_program');
|
||||
}
|
||||
|
||||
/** Tries each Daybreak program until one accepts. Never throws. */
|
||||
export async function verifyDaybreakAccess(
|
||||
providerId: string,
|
||||
baseUrl: string,
|
||||
apiKey: string,
|
||||
modelId: string,
|
||||
): Promise<DaybreakAccess> {
|
||||
const endpoint = daybreakEndpoint(providerId, baseUrl, apiKey);
|
||||
for (const program of DAYBREAK_PROGRAMS) {
|
||||
const result = await daybreakPing(endpoint, modelId, program);
|
||||
if (result === undefined) return unverifiedPing(result);
|
||||
if (programAccepted(result)) return { status: 'enabled' };
|
||||
if (!tryNextProgram(result)) return unverifiedPing(result);
|
||||
}
|
||||
return { status: 'declined' };
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import { createHash } from 'node:crypto';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { ApplicationFailure, Context, heartbeat } from '@temporalio/activity';
|
||||
import { resolveModelSelection } from '../ai/models.js';
|
||||
import { type ModelSelection, resolveModelSelection } from '../ai/models.js';
|
||||
import { syncPermissionSystemConfig } from '../ai/pi/permission-system.js';
|
||||
import { writePlaywrightStealthConfig } from '../ai/playwright-config-writer.js';
|
||||
import { AuditSession } from '../audit/index.js';
|
||||
@@ -42,9 +42,13 @@ import { compactReportFindings as compactReportFindingsService } from '../servic
|
||||
import { getContainer, getOrCreateContainer, removeContainer } from '../services/container.js';
|
||||
import {
|
||||
type CyberAccessResult,
|
||||
type DaybreakAccess,
|
||||
isCyberGatedProvider,
|
||||
isCyberSafeguardDecline,
|
||||
runsWithoutDaybreak,
|
||||
usesDaybreakCheck,
|
||||
verifyCyberAccess,
|
||||
verifyDaybreakAccess,
|
||||
} from '../services/cyber-access-verification.js';
|
||||
import { classifyErrorForTemporal, PentestError } from '../services/error-handling.js';
|
||||
import { RenumberError } from '../services/exact-output-commit.js';
|
||||
@@ -79,6 +83,7 @@ import type { ReportData, ReportMeta } from '../services/report-renderer.js';
|
||||
import { assembleFinalReportWithEvidence } from '../services/reporting.js';
|
||||
import { validateAuthentication } from '../services/validate-authentication.js';
|
||||
import { AGENTS } from '../session-manager.js';
|
||||
import type { ActivityLogger } from '../types/activity-logger.js';
|
||||
import type { AgentName } from '../types/agents.js';
|
||||
import type { ContainerConfig, VulnClass } from '../types/config.js';
|
||||
import { ErrorCode } from '../types/errors.js';
|
||||
@@ -891,10 +896,54 @@ function cyberAccessErrorType(
|
||||
return providerId === 'anthropic' ? 'AnthropicCyberAccessError' : 'OpenAiCyberAccessError';
|
||||
}
|
||||
|
||||
async function checkDaybreakAccess(selection: ModelSelection, logger: ActivityLogger): Promise<DaybreakAccess> {
|
||||
let apiKey: string | undefined;
|
||||
try {
|
||||
apiKey = (await selection.modelRuntime.getAuth(selection.providerId))?.auth.apiKey;
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
logger.info(`Cyber access verification: Daybreak unverified (credential error: ${message.slice(0, 200)})`);
|
||||
return { status: 'unverified', transient: true, checkCode: 'daybreak-credential-error' };
|
||||
}
|
||||
if (!apiKey) {
|
||||
logger.info('Cyber access verification: Daybreak unverified (no credential resolved)');
|
||||
return { status: 'unverified', transient: false, checkCode: 'daybreak-no-credential' };
|
||||
}
|
||||
|
||||
logger.info(`Verifying Daybreak access for ${selection.model.id}...`);
|
||||
const access = await verifyDaybreakAccess(selection.providerId, selection.model.baseUrl, apiKey, selection.model.id);
|
||||
const detail = access.status === 'unverified' ? ` (${access.checkCode})` : '';
|
||||
logger.info(`Cyber access verification: Daybreak ${access.status}${detail} for ${selection.model.id}`);
|
||||
return access;
|
||||
}
|
||||
|
||||
function daybreakFailure(
|
||||
access: Exclude<DaybreakAccess, { status: 'enabled' }>,
|
||||
selection: ModelSelection,
|
||||
attemptNumber: number,
|
||||
startTime: number,
|
||||
): ApplicationFailure {
|
||||
const details = { phase: 'cyber-access', attemptNumber, elapsed: Date.now() - startTime };
|
||||
let failure: ApplicationFailure;
|
||||
if (access.status === 'declined') {
|
||||
const message = truncateErrorMessage(`openai has no Daybreak access program enabled for ${selection.model.id}`);
|
||||
failure = ApplicationFailure.nonRetryable(message, cyberAccessErrorType(selection.providerId), [details]);
|
||||
} else {
|
||||
const message = truncateErrorMessage(`Daybreak access could not be verified for ${selection.model.id}`);
|
||||
const type = failureType('CyberAccessUnverifiedError');
|
||||
const failureDetails = [{ ...details, checkCode: access.checkCode }];
|
||||
failure = access.transient
|
||||
? ApplicationFailure.retryable(message, type, failureDetails)
|
||||
: ApplicationFailure.nonRetryable(message, type, failureDetails);
|
||||
}
|
||||
truncateStackTrace(failure);
|
||||
return failure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cyber access verification activity. For OpenAI/Anthropic, hands the model a slice of the
|
||||
* exploit agent's workload and gates on a decline (`stopReason: error`), failing the scan with the
|
||||
* provider's own message. A setup/transport fault is not a decline and never gates.
|
||||
* Cyber access verification activity. `openai` and `openai-codex` are checked through Daybreak
|
||||
* (GPT-5.4 is skipped) and fail the scan unless access is confirmed. Anthropic gets a slice of the
|
||||
* exploit agent's workload and gates only on a confirmed decline.
|
||||
*
|
||||
* Returns `{ gated }` — true only for a provider that actually gates security workloads, so the
|
||||
* caller records the cyber-access stage for those alone (a non-gated provider ran a no-op check).
|
||||
@@ -920,9 +969,22 @@ export async function runCyberAccessVerification(_input: ActivityInput): Promise
|
||||
return { gated: false };
|
||||
}
|
||||
|
||||
if (usesDaybreakCheck(selection.providerId)) {
|
||||
if (runsWithoutDaybreak(selection.model)) {
|
||||
logger.info(`Cyber access verification: skipped (${selection.model.id} runs without Daybreak)`);
|
||||
return { gated: false };
|
||||
}
|
||||
|
||||
const access = await checkDaybreakAccess(selection, logger);
|
||||
if (access.status === 'enabled') return { gated: true };
|
||||
throw daybreakFailure(access, selection, attemptNumber, startTime);
|
||||
}
|
||||
|
||||
logger.info('Verifying cyber access via pi...');
|
||||
result = await verifyCyberAccess(selection.model, selection.modelRuntime, selection.providerId);
|
||||
} catch (error) {
|
||||
// A Daybreak failure must not be swallowed as a setup fault.
|
||||
if (error instanceof ApplicationFailure) throw error;
|
||||
// Setup/transport fault, not a decline — never gates the scan.
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
logger.info(`Cyber access verification: skipped (${message.slice(0, 200)})`);
|
||||
|
||||
@@ -40,6 +40,7 @@ export const WORKFLOW_FAILURE_TYPES = [
|
||||
'URLMismatchError',
|
||||
'OpenAiCyberAccessError',
|
||||
'AnthropicCyberAccessError',
|
||||
'CyberAccessUnverifiedError',
|
||||
'TransientError',
|
||||
'PermanentError',
|
||||
'UnknownError',
|
||||
@@ -89,6 +90,7 @@ export const SAFE_WORKFLOW_FAILURE_MESSAGES: Readonly<Record<WorkflowFailureType
|
||||
URLMismatchError: 'This workspace was created for a different target URL.',
|
||||
OpenAiCyberAccessError: 'OpenAI declined the security workload behind its cyber-access program.',
|
||||
AnthropicCyberAccessError: 'Anthropic declined the security workload behind its cyber-access program.',
|
||||
CyberAccessUnverifiedError: 'OpenAI cyber access could not be confirmed for the selected model.',
|
||||
TransientError: 'A scan step kept failing on temporary errors and ran out of retries.',
|
||||
PermanentError: 'A scan step failed with an error that cannot be retried.',
|
||||
UnknownError: 'A scan step failed with an unclassified error.',
|
||||
@@ -116,6 +118,8 @@ export const WORKFLOW_FAILURE_HINTS: Readonly<Partial<Record<WorkflowFailureType
|
||||
'Your OpenAI organization must be approved for cyber use. Apply for cyber access at https://chatgpt.com/cyber, then retry. Or use the gpt-5.4 model instead.',
|
||||
AnthropicCyberAccessError:
|
||||
'Your Anthropic organization must complete cyber verification. See https://support.claude.com/en/articles/14604842-real-time-cyber-safeguards-on-claude-opus-and-sonnet, then retry. Or use the claude-sonnet-4-6 model instead.',
|
||||
CyberAccessUnverifiedError:
|
||||
'Check the OpenAI credential and endpoint, then retry. If SHANNON_AI_BASE_URL is set, that endpoint must forward the access_programs request field to OpenAI.',
|
||||
TransientError: 're-run the same -w to retry from the last checkpoint.',
|
||||
});
|
||||
|
||||
|
||||
@@ -142,6 +142,8 @@ export SHANNON_AI_MODEL=openai:gpt-6-sol
|
||||
export SHANNON_AI_BASE_URL=https://llm-gateway.example.com/v1
|
||||
```
|
||||
|
||||
For `openai:` and `openai-codex:`, preflight confirms OpenAI cyber access by sending the `access_programs` request field, so any base URL you set must forward that field to OpenAI. An endpoint that rejects it fails the scan with `CyberAccessUnverifiedError`.
|
||||
|
||||
`npx @keygraph/shannon setup` configures a base URL two ways: **Custom Base URL** covers the common Anthropic Messages and OpenAI Responses LLM gateways, and **Other provider** takes any provider ID plus an optional base URL of its own.
|
||||
|
||||
## Custom model configuration
|
||||
|
||||
@@ -929,6 +929,8 @@ export SHANNON_AI_MODEL=openai:gpt-6-sol
|
||||
export SHANNON_AI_BASE_URL=https://llm-gateway.example.com/v1
|
||||
```
|
||||
|
||||
For `openai:` and `openai-codex:`, preflight confirms OpenAI cyber access by sending the `access_programs` request field, so any base URL you set must forward that field to OpenAI. An endpoint that rejects it fails the scan with `CyberAccessUnverifiedError`.
|
||||
|
||||
`npx @keygraph/shannon setup` configures a base URL two ways: **Custom Base URL** covers the common Anthropic Messages and OpenAI Responses LLM gateways, and **Other provider** takes any provider ID plus an optional base URL of its own.
|
||||
|
||||
## Custom model configuration
|
||||
|
||||
Reference in new issue
Block a user