Skip to content

fix(security): fail-open auth — set authenticated=False in dev mode#1572

Open
Joshua-Medvinsky wants to merge 1 commit into
SolaceLabs:mainfrom
Joshua-Medvinsky:fix/find-002-fail-open-auth
Open

fix(security): fail-open auth — set authenticated=False in dev mode#1572
Joshua-Medvinsky wants to merge 1 commit into
SolaceLabs:mainfrom
Joshua-Medvinsky:fix/find-002-fail-open-auth

Conversation

@Joshua-Medvinsky

Copy link
Copy Markdown

Summary

When frontend_use_authorization=false (default), the auth middleware sets authenticated=True for all requests, making downstream auth checks trivially bypassed. Any unauthenticated request is treated as the sam_dev_user with full authenticated privileges. This changes the dev-mode identity to authenticated=False and adds a startup warning.

Vulnerability

Severity: Critical
CWE: CWE-306 (Missing Authentication for Critical Function)
Location: src/solace_agent_mesh/shared/auth/middleware.py:299

The AuthMiddleware.call() checks frontend_use_authorization config. When False (default), it sets request.state.user to {"id": "sam_dev_user", "authenticated": True, "auth_method": "development"}. All downstream route handlers see authenticated=True and proceed without restriction.

An unauthenticated attacker can: list/create/delete sessions, send messages to agents (consuming LLM API credits), read/write artifacts, access admin config endpoints, and exfiltrate any data the agents have access to.

Fix

Change authenticated: True to authenticated: False in the dev-mode branch and add a log.warning(). Downstream code that checks authenticated will correctly reject unauthenticated requests. Dev mode still works for local testing but does not lie about authentication status.

Test Plan

  • With frontend_use_authorization=false, request.state.user.authenticated is False
  • With frontend_use_authorization=true, normal OAuth flow works
  • Warning log emitted in dev mode
  • Existing tests pass

Copilot AI review requested due to automatic review settings June 1, 2026 16:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the development-mode auth middleware to mark the synthesized dev user as unauthenticated and replaces the debug log with a warning.

Changes:

  • Sets authenticated: False for the development user dictionary.
  • Replaces the debug log with a warning message about development mode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 299 to 303
"id": "sam_dev_user",
"name": "Sam Dev User",
"email": "sam@dev.local",
"authenticated": True,
"authenticated": False,
"auth_method": "development",
Comment on lines +305 to +308
log.warning(
"AuthMiddleware: Development mode active — requests treated as unauthenticated. "
"Set frontend_use_authorization=true for production."
)
When frontend_use_authorization=false (default), the auth middleware
previously set authenticated=True for all requests, making downstream
auth checks trivially bypassed. This changes the dev-mode identity
to authenticated=False and adds a startup warning.

CWE-306: Missing Authentication for Critical Function

Signed-off-by: Joshua Medvinsky <joshuam@ethlas.com>
Signed-off-by: FailSafe Researcher <joshua@getfailsafe.com>
@Joshua-Medvinsky
Joshua-Medvinsky force-pushed the fix/find-002-fail-open-auth branch from 63fde6a to d78d5c4 Compare June 10, 2026 03:23
@failsafesecurity

Copy link
Copy Markdown

Hi maintainers 👋

This vulnerability was found by FailSafe — a top agentic cybersecurity company specializing in automated deep security analysis of AI/ML and agentic codebases.

We're reporting these initial findings as a social good contribution to help secure the open-source AI ecosystem. If you'd like us to perform a deeper, more comprehensive security scan of your project, we'd love to hear from you — reach out at joshua@getfailsafe.com.

Thanks for maintaining this project! 🙏

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.

3 participants