Skip to content

Constrain Codex config writes to the managed temp directory - #74915

Merged
pelikhan merged 4 commits into
mainfrom
copilot/security-findings-remediation
Nov 4, 2026
Merged

pelikhan merged 4 commits into
mainfrom
copilot/security-findings-remediation

Conversation

Copilot AI commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Red-team findings flagged a Codex config write whose path could be influenced by engine.env.CODEX_HOME, and a parser test fixture containing runner-specific paths. The admission and Claude matches did not reveal dynamic code execution or obfuscated content.

  • Codex path safety: Accept CODEX_HOME only within /tmp/gh-aw; otherwise use /tmp/gh-aw/mcp-config. Before rewriting, require config.toml to be a regular, non-symlink file under the managed directory.
    /tmp/gh-aw/custom-codex   → accepted
    /tmp/gh-aw/../../etc       → defaults to /tmp/gh-aw/mcp-config
    
  • Fixture hygiene: Replace checkout-specific paths and cache filenames with generic test data while preserving parser coverage.

Copilot AI linked an issue Nov 4, 2026 that may be closed by this pull request
4 tasks
Copilot AI and others added 2 commits November 4, 2026 18:36
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix security findings from red team scan Constrain Codex config writes to the managed temp directory Nov 4, 2026
Copilot AI requested a review from gh-aw-bot November 4, 2026 18:54
@pelikhan
pelikhan marked this pull request as ready for review November 4, 2026 18:55
Copilot AI auto review requested due to automatic review settings November 4, 2026 18:55
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · routed: gpt56 max · ~2 AIC · ⌖ ~1 AIC · ⊞ 6.3K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · routed: gpt56 max · ~4 AIC · ⌖ ~1 AIC · ⊞ 118 · ◷

Generated by Ponytail Reviewer for #74915

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · routed: opus55 medium · ~12 AIC · ⌖ ~2 AIC · ⊞ 7.7K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-04T18:59:46Z
review_event: REQUEST_CHANGES
top_themes:
  - threat-detection CODEX_HOME path incompatibility
  - runtime path-expression escaping
files_reviewed:
  - actions/setup/js/codex_harness.cjs
  - pkg/workflow/codex_config.go
  - pkg/workflow/threat_detection_external.go
comment_count: 2

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The path hardening introduces two correctness/security regressions: it rejects the supported ARC/DinD threat-detection CODEX_HOME, and it accepts expression-bearing paths whose runtime expansion can escape the managed root.

Highlights
  • Align validation with the generated threat-detection path or allow that trusted root.
  • Validate individual CODEX_HOME components and reject workflow expressions/metacharacters before emitting runtime paths.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

