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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,10 @@ runs:
FORCE_COLOR: 1
shell: bash
run: |
exec env -u NODE_OPTIONS NODE_OPTIONS=--disable-sigusr1 node --disable-sigusr1 "$ACTION_PATH/dist/main.js" run-codex-exec \
workflow_command_token="codex-action-$(uuidgen)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid requiring uuidgen on every runner

On self-hosted or minimal runners where uuidgen is not installed, this substitution returns 127 and the GitHub bash shell exits before Codex is launched because it runs scripts with -e (documented shell command). The repository neither installs nor checks for uuidgen; for example, a minimal Ubuntu 24.04 environment needs the separate uuid-runtime package. Generate the token using an already guaranteed runtime such as Node, or provide a dependency-free fallback.

Useful? React with 👍 / 👎.

echo "::stop-commands::$workflow_command_token"
set +e
env -u NODE_OPTIONS NODE_OPTIONS=--disable-sigusr1 node --disable-sigusr1 "$ACTION_PATH/dist/main.js" run-codex-exec \
--prompt "${CODEX_PROMPT}" \
--prompt-file "${CODEX_PROMPT_FILE}" \
--output-file "$CODEX_OUTPUT_FILE" \
Expand All @@ -380,3 +383,6 @@ runs:
--effort "$CODEX_EFFORT" \
--safety-strategy "$CODEX_SAFETY_STRATEGY" \
--codex-user "$CODEX_USER"
run_codex_exit=$?
echo "::$workflow_command_token::"
exit "$run_codex_exit"
12 changes: 10 additions & 2 deletions test/actionHardening.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,21 @@ setInterval(() => {}, 1000);
}
);

test("Codex action and its descendants replace inherited Node options", () => {
test("Codex output cannot be interpreted as GitHub workflow commands", () => {
const step = actionStep("Run codex exec");

assert.match(
step,
/exec env -u NODE_OPTIONS NODE_OPTIONS=--disable-sigusr1 node --disable-sigusr1 "\$ACTION_PATH\/dist\/main\.js" run-codex-exec/
/workflow_command_token="codex-action-\$\(uuidgen\)"/
);
assert.match(step, /echo "::stop-commands::\$workflow_command_token"/);
assert.match(step, /echo "::\$workflow_command_token::"/);
assert.match(
step,
/env -u NODE_OPTIONS NODE_OPTIONS=--disable-sigusr1 node --disable-sigusr1 "\$ACTION_PATH\/dist\/main\.js" run-codex-exec/
);
assert.match(step, /run_codex_exit=\$\?/);
assert.match(step, /exit "\$run_codex_exit"/);
});

test(
Expand Down
Loading