π‘οΈ Sentinel: [HIGH] Fix path traversal in auth files#117
π‘οΈ Sentinel: [HIGH] Fix path traversal in auth files#117
Conversation
Co-authored-by: rschumann <360788+rschumann@users.noreply.github.com>
|
π 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 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>
π¨ Severity: HIGH
π‘ Vulnerability: The
UploadAuthFileandDeleteAuthFilehandlers within the management API did not validate the user-providednamequery parameter or multipartfile.Filenamefor path traversal sequences (/or\) until after they performed a nil check onh.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.jsonfiles 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 multipartfilenameattribute.π§ Fix:
strings.ContainsAny(name, "/\\")path traversal check for thenameparameter to the very top of theUploadAuthFileandDeleteAuthFilehandlers, guaranteeing early failure (400 Bad Request) before any state checks or application logic executes.strings.ContainsAny(file.Filename, "/\\")check specifically for the multipart upload formfile.Filenameto prevent path traversal during file saves.β Verification: Expanded
TestDownloadAuthFile_PathTraversalinauth_files_security_test.goto explicitly verify that path traversal attempts onPOST /uploadandDELETE /deletereturn400 Bad Request. Rango test ./internal/api/handlers/management -run TestDownloadAuthFile_PathTraversalto confirm the fix.PR created automatically by Jules for task 3727276408922104936 started by @rschumann