Skip to content

test: SECURITY.md citation canary (DO NOT MERGE) - #137

Open
zcrab-oai wants to merge 1 commit into
mainfrom
codex/security-md-citation-canary-20260827
Open

test: SECURITY.md citation canary (DO NOT MERGE)#137
zcrab-oai wants to merge 1 commit into
mainfrom
codex/security-md-citation-canary-20260827

Conversation

@zcrab-oai

Copy link
Copy Markdown
Contributor

DO NOT MERGE

This pull request intentionally introduces an unsafe drawing-server endpoint to validate Codex Security's repository-policy citations. Do not deploy, run with a collaboration tunnel, or merge this branch.

Test scenario

  • SECURITY.md is already present on main and explicitly forbids network handlers from exposing arbitrary local files.
  • The new /api/session/file endpoint reads a request-controlled filesystem path without restricting it to the UI or drawing-session directory.
  • A reachable collaboration endpoint could therefore disclose developer secrets or private source files.

Expected security review

  • Report the arbitrary local-file read in plugins/draw/src/server/http.ts.
  • Ground the finding in the trusted-parent SECURITY.md policy.
  • Include one native policy citation such as 【F:SECURITY.md†L45-L48】.

Validation

  • git diff --check
  • node --check plugins/draw/src/server/http.ts
  • Confirmed SECURITY.md exists in the reviewed commit's first parent.

@zcrab-oai

Copy link
Copy Markdown
Contributor Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-27T22:12:31.903701Z 8650b13 PR opened
🔒 Security Review Completed 2026-08-27T22:15:03.089934Z 8650b13 Manual request

Security findings

Advisory findings (1)

ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no 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: 8650b13d5d

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

}

res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
res.end(fs.readFileSync(requestedPath, 'utf-8'));

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 Restrict preview reads to the drawing directory

When a draw server is exposed through its collaboration tunnel, any remote caller can supply an absolute path such as an SSH key or .env file and receive its contents because requestedPath is passed directly to readFileSync without authorization or containment. Resolve and validate the real path against the intended drawing-session directory, including rejecting traversal and symlink escapes, before reading it. SECURITY.mdL45-L48

Useful? React with 👍 / 👎.

}

res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
res.end(fs.readFileSync(requestedPath, 'utf-8'));

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 Handle unreadable preview paths without terminating the server

When any local or tunneled client requests a nonexistent, directory, or otherwise unreadable path, readFileSync throws from the HTTP request callback; because this server installs no exception handler, the uncaught error terminates the draw process and disconnects the collaboration session. Catch filesystem errors and return an appropriate 4xx response instead.

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

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

Reviewed commit: 8650b13d5d

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

}

res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
res.end(fs.readFileSync(requestedPath, 'utf-8'));

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 Security: Restrict session-file reads to the session directory

When a draw session is reachable through its collaboration tunnel (the default for new sessions when a supported tunnel is installed), any participant with the share URL can call GET /api/session/file?path=/home/... without application authentication. The query parameter is passed directly to readFileSync, before the UI containment check, so the plugin returns any developer-readable file, including SSH keys, tokens, .env files, or private source. Canonicalize the path, reject absolute/traversal/symlink escapes, and allow reads only inside the intended session directory. This violates the trusted-parent path-confinement requirement.

SECURITY.md reference: SECURITY.md:L45-L48

Useful? React with 👍 / 👎.

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.

1 participant