Skip to content

refactor: normalize Draw asset paths - #147

Draft
zcrab-oai wants to merge 1 commit into
codex/draw-path-check-only-20260904from
codex/draw-path-demo-no-security-20260904
Draft

refactor: normalize Draw asset paths#147
zcrab-oai wants to merge 1 commit into
codex/draw-path-check-only-20260904from
codex/draw-path-demo-no-security-20260904

Conversation

@zcrab-oai

Copy link
Copy Markdown
Contributor

Summary

  • normalize percent-encoded Draw asset paths before filesystem lookup
  • centralize static asset path resolution

Validation

  • npm --prefix plugins/draw run build:server

@zcrab-oai

Copy link
Copy Markdown
Contributor Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 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
🔒 Security Review Completed 2026-09-04T23:57:41.283383Z a164a0b 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 Security Review

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

Reviewed commit: a164a0b9f9

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


function resolveAssetPath(rootDir: string, requestPath: string): string {
const decodedPath = decodeURIComponent(requestPath);
return path.resolve(rootDir, `.${decodedPath}`);

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: Reject decoded paths outside the UI root

When the Draw plugin is installed and a running session is reachable—new sessions start a detected tunnel by default—an unauthenticated requester or invited collaborator can send /..%2f..%2f<file>. Decoding converts the encoded separators into traversal segments, and path.resolve escapes ui/dist without a subsequent containment check. The static handler then streams any selected process-readable file, potentially exposing Crabcode configuration and credentials. Canonicalize the target and reject any path.relative(uiDistDir, target) result outside the asset root before filesystem access.

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