Skip to content

πŸ›‘οΈ Sentinel: Sanitize Windows reserved device names and trailing dots in file names - #119

Open
criptogus wants to merge 1 commit into
mainfrom
sentinel/sanitize-windows-reserved-filenames-13080351731908464748
Open

criptogus wants to merge 1 commit into
mainfrom
sentinel/sanitize-windows-reserved-filenames-13080351731908464748

Conversation

@criptogus

Copy link
Copy Markdown
Owner

πŸ›‘οΈ Sentinel Security Fix

🚨 Severity: MEDIUM / HIGH (DoS and filesystem confusion on Windows)
πŸ’‘ Vulnerability:
User/AI-controlled document titles and file attachments containing Windows reserved device names (CON, PRN, AUX, NUL, COM1-COM9, LPT1-LPT9 with or without extensions) or trailing dots/spaces bypassed illegal character stripping ([/\\:*?"<>|\u0000-\u001f]). When saving files to disk on Windows, accessing these names can cause filesystem hangs, Denial of Service (DoS), or unexpected file path resolution.

🎯 Impact:
Attempting to create or save files with reserved DOS names on Windows systems can hang Node.js or cause system calls to target device streams or fail catastrophically. Trailing dots and spaces are stripped by Windows Win32 APIs, causing file name collisions and path confusion.

πŸ”§ Fix:

  • Updated sanitizeFileName in @hermesoffice/electron-utils to strip trailing dots and spaces.
  • Prepended an underscore _ to any file base name matching Windows reserved device names (CON, PRN, AUX, NUL, COM[1-9], LPT[1-9]), preventing device stream targeting while preserving user content.
  • Added comprehensive unit tests in safe-file-name.test.ts.
  • Recorded critical security learning in .jules/sentinel.md.

βœ… Verification:

  • npm run test -w @hermesoffice/electron-utils (all 219 tests passed)
  • npm run typecheck -w @hermesoffice/electron-utils (passed)
  • npm run lint & npm run format:check (passed)
  • npm run check:theme-colors & npm run check:english-comments (passed)

PR created automatically by Jules for task 13080351731908464748 started by @criptogus

…ts/spaces in file names

- Neutralize Windows reserved device names (CON, PRN, AUX, NUL, COM1-9, LPT1-9) in sanitizeFileName
- Strip trailing dots and spaces to prevent unexpected Windows path resolution
- Add unit tests for reserved names and trailing dots/spaces
- Update Sentinel security journal

Co-authored-by: criptogus <128640021+criptogus@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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