Skip to content

fix: consolidate contributor runtime-security hardening - #152

Merged
ianw-oai merged 32 commits into
mainfrom
mdangelo/codex/contributor-runtime-security-hardening
Jul 31, 2026
Merged

fix: consolidate contributor runtime-security hardening#152
ianw-oai merged 32 commits into
mainfrom
mdangelo/codex/contributor-runtime-security-hardening

Conversation

@mldangelo-oai

Copy link
Copy Markdown
Collaborator

Preserves the original contributor-authored commits from PRs #119, #126, #127, #141, #144, #146, #150, and #151, plus explicitly credited cross-platform login hardening from #142. Stored scan failures and multiscan diagnostics redact credentials; every turn.failed shape fails closed; scan cleanup preserves the original result; authentication/skill subprocess output and shutdown are bounded; configured plugin discovery and cost-session event parsing enforce limits; and active preflight profiles/projects survive projection bounds. Follow-up regressions prove both interactive and noninteractive oversized children that ignore SIGTERM are escalated and settle deterministically, inherited login pipes settle on every platform, and macOS login fixtures exit cleanly.

Validation: bun test --timeout 30000 ./tests-ts (487 pass, 5 platform/integration skips, 0 failures); TypeScript typecheck; Prettier checks. Original Git authorship is preserved; no external contributor forks were modified.

MBemera and others added 9 commits July 30, 2026 09:49
A failed turn was only honored when its error payload was an object with a
string message. Every other shape fell through the event loop, and because a
turn.completed had already been observed the scan was returned to the caller
as successful and recorded with complete-scan.

Treat any turn.failed as terminal. Only error.message is reused, because that
is the single shape the previous code already surfaced; no other shape is
forwarded or stringified, since this message reaches fail-scan --message and
is stored in scans.failure_message without redaction.
The scan finally block awaited knowledge-base cleanup, target-paths removal, and
the credential home release without guarding any of them. A rejection in a
finally block replaces the pending exception, so a cleanup failure discarded the
outcome the try and catch blocks had already produced and the caller was handed
an unrelated filesystem error instead of the reason the scan failed. The catch
block had already recorded the real message through fail-scan, so the persisted
scan history and the reported error disagreed.

Removing the temporary inputs is best effort and is now reported through
onWarning instead of deciding the result. Releasing the credential home lock is
not: it only marks itself done once the lock directory is gone, so a failed
release leaves an owner.json naming a live process that stale-lock recovery will
not reclaim. That failure still propagates, and is downgraded to a warning only
when the scan already failed and its error is the one worth keeping.

The failed-scan marker is recorded on entry to the catch block because
requireOpen and throwIfAborted raise a different error for the same failed scan,
the release keeps its own finally so reporting the earlier failures cannot skip
it, and the warning formatter is total so no hostile reason can throw in place of
the result.
Co-authored-by: mangeshraut712 <mbr63@drexel.edu>
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact pushed head 0409a6e. It preserves contributor-authored fixes from #119, #126, #127, #141, #144, #146, #150, and #151, credits #142, and adds regressions for oversized subprocesses that ignore termination.

@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: 0409a6e7d6

ℹ️ 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 thread sdk/typescript/src/errors.ts Outdated
Comment thread sdk/typescript/src/api.ts
Comment thread sdk/typescript/src/auth.ts
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review Please review the exact updated head 27924f5, including the newly verified platform/package regression fix and all previously raised security, correctness, and compatibility findings.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review Please review the exact current full head 27924f5, including the contributor-attributed implementation, focused regressions, platform behavior, package boundaries, and unresolved review findings.

@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: 27924f5f5a

ℹ️ 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/cost.ts
Comment thread sdk/typescript/src/errors.ts Outdated
Comment thread sdk/typescript/src/auth.ts
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review Please review the exact current head 418fd91, emphasizing the new deterministic regressions for subprocess termination, credential secrecy, configuration trust, terminal parsing, compressed document limits, and cross-platform behavior as applicable.

@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

