Skip to content

🛡️ Sentinel: [MEDIUM] Fix Information Disclosure & SafeStaticFiles AttributeError#72

Closed
socialawy-dev wants to merge 1 commit into
mainfrom
sentinel-fix-information-disclosure-and-attribute-error-4677847503251470289
Closed

🛡️ Sentinel: [MEDIUM] Fix Information Disclosure & SafeStaticFiles AttributeError#72
socialawy-dev wants to merge 1 commit into
mainfrom
sentinel-fix-information-disclosure-and-attribute-error-4677847503251470289

Conversation

@socialawy-dev
Copy link
Copy Markdown
Collaborator

🚨 Severity: MEDIUM
💡 Vulnerability:

  1. src/audioformation/server/routes.py: The exception details were directly leaked via HTTP 500 exceptions, which is an information disclosure vulnerability.
  2. src/audioformation/server/app.py: Calling .lower() on a Path object caused an AttributeError, resulting in a broken security control.
    🎯 Impact: Attackers could gain knowledge of the backend configuration via leaked stack trace exceptions. The SafeStaticFiles check was malfunctioning, meaning the intended file access blocking control could have been bypassed or could break legitimate routing completely.
    🔧 Fix:
  • Modified app.py to ensure path.lower() is run before instantiating the Path object.
  • Replaced the direct exception return in routes.py with logger.error to log the failure securely and send a sanitized HTTP error instead.
    ✅ Verification: Ran testing for test_server.py and test_server_routes.py effectively. Verified modifications with bash checks ensuring logic aligns.

PR created automatically by Jules for task 4677847503251470289 started by @socialawy

…tributeError

Co-authored-by: socialawy <24765060+socialawy@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.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request corrects path normalization in app.py by lowercasing the path string before Path object instantiation and updates error handling in routes.py to log errors server-side while returning generic messages to clients. A suggestion was made to use logger.exception instead of logger.error in the exception handler to ensure full stack traces are captured for debugging.

except Exception as e:
shutil.rmtree(tmp_dir, ignore_errors=True)
raise HTTPException(status_code=500, detail=f"Upload failed: {e}")
logger.error(f"Upload failed: {e}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using logger.exception is preferred over logger.error within an except block. It automatically captures the full stack trace, which is essential for debugging internal server errors in production, whereas logger.error with just the exception string loses this context.

Suggested change
logger.error(f"Upload failed: {e}")
logger.exception("Upload failed")

@socialawy
Copy link
Copy Markdown
Owner

Superseded by #90 (merged ac23b55). The Sentinel/Jules SafeStaticFiles chain was iterating on the same middleware; #90's Path(str(path).lower()) fix addresses the root AttributeError. Closing as duplicate; re-open if a distinct vulnerability emerges.

@socialawy socialawy closed this May 13, 2026
@socialawy socialawy deleted the sentinel-fix-information-disclosure-and-attribute-error-4677847503251470289 branch May 13, 2026 19:06
@google-labs-jules
Copy link
Copy Markdown
Contributor

Superseded by #90 (merged ac23b55). The Sentinel/Jules SafeStaticFiles chain was iterating on the same middleware; #90's Path(str(path).lower()) fix addresses the root AttributeError. Closing as duplicate; re-open if a distinct vulnerability emerges.

Understood. Acknowledging that this work is now obsolete and stopping work on 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.

2 participants