Skip to content

🛡️ Sentinel: [HIGH] Fix path traversal in auth files handlers#119

Closed
rschumann wants to merge 2 commits intomainfrom
sentinel-fix-path-traversal-13176354521863178677
Closed

🛡️ Sentinel: [HIGH] Fix path traversal in auth files handlers#119
rschumann wants to merge 2 commits intomainfrom
sentinel-fix-path-traversal-13176354521863178677

Conversation

@rschumann
Copy link
Copy Markdown
Contributor

🚨 Severity: HIGH
💡 Vulnerability: Path traversal checks in file handlers used os.PathSeparator, which allowed attackers to use backslashes (\) to traverse out of restricted directories when running on Linux (where the separator is /). Additionally, UploadAuthFile did not properly validate paths within multipart form data.
🎯 Impact: An attacker could potentially download, delete, or overwrite arbitrary files on the host filesystem by supplying crafted filenames such as ..\..\etc\passwd via the Management API.
🔧 Fix:

  • Replaced strings.Contains(name, string(os.PathSeparator)) with explicit strings.ContainsAny(name, "/\\") across all file handlers for true cross-platform protection.
  • Reordered execution logic in UploadAuthFile and DeleteAuthFile to perform input validation before the authManager == nil check, allowing inputs to fail fast without requiring full system initialization.
  • Added explicit multipart file.Filename validation in UploadAuthFile.
    Verification: Unit tests within auth_files_security_test.go were updated to run on all platforms, explicitly asserting that backslash traversal attempts are properly rejected with a 400 Bad Request. Tested and passed via go test ./internal/api/handlers/management/ -v -run PathTraversal.

PR created automatically by Jules for task 13176354521863178677 started by @rschumann

…andlers

Replaces OS-specific path separator checks with explicit cross-platform `/` and `\` validation in `DownloadAuthFile`, `UploadAuthFile`, and `DeleteAuthFile`. Also moves these checks earlier in the request lifecycle to properly isolate testing logic from required component dependencies (e.g., `authManager`).

Co-authored-by: rschumann <360788+rschumann@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.

…andlers

Replaces OS-specific path separator checks with explicit cross-platform `/` and `\` validation for `name` query parameters in `UploadAuthFile` and `DeleteAuthFile`.

Co-authored-by: rschumann <360788+rschumann@users.noreply.github.com>
@rschumann rschumann closed this Apr 8, 2026
@rschumann rschumann deleted the sentinel-fix-path-traversal-13176354521863178677 branch April 8, 2026 14:36
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