!/(?:^|[^a-z0-9])(?:api[_-]?key|access[_-]?key(?:[_-]?id)?|key|secret|token|env|mcp|set|password|passwd|credential|authorization|bearer)(?:[^a-z0-9]|$)/iu.test(
value,

P2 Badge Preserve trusted projects with credential-like path names

When the active project's absolute path contains a component such as token, key, env, or set—for example /workspace/token-service—this credential-word filter makes safeString reject the path. The projects projection consequently drops its trust entry even when it is the active project and well within the 256-entry limit, so config_preflight.py gets no exact trust match and refuses to load the project's .codex/config.toml; project paths need structural validation without applying the credential-name filter used for model-facing strings.

ℹ️ 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/errors.ts Outdated
Comment thread sdk/typescript/src/api.ts Outdated
Comment thread sdk/typescript/src/auth.ts
mldangelo and others added 2 commits July 30, 2026 11:06
classifyConnectionFailure matches bare words anywhere in a message, and
the unauthorized, forbidden and rate-limited branches of
scanFailureMessage replace the message entirely with fixed advice. A
local failure whose text merely contained one of those words was
therefore reported as a credential problem, and its own text reached
neither stderr nor the JSON error field.

The reported trigger is "permission denied", the standard strerror for
EACCES: a read-only TMPDIR surfaced as "The stored ChatGPT credentials
cannot access the configured model."

Skip classification for failures that cannot originate from the model
transport -- InvalidTargetError, OutputDirectoryError,
ConfigurationError, PluginPythonUnavailableError, and filesystem syscall
errno codes -- so they keep their own message. Network errno codes are
deliberately excluded from that set because they are genuine transport
failures.

Advice still replaces the underlying text for real transport failures.
Upstream authentication and authorization errors can name the
organization or project, and cli-authentication.test.ts pins that they
must not reach stderr.

Fixes #36
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 9794115

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 9794115933

ℹ️ 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: 9794115933

View security finding report

ℹ️ 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.

mldangelo-oai and others added 5 commits July 30, 2026 11:22
Reject non-sticky or untrusted parents for durable auth state, re-check
on every credential-home use path, harden auth.json, and pin identity
for the lock session so shared-volume rename races cannot steal auth.

Co-authored-by: Cursor <cursoragent@cursor.com>
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 89e5321

@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: 89e53213a5

ℹ️ 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/errors.ts Outdated
Comment thread sdk/typescript/src/runtime.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 73f1b51a61

View security finding report

ℹ️ 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.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review 5b6d8ba

@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: 5b6d8ba845

ℹ️ 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/errors.ts Outdated

@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 Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: 5b6d8ba845

View security finding report

ℹ️ 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.

Comment thread sdk/typescript/src/errors.ts Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review a020832

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: a020832eaa

ℹ️ 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 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 Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: a020832eaa

View security finding report

ℹ️ 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.

Comment thread sdk/typescript/src/errors.ts Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review 5537f23

@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: 5537f2357a

ℹ️ 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 thread sdk/typescript/src/runtime.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 5537f2357a

View security finding report

ℹ️ 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.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review ce61cfc

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Unknown error
ℹ️ 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: ce61cfc407

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: ce61cfc407

ℹ️ 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/errors.ts Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review af895a0

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: af895a0116

ℹ️ 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: af895a0116

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.

# Conflicts:
#	sdk/typescript/tests-ts/runtime.test.ts
ianw-oai
ianw-oai previously approved these changes Jul 31, 2026

@ianw-oai ianw-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verified consolidated credential redaction, private credential storage, failed-turn handling, subprocess limits, and compatibility with the merged private-output protections; focused suites and typecheck pass.

@ianw-oai ianw-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Confirmed custom authorization key-value credentials are fully redacted, including persisted multiscan receipts. Focused regression suites: 168 passing; TypeScript and formatting checks pass.

@ianw-oai
ianw-oai merged commit 8f4348e into main Jul 31, 2026
15 checks passed
@ianw-oai
ianw-oai deleted the mdangelo/codex/contributor-runtime-security-hardening branch July 31, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants