Skip to content

feat(sdk): surface trusted cyber access status in scans - #236

Open
mldangelo-oai wants to merge 2 commits into
mainfrom
mdangelo/codex/trusted-cyber-access-status
Open

feat(sdk): surface trusted cyber access status in scans#236
mldangelo-oai wants to merge 2 commits into
mainfrom
mdangelo/codex/trusted-cyber-access-status

Conversation

@mldangelo-oai

Copy link
Copy Markdown
Collaborator

Summary

  • Surface Trusted Access for Cyber status from verified codex_apps/get_tac_status results without blocking scans or changing machine-readable output.
  • Add the onTrustedAccessStatus SDK callback and route ChatGPT accounts versus environment-provided or stored API keys to the appropriate enrollment guidance.
  • Reject unrelated, malformed, stale, and failed tool results; isolate observer failures; and keep CLI notices on stderr.
  • Document Trusted Access enrollment and cover status validation, authentication routing, CLI JSON integrity, and public package documentation.

Rollout

Status messages appear only when the runtime emits the trusted TAC status event. Scans continue normally when that event is unavailable.

Verification

  • Full randomized SDK suite: 740 passed, 5 expected skips, 0 failed (bun test --timeout 30000 --randomize --seed 12345 --dots ./tests-ts).
  • Focused event, SDK authentication, and CLI suite: 189 passed, 0 failed.
  • pnpm run types, pnpm run format, and pnpm run build.
  • Packed npm tarball validated successfully: 179 entries.
  • Built SDK import and CLI version smoke checks passed.

@github-actions github-actions Bot added the enhancement New feature or request label Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current head commit fec6d43b6c34b0602c15900f511fce9c05e64551.

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: fec6d43b6c

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fec6d43b6c

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdk/typescript/src/api.ts

try {
const stored = JSON.parse(
await readFile(join(codexHome, "auth.json"), "utf8"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve credential type for keyring-backed logins

When a stored API key uses the supported system-keyring backend (including a managed-device policy), there may be no auth.json to read, so this failure path returns stored_credentials without a credentialType. trustedAccessWarning consequently treats that API-key scan as a ChatGPT account and directs the user to chatgpt.com/cyber instead of the organizational enrollment form. Determine the stored authentication mode through a backend-independent runtime/status mechanism rather than relying exclusively on the file credential backend.

Useful? React with 👍 / 👎.

Comment thread sdk/typescript/src/api.ts
result["schemaVersion"] !== 1 ||
!Array.isArray(result["grants"]) ||
typeof result["checkedAt"] !== "string" ||
Number.isNaN(Date.parse(result["checkedAt"])) ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate checkedAt against the timestamp schema

When the provider returns a malformed checkedAt such as "1" or "0", JavaScript's permissive Date.parse interprets it as a date instead of rejecting it. A result carrying status: "granted", a valid grant, and stale: false is therefore surfaced as verified even though its timestamp does not satisfy the structured status contract, producing a false Trusted Access confirmation. Validate the expected ISO/RFC 3339 representation rather than accepting every string that Date.parse can coerce.

Useful? React with 👍 / 👎.

@mldangelo-oai
mldangelo-oai marked this pull request as ready for review August 3, 2026 18:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fec6d43b6c

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdk/typescript/src/api.ts
if (!tacStatusReported) {
const tacStatus = trustedAccessStatusFromEvent(event);
if (tacStatus !== null) {
tacStatusReported = true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep listening after an unverified TAC attempt

When the first get_tac_status call fails or returns malformed/stale data, this sets tacStatusReported immediately after classifying it as unknown. If the agent retries the tool and receives a valid granted result later in the same stream, that result is ignored, so users receive a false unverified-access warning and the status callback never reports the verified grant. Allow a later verified result to supersede an unverified attempt, or defer the final notification until retries can no longer occur.

Useful? React with 👍 / 👎.

Comment thread sdk/typescript/src/cli.ts
Comment on lines +2729 to +2731
errorOutput.write(
"codex-security: ✓ Your account has Trusted Access for Cyber.\n",
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pause the progress timer before printing the TAC notice

On an interactive TTY, onScanStarted has already started a progress timer whose current line has no trailing newline. Writing the granted notice directly therefore appends it to the timer text, and the next timer refresh uses \r to overwrite part of the notice, producing garbled or hidden output. Stop the timer before emitting this line and restart it afterward, as the other mid-scan progress callbacks do.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19c6a55d83

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdk/typescript/src/cli.ts
Comment on lines +2736 to +2738
errorOutput.write(
"codex-security: ✓ Your account has Trusted Access for Cyber.\n",
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Attribute API-key grants to the organization

When a scan uses an environment API key (or a stored API key whose type was detected), the TAC result applies to the API organization, but this unconditional message tells the operator that their personal account has access. Branch on selectedAuthentication, as the warning path already does, so API-key scans report that the organization has Trusted Access.

Useful? React with 👍 / 👎.

Comment thread sdk/typescript/README.md
Comment on lines +172 to +174
Some cybersecurity requests and protected findings require approval through
Trusted Access for Cyber. To apply or check your access, visit
[chatgpt.com/cyber](https://chatgpt.com/cyber).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document the organizational enrollment route

This authentication section covers environment and stored API keys immediately above, but directs every reader to the personal ChatGPT enrollment page. API-key access is organization-scoped and the new runtime guidance correctly uses the enterprise Trusted Access form, so API-key users following this documentation are sent to the wrong application flow; document both routes and identify which credential type uses each.

Useful? React with 👍 / 👎.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 19c6a55

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 19c6a55d83

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 19c6a55d83

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant