Skip to content

Fix CodeQL ReDoS in Windows smoke root validation #2031

Closed

Description

@integry

Objective

Remove the exact CodeQL high-severity js/redos blocker introduced in the finalized desktop packaging runtime without changing accepted path semantics.

Evidence

Runtime propagation PRs #2029 and #2030 share head 83f1d1c2a1ac1126c4720f1094c905962c701219. GitHub CodeQL check 99629296558 flags apps/desktop/scripts/packaged-smoke-support.mjs:230: /^[A-Za-z]:\\[^\0/]+(?:\\[^\0/]+)*$/ can exponentially backtrack on crafted Windows paths.

Required correction

  • Replace only the vulnerable regular expression in validateWindowsSystemRoot with deterministic linear checks.
  • Preserve the exact contract: ASCII drive letter, colon, root backslash, no NUL, no forward slash, no empty path segments, length at most 260, win32.isAbsolute, exact win32.normalize(value) === value, then the existing non-symlink directory lstat check.
  • A clear implementation may validate the fixed prefix and then split value.slice(3) on backslash, requiring every segment to be nonempty. Do not introduce another ambiguous or nested regex.
  • Add adversarial tests with long repeated dot/backslash input, empty segments, trailing slash, forward slash, NUL, relative paths, normalization changes, and valid canonical roots. Keep fixed safe diagnostics and do not expose the input.
  • Change no release, signing, packaging, smoke authorization, environment, or native-launch behavior.

Integration

Target only the runtime epic branch selected by base-1952-epic-electron-runtime-app; never target main. Run focused desktop script tests, desktop typecheck/tests, git diff --check, and require CodeQL green. Do not merge the generated PR; root will review and merge it into runtime so both propagation PRs update together.

Part of #1952 and unblocks #2029/#2030.

Activity

  1. propr-dev commented on Aug 31, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using codex agent with gpt-5.6-sol model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: codex
    • Model: gpt-5.6-sol
    • Branch: 2031/gpt-5.6-sol-fix-codeql-redos-in-windo-20260831-2018-gb9
    • Base Branch: 1952-epic-electron-runtime-app
    • Worktree: issue-2031-20260831-2018-gpt-5.6-sol-gb9

    🔍 Track Task Execution

  2. added a commit that references this issue on Aug 31, 2026
  3. integry commented on Sep 4, 2026

    @integry
    OwnerAuthor

    Implemented by #2033, merged into 1952-epic-electron-runtime-app (739319a). Closing the completed child issue during epic issue/PR reconciliation. Final desktop integration and delivery remain tracked by #1950 / #1970; this does not claim a main-branch release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions