Skip to content

πŸ›‘οΈ Sentinel: [HIGH] Fix path traversal in auth files#117

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

πŸ›‘οΈ Sentinel: [HIGH] Fix path traversal in auth files#117
rschumann wants to merge 2 commits intomainfrom
sentinel-fix-authfile-path-traversal-3727276408922104936

Conversation

@rschumann
Copy link
Copy Markdown
Contributor

🚨 Severity: HIGH
πŸ’‘ Vulnerability: The UploadAuthFile and DeleteAuthFile handlers within the management API did not validate the user-provided name query parameter or multipart file.Filename for path traversal sequences (/ or \) until after they performed a nil check on h.authManager. This could leak application state or allow path traversal depending on the initialization timing. Even if checked later, the file upload mechanism was susceptible to path traversal via multipart form filenames.
🎯 Impact: An attacker could potentially write files outside of the configured AuthDir (via upload) or delete arbitrary .json files on the host filesystem (via delete) if they manage to hit the endpoint at the right time, or bypass the query param checks by using the multipart filename attribute.
πŸ”§ Fix:

  1. Moved the strings.ContainsAny(name, "/\\") path traversal check for the name parameter to the very top of the UploadAuthFile and DeleteAuthFile handlers, guaranteeing early failure (400 Bad Request) before any state checks or application logic executes.
  2. Added a strings.ContainsAny(file.Filename, "/\\") check specifically for the multipart upload form file.Filename to prevent path traversal during file saves.
    βœ… Verification: Expanded TestDownloadAuthFile_PathTraversal in auth_files_security_test.go to explicitly verify that path traversal attempts on POST /upload and DELETE /delete return 400 Bad Request. Ran go test ./internal/api/handlers/management -run TestDownloadAuthFile_PathTraversal to confirm the fix.

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

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.

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