Comment thread actions/setup/js/codex_harness.cjs Outdated
const reflectPath = (options && options.reflectPath) || AWF_REFLECT_OUTPUT_PATH;
const provider = normalizeReflectProviderName(options?.provider || process.env.GH_AW_LLM_PROVIDER, "openai");
if (!reflectPath) return { env, configured: false };
if (codexConfigPath && !isSafeCodexConfigPath(codexConfigPath)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This guard rejects the ARC/DinD threat-detection CODEX_HOME, so provider configuration is skipped for those runs and Azure OIDC can fail at the later providerConfig.configured check.

💡 Preserve the supported threat-detection path

threat_detection_external.go emits CODEX_HOME=${RUNNER_TEMP}/gh-aw/threat-detection/codex-home, which is intentionally outside /tmp/gh-aw on normal runners. Either make the Go side emit the same managed root that this check validates, or explicitly validate the threat-detection directory as another trusted root and add a regression test for that generated path.

Comment thread pkg/workflow/codex_config.go Outdated
if home := getEngineEnvOverrides(workflowData)["CODEX_HOME"]; home != "" {
return home
cleanHome := path.Clean(home)
if cleanHome == constants.TmpGhAwDir || strings.HasPrefix(cleanHome, constants.TmpGhAwDir+"/") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This prefix check still accepts expression or shell-metacharacter content beneath /tmp/gh-aw, allowing the validated compile-time path to become an escaping runtime path after Actions expands it.

💡 Validate path components, not only the prefix

For example, /tmp/gh-aw/${{ github.event.issue.title }} passes this check, and an expanded title containing ../../ can redirect the generated CODEX_HOME operations outside the managed directory. Restrict accepted components to a safe allowlist (or reject ${{, $, backticks, quotes, whitespace, and controls) and add a test for a prefixed expression/metacharacter value.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd (triage: bug fix). Requesting changes for one verified correctness bug in the JS guard. The Go-side constraint looks sound.

📋 Key Themes & Highlights

Key Themes

  • Symlink/alias false negative in isSafeCodexConfigPath: the root is realpath'd but the relative path is not, so a config inside an aliased managed root is rejected. I reproduced this with the real function. It fails closed, but it breaks the feature on aliased roots. The suggested fix is in the inline comment.
  • Test coverage gaps: no aliased-root regression test; the parser fixture rewrite drops for ... done loop coverage.
  • Trust boundary: codexHome() correctly rejects traversal, relative paths, and ${{ }} expressions. The JS readers still trust process.env.CODEX_HOME directly.

Positive Highlights

  • ✅ The codexHome() gate is simple and applied at every call site I checked.
  • ✅ The new outside-root and symlink-outside tests exercise the rejection path.
  • ✅ Go tests pass: TestCodexHomeStaysWithinManagedTemporaryDirectory and related codex tests.

Limits

  • Vitest could not run in this environment (no local binary; npm registry TLS failure). The JS test changes are unverified locally. CI should confirm.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again

function isSafeCodexConfigPath(codexConfigPath) {
try {
const root = fs.realpathSync(TMP_GH_AW_PATH);
const resolvedPath = path.resolve(codexConfigPath);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/diagnosing-bugs] relativePath is computed from the unresolved resolvedPath, but the root is resolved with fs.realpathSync. When /tmp/gh-aw is reached through a symlink (for example macOS /tmp → /private/tmp), a config inside the managed directory is treated as outside it. The provider rewrite is then skipped with a misleading warning. I extracted this function and ran it: the path through the alias returns false, and the canonical path returns true.

💡 Suggested fix

Resolve the directory first, then rejoin the basename. The existing lstat check still rejects a symlinked config.toml:

const resolvedDirectory = fs.realpathSync(path.dirname(path.resolve(codexConfigPath)));
const resolvedPath = path.join(resolvedDirectory, path.basename(codexConfigPath));

I tested this variant. The aliased path returns true, and a symlinked config.toml returns false.

@copilot please address this.

}
});

it("does not rewrite a Codex config symlinked outside the managed temporary directory", () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/tdd] No test covers a managed root reached through a symlink, which is how the bug above got through. isSafeCodexConfigPath hardcodes TMP_GH_AW_PATH, so tests cannot point it at a temp root. Let the helper accept an optional root (defaulting to TMP_GH_AW_PATH). That makes an aliased-root case easy to add as a regression test.

@copilot please address this.

printf '%s\n' '---FILES---'
if [ -f "$WORK_DIR/result.json" ]; then cat "$WORK_DIR/result.json"; fi
wc -l file.txt`;
expect(extractCommandNamesFromPipeline(cmd)).toEqual(["set", "mkdir", "git", "sed", "printf", "cat", "wc"]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/tdd] The rewritten fixture removes the for ... done loop, but the test is still named "...with variables and control flow". Loop-body extraction now has no coverage. Keep a generic loop, for example for f in file1.txt file2.txt; do wc -l "$f"; done, so the cleanup keeps the original coverage.

@copilot please address this.

Comment thread pkg/workflow/codex_config.go Outdated
func codexHome(workflowData *WorkflowData) string {
if home := getEngineEnvOverrides(workflowData)["CODEX_HOME"]; home != "" {
return home
cleanHome := path.Clean(home)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/codebase-design] codexHome is the Go-side gate, but convert_gateway_config_codex.cjs (lines 51 and 76) and the harness read path still use process.env.CODEX_HOME with no equivalent check. The guarantee holds only while the compiler always sets CODEX_HOME from codexHome(). I have not confirmed whether engine.env can reach the runtime environment unchanged. Either verify that, or add a JS-side check so the rule lives in one place.

@copilot please address this.

Comment thread actions/setup/js/codex_harness.test.cjs Outdated
const { detectNonRetryableHarnessGuard } = require("./harness_retry_guard.cjs");

const agentTempDir = fs.mkdtempSync(path.join(os.tmpdir(), "codex-harness-tests-"));
fs.mkdirSync("/tmp/gh-aw", { recursive: true });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/tdd] Nit: this runs at module load and creates /tmp/gh-aw on every run of this file, and the path is hardcoded. Prefer the TMP_GH_AW_PATH constant from constants.cjs, and create the directory inside the helper, as makeHarnessTempDir already does.

@copilot please address this.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical path-validation and environment-override flaws allow configuration writes or loads outside /tmp/gh-aw, bypassing managed-directory confinement.

5 open issues
What changed in this PR

This PR adds managed-directory checks to gh-aw’s Codex configuration flow in response to #70966 and removes runner-specific data from a parser fixture.

Changes:

  • Normalize CODEX_HOME overrides and fall back to the managed default for out-of-directory paths.
  • Add containment and regular-file checks before provider-config rewrites, with regression tests.
  • Replace checkout-specific parser fixture data with generic paths and filenames.
File Description
pkg/​workflow/​codex_config.go Filters custom Codex homes against the managed directory.
pkg/​workflow/​codex_config_test.go Tests home filtering and relocates direct-tool fixtures under /tmp/gh-aw.
actions/​setup/​js/​codex_harness.test.cjs Adds outside-path and symlink rejection tests using managed test directories.
actions/​setup/​js/​codex_harness.cjs Checks configuration paths before provider endpoint rewrites.
actions/​setup/​js/​bash_command_parser.test.cjs Replaces runner-specific fixture content with generic test data.

Review effort: Max (auto)

function isSafeCodexConfigPath(codexConfigPath) {
try {
const root = fs.realpathSync(TMP_GH_AW_PATH);
const resolvedPath = path.resolve(codexConfigPath);
}

func codexHome(workflowData *WorkflowData) string {
if home := getEngineEnvOverrides(workflowData)["CODEX_HOME"]; home != "" {
Comment thread pkg/workflow/codex_config.go Outdated
Comment on lines +273 to +274
if cleanHome == constants.TmpGhAwDir || strings.HasPrefix(cleanHome, constants.TmpGhAwDir+"/") {
return cleanHome
Comment thread pkg/workflow/codex_config.go Outdated
return home
cleanHome := path.Clean(home)
if cleanHome == constants.TmpGhAwDir || strings.HasPrefix(cleanHome, constants.TmpGhAwDir+"/") {
return cleanHome
Comment thread actions/setup/js/codex_harness.cjs Outdated
try {
const root = fs.realpathSync(TMP_GH_AW_PATH);
const resolvedPath = path.resolve(codexConfigPath);
const relativePath = path.relative(root, resolvedPath);
@pelikhan

pelikhan commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/codex_harness.cjs:769): This guard rejects the ARC/DinD threat-detection CODEX_HOME, so provider configuration is skipped for those runs and Azure OIDC can fail at the later providerConfig.configured check. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  3. Review (pkg/workflow/codex_config.go:273): This prefix check still accepts expression or shell-metacharacter content beneath /tmp/gh-aw, allowing the validated compile-time path to become an escaping runtime path after Actions expands it. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  4. Review (actions/setup/js/codex_harness.cjs:692): [/diagnosing-bugs] relativePath is computed from the unresolved resolvedPath, but the root is resolved with fs.realpathSync. When /tmp/gh-aw is reached through a symlink (for example macOS /tmp → /private/tmp), a config inside the managed directory is treated as outside it. The provider rewrite is then skipped with a misleading warning. I extracted this function and ran it: the path through the alias returns false, and the canonical path returns true. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  5. Review (actions/setup/js/codex_harness.test.cjs:1198): [/tdd] No test covers a managed root reached through a symlink, which is how the bug above got through. isSafeCodexConfigPath hardcodes TMP_GH_AW_PATH, so tests cannot point it at a temp root. Let the helper accept an optional root (defaulting to TMP_GH_AW_PATH). That makes an aliased-root case easy to add as a regression test. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  6. Review (actions/setup/js/bash_command_parser.test.cjs:386): [/tdd] The rewritten fixture removes the for ... done loop, but the test is still named \"...with variables and control flow\". Loop-body extraction now has no coverage. Keep a generic loop, for example for f in file1.txt file2.txt; do wc -l \"$f\"; done, so the cleanup keeps the original coverage. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  7. Review (pkg/workflow/codex_config.go:272): [/codebase-design] codexHome is the Go-side gate, but convert_gateway_config_codex.cjs (lines 51 and 76) and the harness read path still use process.env.CODEX_HOME with no equivalent check. The guarantee holds only while the compiler always sets CODEX_HOME from codexHome(). I have not confirmed whether engine.env can reach the runtime environment unchanged. Either verify that, or add a JS-side check so the rule lives in one place. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  8. Review (actions/setup/js/codex_harness.test.cjs:61): [/tdd] Nit: this runs at module load and creates /tmp/gh-aw on every run of this file, and the path is hardcoded. Prefer the TMP_GH_AW_PATH constant from constants.cjs, and create the directory inside the helper, as makeHarnessTempDir already does. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  9. Review (actions/setup/js/codex_harness.cjs:692): This guard validates path.resolve(codexConfigPath), but the rewrite still opens the original path. If /tmp/gh-aw/link points to /tmp/outside/child, /tmp/gh-aw/link/../config.toml passes against an existing managed config while the rewrite modifies /tmp/outside/config.toml. Reject noncanonical paths before checking them, or use the same validated path for all file operations. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  10. Review (pkg/workflow/codex_config.go:271): An expression following the managed prefix still passes this check: /tmp/gh-aw/${{ inputs.codex_dir }} is accepted before Actions expands it. If the input is ../../somewhere, the resulting path escapes the managed directory, and the configuration-copy step writes there before the harness guard runs. Reject Actions expressions anywhere in CODEX_HOME, not only expressions that fail the literal prefix check. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  11. Review (pkg/workflow/codex_config.go:274): A permitted home such as /tmp/gh-aw/repo-memory/state/codex can be a symlink from a restored memory checkout. The converter's writeSecureOutput and the MCP config copy follow that link before the harness guard runs, so configuration can still overwrite files outside /tmp/gh-aw. Validate the real parent and reject symlink destinations at these setup write sites, not just during the later rewrite. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  12. Review (pkg/workflow/codex_config.go:274): buildCodexExecutionEnv initializes this validated home, but applyEngineAndAgentEnv then restores the raw engine/agent override. With /tmp/outside-codex, setup writes to /tmp/gh-aw/mcp-config while execution still uses the rejected home, bypassing confinement and potentially loading an existing unmanaged config.toml. Reapply the validated home after merging overrides and add an assertion for the final execution environment. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  13. Review (actions/setup/js/codex_harness.cjs:693): When /tmp or /tmp/gh-aw is a symlink, such as /tmp -> /private/tmp on macOS, root is canonical but resolvedPath still uses the lexical prefix. A valid managed config is therefore rejected, preventing provider repair and causing Azure OIDC preflight to fail. Compute relativePath from path.resolve(TMP_GH_AW_PATH) and retain the separate real-directory containment check. - Constrain Codex config writes to the managed temp directory #74915 (comment)

Once you start work, post this work summary as a PR comment, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI.

Sous-chef requested-head: 1cb2405
Sous-chef requested-work: 11b39e48156cbb98b28f2b69db79755887f2fb5f484eb7772a6f899e71d399d1 2aa7d1a0206e99aaf4b33926fa92231fe9d7d5a6b1789d5c5e27d2881b04fa9f 2ac6e1766746f57a13b60aff3377449909118922d1ff0452a1361ab6e7ecb2e8 3d782e8aa6a66ef4f01dc50737586600d3414f5af67bfd6365d816668a98c64a 7c41821d4a5a447cf6049afcf33f70365b42fe0506bb222afcd04ea3718d8133 7d5de409fb69f8b7054b171b3154d8caf195f1d9968a7a27a332effb62371e2a 962249ee8919ab437429ae1e2e996795ef0dc6084b6bfa7bfcdc002ecc229a9d 9927ff20907532be99b71fc1324bd6c89cba94f5c7b81a3d67e0ecc69b185229 aca3a2857a0bf28f77d8f684af3f45414b357761438c7ad9576070ad82a44008 b29bc56b2a1167dd355f80def4543d16d8121d7465f61543a8c3e68b49035d52 b4bd81584dd8e6d05411e04212a1107c144a5885e2164b2c79c9f9ee08f4c551 ecb12ad16d15ca905961bb337ddb207e6ab1ddfca1d6bfa76a5c177fd06b073d
Sous-chef requested-state: d1b89e704b89582d8cd5c9edca28a602fb4b1368cadf4fd25d1a2ca2c6cea9ea

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~11 AIC · ⌖ ~11 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/codex_harness.cjs:769): This guard rejects the ARC/DinD threat-detection CODEX_HOME, so provider configuration is skipped for those runs and Azure OIDC can fail at the later providerConfig.configured check. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  3. Review (pkg/workflow/codex_config.go:273): This prefix check still accepts expression or shell-metacharacter content beneath /tmp/gh-aw, allowing the validated compile-time path to become an escaping runtime path after Actions expands it. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  4. Review (actions/setup/js/codex_harness.cjs:692): [/diagnosing-bugs] relativePath is computed from the unresolved resolvedPath, but the root is resolved with fs.realpathSync. When /tmp/gh-aw is reached through a symlink (for example macOS /tmp → /private/tmp), a config inside the managed directory is treated as outside it. The provider rewrite is then skipped with a misleading warning. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  5. Review (actions/setup/js/codex_harness.test.cjs:1198): [/tdd] No test covers a managed root reached through a symlink, which is how the bug above got through. Let the helper accept an optional root (defaulting to TMP_GH_AW_PATH). That makes an aliased-root case easy to add as a regression test. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  6. Review (actions/setup/js/bash_command_parser.test.cjs:386): [/tdd] The rewritten fixture removes the for ... done loop, but the test is still named "...with variables and control flow". Keep a generic loop so the cleanup keeps the original coverage. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  7. Review (pkg/workflow/codex_config.go:272): [/codebase-design] codexHome is the Go-side gate, but JS-side usage has no equivalent check. Either verify the guarantee, or add a JS-side check so the rule lives in one place. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  8. Review (actions/setup/js/codex_harness.test.cjs:61): [/tdd] Prefer the TMP_GH_AW_PATH constant from constants.cjs, and create the directory inside the helper. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  9. Review (actions/setup/js/codex_harness.cjs:692): This guard validates one path, but the rewrite still opens the original path. Reject noncanonical paths before checking them, or use the same validated path for all file operations. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  10. Review (pkg/workflow/codex_config.go:271): An expression following the managed prefix still passes this check. Reject Actions expressions anywhere in CODEX_HOME. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  11. Review (pkg/workflow/codex_config.go:274): Validate the real parent and reject symlink destinations at setup write sites. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  12. Review (pkg/workflow/codex_config.go:274): Reapply the validated home after merging overrides and add an assertion for the final execution environment. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  13. Review (actions/setup/js/codex_harness.cjs:693): Compute relativePath from path.resolve(TMP_GH_AW_PATH) and retain the separate real-directory containment check. - Constrain Codex config writes to the managed temp directory #74915 (comment)

Once you start work, post this work summary as a PR comment, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI.

Sous-chef requested-head: 1cb2405
Sous-chef requested-work: 11b39e48156cbb98b28f2b69db79755887f2fb5f484eb7772a6f899e71d399d1 2aa7d1a0206e99aaf4b33926fa92231fe9d7d5a6b1789d5c5e27d2881b04fa9f 2ac6e1766746f57a13b60aff3377449909118922d1ff0452a1361ab6e7ecb2e8 3d782e8aa6a66ef4f01dc50737586600d3414f5af67bfd6365d816668a98c64a 7c41821d4a5a447cf6049afcf33f70365b42fe0506bb222afcd04ea3718d8133 7d5de409fb69f8b7054b171b3154d8caf195f1d9968a7a27a332effb62371e2a 962249ee8919ab437429ae1e2e996795ef0dc6084b6bfa7bfcdc002ecc229a9d 9927ff20907532be99b71fc1324bd6c89cba94f5c7b81a3d67e0ecc69b185229 aca3a2857a0bf28f77d8f684af3f45414b357761438c7ad9576070ad82a44008 b29bc56b2a1167dd355f80def4543d16d8121d7465f61543a8c3e68b49035d52 b4bd81584dd8e6d05411e04212a1107c144a5885e2164b2c79c9f9ee08f4c551 ecb12ad16d15ca905961bb337ddb207e6ab1ddfca1d6bfa76a5c177fd06b073d
Sous-chef requested-state: d1b89e704b89582d8cd5c9edca28a602fb4b1368cadf4fd25d1a2ca2c6cea9ea

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~13 AIC · ⌖ ~21 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan November 4, 2026 20:57
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/codex_harness.cjs:769): This guard rejects the ARC/DinD threat-detection CODEX_HOME, so provider configuration is skipped for those runs and Azure OIDC can fail at the later providerConfig.configured check. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  3. Review (pkg/workflow/codex_config.go:273): This prefix check still accepts expression or shell-metacharacter content beneath /tmp/gh-aw, allowing the validated compile-time path to become an escaping runtime path after Actions expands it. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  4. Review (actions/setup/js/codex_harness.cjs:700): [/diagnosing-bugs] relativePath is computed from the unresolved resolvedPath, but the root is resolved with fs.realpathSync. When /tmp/gh-aw is reached through a symlink (for example macOS /tmp → /private/tmp), a config inside the managed directory is treated as outside it. The provider rewrite is then skipped with a misleading warning. I extracted this function and ran it: the path through the alias returns false, and the canonical path returns true. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  5. Review (actions/setup/js/codex_harness.test.cjs:1201): [/tdd] No test covers a managed root reached through a symlink, which is how the bug above got through. isSafeCodexConfigPath hardcodes TMP_GH_AW_PATH, so tests cannot point it at a temp root. Let the helper accept an optional root (defaulting to TMP_GH_AW_PATH). That makes an aliased-root case easy to add as a regression test. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  6. Review (actions/setup/js/bash_command_parser.test.cjs:387): [/tdd] The rewritten fixture removes the for ... done loop, but the test is still named \"...with variables and control flow\". Loop-body extraction now has no coverage. Keep a generic loop, for example for f in file1.txt file2.txt; do wc -l \"$f\"; done, so the cleanup keeps the original coverage. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  7. Review (pkg/workflow/codex_config.go:272): [/codebase-design] codexHome is the Go-side gate, but convert_gateway_config_codex.cjs (lines 51 and 76) and the harness read path still use process.env.CODEX_HOME with no equivalent check. The guarantee holds only while the compiler always sets CODEX_HOME from codexHome(). I have not confirmed whether engine.env can reach the runtime environment unchanged. Either verify that, or add a JS-side check so the rule lives in one place. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  8. Review (actions/setup/js/codex_harness.test.cjs:61): [/tdd] Nit: this runs at module load and creates /tmp/gh-aw on every run of this file, and the path is hardcoded. Prefer the TMP_GH_AW_PATH constant from constants.cjs, and create the directory inside the helper, as makeHarnessTempDir already does. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  9. Review (actions/setup/js/codex_harness.cjs:700): This guard validates path.resolve(codexConfigPath), but the rewrite still opens the original path. If /tmp/gh-aw/link points to /tmp/outside/child, /tmp/gh-aw/link/../config.toml passes against an existing managed config while the rewrite modifies /tmp/outside/config.toml. Reject noncanonical paths before checking them, or use the same validated path for all file operations. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  10. Review (pkg/workflow/codex_config.go:271): An expression following the managed prefix still passes this check: /tmp/gh-aw/${{ inputs.codex_dir }} is accepted before Actions expands it. If the input is ../../somewhere, the resulting path escapes the managed directory, and the configuration-copy step writes there before the harness guard runs. Reject Actions expressions anywhere in CODEX_HOME, not only expressions that fail the literal prefix check. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  11. Review (pkg/workflow/codex_config.go:274): A permitted home such as /tmp/gh-aw/repo-memory/state/codex can be a symlink from a restored memory checkout. The converter's writeSecureOutput and the MCP config copy follow that link before the harness guard runs, so configuration can still overwrite files outside /tmp/gh-aw. Validate the real parent and reject symlink destinations at these setup write sites, not just during the later rewrite. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  12. Review (pkg/workflow/codex_config.go:274): buildCodexExecutionEnv initializes this validated home, but applyEngineAndAgentEnv then restores the raw engine/agent override. With /tmp/outside-codex, setup writes to /tmp/gh-aw/mcp-config while execution still uses the rejected home, bypassing confinement and potentially loading an existing unmanaged config.toml. Reapply the validated home after merging overrides and add an assertion for the final execution environment. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  13. Review (actions/setup/js/codex_harness.cjs:693): When /tmp or /tmp/gh-aw is a symlink, such as /tmp -> /private/tmp on macOS, root is canonical but resolvedPath still uses the lexical prefix. A valid managed config is therefore rejected, preventing provider repair and causing Azure OIDC preflight to fail. Compute relativePath from path.resolve(TMP_GH_AW_PATH) and retain the separate real-directory containment check. - Constrain Codex config writes to the managed temp directory #74915 (comment)

Once you start work, post this work summary as a PR comment, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI.

Sous-chef requested-head: d065814
Sous-chef requested-work: 11b39e48156cbb98b28f2b69db79755887f2fb5f484eb7772a6f899e71d399d1 2aa7d1a0206e99aaf4b33926fa92231fe9d7d5a6b1789d5c5e27d2881b04fa9f 2ac6e1766746f57a13b60aff3377449909118922d1ff0452a1361ab6e7ecb2e8 3d782e8aa6a66ef4f01dc50737586600d3414f5af67bfd6365d816668a98c64a 7c41821d4a5a447cf6049afcf33f70365b42fe0506bb222afcd04ea3718d8133 7d5de409fb69f8b7054b171b3154d8caf195f1d9968a7a27a332effb62371e2a 962249ee8919ab437429ae1e2e996795ef0dc6084b6bfa7bfcdc002ecc229a9d 9927ff20907532be99b71fc1324bd6c89cba94f5c7b81a3d67e0ecc69b185229 aca3a2857a0bf28f77d8f684af3f45414b357761438c7ad9576070ad82a44008 b29bc56b2a1167dd355f80def4543d16d8121d7465f61543a8c3e68b49035d52 b4bd81584dd8e6d05411e04212a1107c144a5885e2164b2c79c9f9ee08f4c551 ecb12ad16d15ca905961bb337ddb207e6ab1ddfca1d6bfa76a5c177fd06b073d
Sous-chef requested-state: 1dc89dc9b23aa28c7ea78f425a36957ddc95e283c424fc255d2b49926c676125

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~23 AIC · ⌖ ~16 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/codex_harness.cjs:769): This guard rejects the ARC/DinD threat-detection CODEX_HOME, so provider configuration is skipped for those runs and Azure OIDC can fail at the later providerConfig.configured check. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  3. Review (pkg/workflow/codex_config.go:273): This prefix check still accepts expression or shell-metacharacter content beneath /tmp/gh-aw, allowing the validated compile-time path to become an escaping runtime path after Actions expands it. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  4. Review (actions/setup/js/codex_harness.cjs:700): [/diagnosing-bugs] relativePath is computed from the unresolved resolvedPath, but the root is resolved with fs.realpathSync. When /tmp/gh-aw is reached through a symlink (for example macOS /tmp → /private/tmp), a config inside the managed directory is treated as outside it. The provider rewrite is then skipped with a misleading warning. I extracted this function and ran it: the path through the alias returns false, and the canonical path returns true. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  5. Review (actions/setup/js/codex_harness.test.cjs:1201): [/tdd] No test covers a managed root reached through a symlink, which is how the bug above got through. isSafeCodexConfigPath hardcodes TMP_GH_AW_PATH, so tests cannot point it at a temp root. Let the helper accept an optional root (defaulting to TMP_GH_AW_PATH). That makes an aliased-root case easy to add as a regression test. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  6. Review (actions/setup/js/bash_command_parser.test.cjs:387): [/tdd] The rewritten fixture removes the for ... done loop, but the test is still named "...with variables and control flow". Loop-body extraction now has no coverage. Keep a generic loop, for example for f in file1.txt file2.txt; do wc -l "$f"; done, so the cleanup keeps the original coverage. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  7. Review (pkg/workflow/codex_config.go:272): [/codebase-design] codexHome is the Go-side gate, but convert_gateway_config_codex.cjs (lines 51 and 76) and the harness read path still use process.env.CODEX_HOME with no equivalent check. The guarantee holds only while the compiler always sets CODEX_HOME from codexHome(). I have not confirmed whether engine.env can reach the runtime environment unchanged. Either verify that, or add a JS-side check so the rule lives in one place. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  8. Review (actions/setup/js/codex_harness.test.cjs:61): [/tdd] Nit: this runs at module load and creates /tmp/gh-aw on every run of this file, and the path is hardcoded. Prefer the TMP_GH_AW_PATH constant from constants.cjs, and create the directory inside the helper, as makeHarnessTempDir already does. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  9. Review (actions/setup/js/codex_harness.cjs:700): This guard validates path.resolve(codexConfigPath), but the rewrite still opens the original path. If /tmp/gh-aw/link points to /tmp/outside/child, /tmp/gh-aw/link/../config.toml passes against an existing managed config while the rewrite modifies /tmp/outside/config.toml. Reject noncanonical paths before checking them, or use the same validated path for all file operations. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  10. Review (pkg/workflow/codex_config.go:271): An expression following the managed prefix still passes this check: /tmp/gh-aw/${{ inputs.codex_dir }} is accepted before Actions expands it. If the input is ../../somewhere, the resulting path escapes the managed directory, and the configuration-copy step writes there before the harness guard runs. Reject Actions expressions anywhere in CODEX_HOME, not only expressions that fail the literal prefix check. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  11. Review (pkg/workflow/codex_config.go:274): A permitted home such as /tmp/gh-aw/repo-memory/state/codex can be a symlink from a restored memory checkout. The converter's writeSecureOutput and the MCP config copy follow that link before the harness guard runs, so configuration can still overwrite files outside /tmp/gh-aw. Validate the real parent and reject symlink destinations at these setup write sites, not just during the later rewrite. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  12. Review (pkg/workflow/codex_config.go:274): buildCodexExecutionEnv initializes this validated home, but applyEngineAndAgentEnv then restores the raw engine/agent override. With /tmp/outside-codex, setup writes to /tmp/gh-aw/mcp-config while execution still uses the rejected home, bypassing confinement and potentially loading an existing unmanaged config.toml. Reapply the validated home after merging overrides and add an assertion for the final execution environment. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  13. Review (actions/setup/js/codex_harness.cjs:693): When /tmp or /tmp/gh-aw is a symlink, such as /tmp -> /private/tmp on macOS, root is canonical but resolvedPath still uses the lexical prefix. A valid managed config is therefore rejected, preventing provider repair and causing Azure OIDC preflight to fail. Compute relativePath from path.resolve(TMP_GH_AW_PATH) and retain the separate real-directory containment check. - Constrain Codex config writes to the managed temp directory #74915 (comment)

Once you start work, post this work summary as a PR comment, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI.

Sous-chef requested-head: d065814
Sous-chef requested-work: 11b39e48156cbb98b28f2b69db79755887f2fb5f484eb7772a6f899e71d399d1 2aa7d1a0206e99aaf4b33926fa92231fe9d7d5a6b1789d5c5e27d2881b04fa9f 2ac6e1766746f57a13b60aff3377449909118922d1ff0452a1361ab6e7ecb2e8 3d782e8aa6a66ef4f01dc50737586600d3414f5af67bfd6365d816668a98c64a 7c41821d4a5a447cf6049afcf33f70365b42fe0506bb222afcd04ea3718d8133 7d5de409fb69f8b7054b171b3154d8caf195f1d9968a7a27a332effb62371e2a 962249ee8919ab437429ae1e2e996795ef0dc6084b6bfa7bfcdc002ecc229a9d 9927ff20907532be99b71fc1324bd6c89cba94f5c7b81a3d67e0ecc69b185229 aca3a2857a0bf28f77d8f684af3f45414b357761438c7ad9576070ad82a44008 b29bc56b2a1167dd355f80def4543d16d8121d7465f61543a8c3e68b49035d52 b4bd81584dd8e6d05411e04212a1107c144a5885e2164b2c79c9f9ee08f4c551 ecb12ad16d15ca905961bb337ddb207e6ab1ddfca1d6bfa76a5c177fd06b073d
Sous-chef requested-state: 1dc89dc9b23aa28c7ea78f425a36957ddc95e283c424fc255d2b49926c676125

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~25 AIC · ⌖ ~18 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/codex_harness.cjs:769): This guard rejects the ARC/DinD threat-detection CODEX_HOME, so provider configuration is skipped for those runs and Azure OIDC can fail at the later providerConfig.configured check. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  3. Review (pkg/workflow/codex_config.go:273): This prefix check still accepts expression or shell-metacharacter content beneath /tmp/gh-aw, allowing the validated compile-time path to become an escaping runtime path after Actions expands it. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  4. Review (actions/setup/js/codex_harness.cjs:700): [/diagnosing-bugs] relativePath is computed from the unresolved resolvedPath, but the root is resolved with fs.realpathSync. When /tmp/gh-aw is reached through a symlink (for example macOS /tmp → /private/tmp), a config inside the managed directory is treated as outside it. The provider rewrite is then skipped with a misleading warning. I extracted this function and ran it: the path through the alias returns false, and the canonical path returns true. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  5. Review (actions/setup/js/codex_harness.test.cjs:1201): [/tdd] No test covers a managed root reached through a symlink, which is how the bug above got through. isSafeCodexConfigPath hardcodes TMP_GH_AW_PATH, so tests cannot point it at a temp root. Let the helper accept an optional root (defaulting to TMP_GH_AW_PATH). That makes an aliased-root case easy to add as a regression test. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  6. Review (actions/setup/js/bash_command_parser.test.cjs:387): [/tdd] The rewritten fixture removes the for ... done loop, but the test is still named "...with variables and control flow". Loop-body extraction now has no coverage. Keep a generic loop, for example for f in file1.txt file2.txt; do wc -l "$f"; done, so the cleanup keeps the original coverage. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  7. Review (pkg/workflow/codex_config.go:272): [/codebase-design] codexHome is the Go-side gate, but convert_gateway_config_codex.cjs (lines 51 and 76) and the harness read path still use process.env.CODEX_HOME with no equivalent check. The guarantee holds only while the compiler always sets CODEX_HOME from codexHome(). I have not confirmed whether engine.env can reach the runtime environment unchanged. Either verify that, or add a JS-side check so the rule lives in one place. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  8. Review (actions/setup/js/codex_harness.test.cjs:61): [/tdd] Nit: this runs at module load and creates /tmp/gh-aw on every run of this file, and the path is hardcoded. Prefer the TMP_GH_AW_PATH constant from constants.cjs, and create the directory inside the helper, as makeHarnessTempDir already does. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  9. Review (actions/setup/js/codex_harness.cjs:700): This guard validates path.resolve(codexConfigPath), but the rewrite still opens the original path. If /tmp/gh-aw/link points to /tmp/outside/child, /tmp/gh-aw/link/../config.toml passes against an existing managed config while the rewrite modifies /tmp/outside/config.toml. Reject noncanonical paths before checking them, or use the same validated path for all file operations. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  10. Review (pkg/workflow/codex_config.go:271): An expression following the managed prefix still passes this check: /tmp/gh-aw/${{ inputs.codex_dir }} is accepted before Actions expands it. If the input is ../../somewhere, the resulting path escapes the managed directory, and the configuration-copy step writes there before the harness guard runs. Reject Actions expressions anywhere in CODEX_HOME, not only expressions that fail the literal prefix check. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  11. Review (pkg/workflow/codex_config.go:274): A permitted home such as /tmp/gh-aw/repo-memory/state/codex can be a symlink from a restored memory checkout. The converter's writeSecureOutput and the MCP config copy follow that link before the harness guard runs, so configuration can still overwrite files outside /tmp/gh-aw. Validate the real parent and reject symlink destinations at these setup write sites, not just during the later rewrite. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  12. Review (pkg/workflow/codex_config.go:274): buildCodexExecutionEnv initializes this validated home, but applyEngineAndAgentEnv then restores the raw engine/agent override. With /tmp/outside-codex, setup writes to /tmp/gh-aw/mcp-config while execution still uses the rejected home, bypassing confinement and potentially loading an existing unmanaged config.toml. Reapply the validated home after merging overrides and add an assertion for the final execution environment. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  13. Review (actions/setup/js/codex_harness.cjs:693): When /tmp or /tmp/gh-aw is a symlink, such as /tmp -> /private/tmp on macOS, root is canonical but resolvedPath still uses the lexical prefix. A valid managed config is therefore rejected, preventing provider repair and causing Azure OIDC preflight to fail. Compute relativePath from path.resolve(TMP_GH_AW_PATH) and retain the separate real-directory containment check. - Constrain Codex config writes to the managed temp directory #74915 (comment)

Once you start work, post this work summary as a PR comment, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI.

Sous-chef requested-head: d065814
Sous-chef requested-work: 11b39e48156cbb98b28f2b69db79755887f2fb5f484eb7772a6f899e71d399d1 2aa7d1a0206e99aaf4b33926fa92231fe9d7d5a6b1789d5c5e27d2881b04fa9f 2ac6e1766746f57a13b60aff3377449909118922d1ff0452a1361ab6e7ecb2e8 3d782e8aa6a66ef4f01dc50737586600d3414f5af67bfd6365d816668a98c64a 7c41821d4a5a447cf6049afcf33f70365b42fe0506bb222afcd04ea3718d8133 7d5de409fb69f8b7054b171b3154d8caf195f1d9968a7a27a332effb62371e2a 962249ee8919ab437429ae1e2e996795ef0dc6084b6bfa7bfcdc002ecc229a9d 9927ff20907532be99b71fc1324bd6c89cba94f5c7b81a3d67e0ecc69b185229 aca3a2857a0bf28f77d8f684af3f45414b357761438c7ad9576070ad82a44008 b29bc56b2a1167dd355f80def4543d16d8121d7465f61543a8c3e68b49035d52 b4bd81584dd8e6d05411e04212a1107c144a5885e2164b2c79c9f9ee08f4c551 ecb12ad16d15ca905961bb337ddb207e6ab1ddfca1d6bfa76a5c177fd06b073d
Sous-chef requested-state: 1dc89dc9b23aa28c7ea78f425a36957ddc95e283c424fc255d2b49926c676125

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~12 AIC · ⌖ ~24 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

@pelikhan
pelikhan merged commit 18928ba into main Nov 4, 2026
52 checks passed
@pelikhan
pelikhan deleted the copilot/security-findings-remediation branch November 4, 2026 22:32
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/codex_harness.cjs:769): This guard rejects the ARC/DinD threat-detection CODEX_HOME, so provider configuration is skipped for those runs and Azure OIDC can fail at the later providerConfig.configured check. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  3. Review (pkg/workflow/codex_config.go:273): This prefix check still accepts expression or shell-metacharacter content beneath /tmp/gh-aw, allowing the validated compile-time path to become an escaping runtime path after Actions expands it. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  4. Review (actions/setup/js/codex_harness.cjs:700): [/diagnosing-bugs] relativePath is computed from the unresolved resolvedPath, but the root is resolved with fs.realpathSync. When /tmp/gh-aw is reached through a symlink (for example macOS /tmp → /private/tmp), a config inside the managed directory is treated as outside it. The provider rewrite is then skipped with a misleading warning. I extracted this function and ran it: the path through the alias returns false, and the canonical path returns true. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  5. Review (actions/setup/js/codex_harness.test.cjs:1201): [/tdd] No test covers a managed root reached through a symlink, which is how the bug above got through. isSafeCodexConfigPath hardcodes TMP_GH_AW_PATH, so tests cannot point it at a temp root. Let the helper accept an optional root (defaulting to TMP_GH_AW_PATH). That makes an aliased-root case easy to add as a regression test. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  6. Review (actions/setup/js/bash_command_parser.test.cjs:387): [/tdd] The rewritten fixture removes the for ... done loop, but the test is still named \"...with variables and control flow\". Loop-body extraction now has no coverage. Keep a generic loop, for example for f in file1.txt file2.txt; do wc -l \"$f\"; done, so the cleanup keeps the original coverage. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  7. Review (pkg/workflow/codex_config.go:272): [/codebase-design] codexHome is the Go-side gate, but convert_gateway_config_codex.cjs (lines 51 and 76) and the harness read path still use process.env.CODEX_HOME with no equivalent check. The guarantee holds only while the compiler always sets CODEX_HOME from codexHome(). I have not confirmed whether engine.env can reach the runtime environment unchanged. Either verify that, or add a JS-side check so the rule lives in one place. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  8. Review (actions/setup/js/codex_harness.test.cjs:61): [/tdd] Nit: this runs at module load and creates /tmp/gh-aw on every run of this file, and the path is hardcoded. Prefer the TMP_GH_AW_PATH constant from constants.cjs, and create the directory inside the helper, as makeHarnessTempDir already does. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  9. Review (actions/setup/js/codex_harness.cjs:700): This guard validates path.resolve(codexConfigPath), but the rewrite still opens the original path. If /tmp/gh-aw/link points to /tmp/outside/child, /tmp/gh-aw/link/../config.toml passes against an existing managed config while the rewrite modifies /tmp/outside/config.toml. Reject noncanonical paths before checking them, or use the same validated path for all file operations. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  10. Review (pkg/workflow/codex_config.go:271): An expression following the managed prefix still passes this check: /tmp/gh-aw/${{ inputs.codex_dir }} is accepted before Actions expands it. If the input is ../../somewhere, the resulting path escapes the managed directory, and the configuration-copy step writes there before the harness guard runs. Reject Actions expressions anywhere in CODEX_HOME, not only expressions that fail the literal prefix check. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  11. Review (pkg/workflow/codex_config.go:274): A permitted home such as /tmp/gh-aw/repo-memory/state/codex can be a symlink from a restored memory checkout. The converter's writeSecureOutput and the MCP config copy follow that link before the harness guard runs, so configuration can still overwrite files outside /tmp/gh-aw. Validate the real parent and reject symlink destinations at these setup write sites, not just during the later rewrite. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  12. Review (pkg/workflow/codex_config.go:274): buildCodexExecutionEnv initializes this validated home, but applyEngineAndAgentEnv then restores the raw engine/agent override. With /tmp/outside-codex, setup writes to /tmp/gh-aw/mcp-config while execution still uses the rejected home, bypassing confinement and potentially loading an existing unmanaged config.toml. Reapply the validated home after merging overrides and add an assertion for the final execution environment. - Constrain Codex config writes to the managed temp directory #74915 (comment)
  13. Review (actions/setup/js/codex_harness.cjs:693): When /tmp or /tmp/gh-aw is a symlink, such as /tmp -> /private/tmp on macOS, root is canonical but resolvedPath still uses the lexical prefix. A valid managed config is therefore rejected, preventing provider repair and causing Azure OIDC preflight to fail. Compute relativePath from path.resolve(TMP_GH_AW_PATH) and retain the separate real-directory containment check. - Constrain Codex config writes to the managed temp directory #74915 (comment)

Once you start work, post this work summary as a PR comment, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI.

Sous-chef requested-head: d065814
Sous-chef requested-work: 11b39e48156cbb98b28f2b69db79755887f2fb5f484eb7772a6f899e71d399d1 2aa7d1a0206e99aaf4b33926fa92231fe9d7d5a6b1789d5c5e27d2881b04fa9f 2ac6e1766746f57a13b60aff3377449909118922d1ff0452a1361ab6e7ecb2e8 3d782e8aa6a66ef4f01dc50737586600d3414f5af67bfd6365d816668a98c64a 7c41821d4a5a447cf6049afcf33f70365b42fe0506bb222afcd04ea3718d8133 7d5de409fb69f8b7054b171b3154d8caf195f1d9968a7a27a332effb62371e2a 962249ee8919ab437429ae1e2e996795ef0dc6084b6bfa7bfcdc002ecc229a9d 9927ff20907532be99b71fc1324bd6c89cba94f5c7b81a3d67e0ecc69b185229 aca3a2857a0bf28f77d8f684af3f45414b357761438c7ad9576070ad82a44008 b29bc56b2a1167dd355f80def4543d16d8121d7465f61543a8c3e68b49035d52 b4bd81584dd8e6d05411e04212a1107c144a5885e2164b2c79c9f9ee08f4c551 ecb12ad16d15ca905961bb337ddb207e6ab1ddfca1d6bfa76a5c177fd06b073d
Sous-chef requested-state: 1dc89dc9b23aa28c7ea78f425a36957ddc95e283c424fc255d2b49926c676125

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~21 AIC · ⌖ ~16 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.0

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.

🚨 [SECURITY] Security Red Team Findings - 2026-10-21

4 participants