Skip to content

refactor: normalize draw asset paths - #146

Draft
zcrab-oai wants to merge 1 commit into
codex/draw-static-path-policy-20260904from
codex/normalize-draw-asset-paths-20260904
Draft

refactor: normalize draw asset paths#146
zcrab-oai wants to merge 1 commit into
codex/draw-static-path-policy-20260904from
codex/normalize-draw-asset-paths-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:04:33.328221Z 20bf152 Manual request

Security findings

Advisory findings (2)

ℹ️ 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: 20bf152773

ℹ️ 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: Constrain decoded asset paths to the UI directory

When a Draw collaboration tunnel is active and an attacker can reach its URL, a path such as /..%2F..%2F... is decoded into traversal separators and resolved without any containment check. The subsequent file stream can return any developer-readable file, including source, .env files, API tokens, or SSH keys. The parent did not decode these separators; this change both introduces decoding and removes the boundary check. Validate canonical targets against uiDistDir, including symlink escapes.

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

Useful? React with 👍 / 👎.

}

function resolveAssetPath(rootDir: string, requestPath: string): string {
const decodedPath = decodeURIComponent(requestPath);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Security: Reject malformed asset URL encoding without exiting

With an active tunneled Draw session, any requester who can reach its URL can send an invalid percent sequence such as /%. decodeURIComponent throws synchronously, and no request-level handler catches the exception, so Node exits and terminates the shared session. This also bypasses the graceful final save; the 30-second autosave only limits potential data loss. Catch decoding errors and return a 400 response instead of allowing untrusted input to terminate the process.

SECURITY.md reference: SECURITY.md:L66-L67

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