Skip to content

Remove case normalization from normalizeCommand to close command-bypass vulnerability#90

Merged
NoahCardoza merged 2 commits intofeat/issue-49__phase-2-client-serverfrom
copilot/sub-pr-89
Feb 28, 2026
Merged

Remove case normalization from normalizeCommand to close command-bypass vulnerability#90
NoahCardoza merged 2 commits intofeat/issue-49__phase-2-client-serverfrom
copilot/sub-pr-89

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 28, 2026

Lowercasing in normalizeCommand allowed a case-variant command to pass hash verification while the injector executed the original casing — on a case-sensitive filesystem, ECHO and echo can be different executables.

Changes

  • src/core/command-hash.ts — removed .toLowerCase() from normalizeCommand; whitespace normalization (trim + collapse) is preserved as it is semantically neutral
  • src/__tests__/command-hash.test.ts — removed lowercase-specific test cases; updated round-trip test to reflect case-preserving behavior
// Before — grants approved for "cat myfile.txt" would match "cat MyFile.txt"
const normalized = cmd.trim().replace(/\s+/g, ' ').toLowerCase()

// After — case is preserved, hash comparison is strict
const normalized = cmd.trim().replace(/\s+/g, ' ')

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…d bypass

Co-authored-by: NoahCardoza <10343470+NoahCardoza@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on normalization in Phase 2 Client-Server Mode Remove case normalization from normalizeCommand to close command-bypass vulnerability Feb 28, 2026
@NoahCardoza NoahCardoza marked this pull request as ready for review February 28, 2026 20:25
@NoahCardoza NoahCardoza merged commit ac6241d into feat/issue-49__phase-2-client-server Feb 28, 2026
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.

2 participants