openai / openai/codex-action

`output-schema` with `runAsUser` fails to create temporary file

Open
#103 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.2k
Forks
170
PR merge metrics
No merged PRs in 30d

Description

If output-schema input is passed to the action, resolveOutputSchema writes a temporary file.
https://github.com/openai/codex-action/blob/e0fdf01220eb9a88167c4898839d273e3f2609d1/src/runCodexExec.ts#L280-L284

When safety-strategy is unprivileged-user, createTempDir calls sudo -u ${runAsUser} mktemp -d -t ${prefix}.XXXXXX, which by default creates a directory with 0700 permission, only allowing the owner to be accessible.
https://github.com/openai/codex-action/blob/e0fdf01220eb9a88167c4898839d273e3f2609d1/src/runCodexExec.ts#L313-L321

However, as writeFile is performed by the process's user(runner), which even shares group with runAsUser user as per the guide, the write fails as group does not have access to the temp directory:

node:internal/fs/promises:637
  return new FileHandle(await PromisePrototypeThen(
                        ^

Error: EACCES: permission denied, open '/tmp/codex-output-schema-.wzM3U3/schema.json'
    at async open (node:internal/fs/promises:637:25)
    at async writeFile (node:internal/fs/promises:1219:14)
    at async resolveOutputSchema (/opt/actions-runner/_work/_actions/openai/codex-action/v1/dist/main.js:23599:7)
    at async runCodexExec (/opt/actions-runner/_work/_actions/openai/codex-action/v1/dist/main.js:23462:32)
    at async _Command.<anonymous> (/opt/actions-runner/_work/_actions/openai/codex-action/v1/dist/main.js:27802:7) {
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/tmp/codex-output-schema-.wzM3U3/schema.json'
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/runCodexExec.ts at resolveOutputSchema and createTempDir, then compare the behavior with examples/unprivileged-user.yml. Run an unprivileged-user workflow using output-schema and verify that schema.json is created without an EACCES error.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.