fastmcp/loq.toml
Jeremiah Lowin 016b9f90e0
Fix confused deputy attack via consent binding cookie (#3201)
* Add consent binding cookie to prevent confused deputy attacks (GHSA-rww4-4w9c-7733)

The OAuthProxy's consent page verified user intent but didn't bind the
consenting browser to the IdP callback. An attacker could intercept the
upstream authorization URL after consent and send it to a victim, whose
browser would complete the flow without having the consent cookie.

This adds a signed consent binding cookie set during consent approval
(both manual and auto-approve paths) and verified in the IdP callback
handler. A different browser won't have this cookie and gets a 403.

* Use startswith for URL assertion in consent binding test

* Store consent bindings as per-transaction map to support parallel flows

* Only accept __Host- consent binding cookie on HTTPS

* chore: Update SDK documentation

---------

Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
2026-02-17 10:24:07 -05:00

99 lines
1.8 KiB
TOML

# loq configuration - file size enforcement
# Run `loq baseline` to update when files exceed limits
default_max_lines = 1000
respect_gitignore = true
exclude = ["**/uv.lock", ".git/**", "docs/**"]
[[rules]]
path = "tests/**"
max_lines = 1000
[[rules]]
path = "tests/server/providers/test_local_provider_tools.py"
max_lines = 1554
[[rules]]
path = "tests/client/test_client.py"
max_lines = 1438
[[rules]]
path = "tests/server/test_auth_integration.py"
max_lines = 1242
[[rules]]
path = "tests/server/auth/test_oauth_proxy.py"
max_lines = 1899
[[rules]]
path = "tests/server/middleware/test_middleware.py"
max_lines = 1070
[[rules]]
path = "src/fastmcp/server/context.py"
max_lines = 1272
[[rules]]
path = "tests/tools/test_tool_transform.py"
max_lines = 1748
[[rules]]
path = "tests/server/test_mount.py"
max_lines = 1545
[[rules]]
path = "tests/utilities/test_inspect.py"
max_lines = 1111
[[rules]]
path = "tests/resources/test_resource_template.py"
max_lines = 1009
[[rules]]
path = "tests/server/auth/test_oauth_consent_flow.py"
max_lines = 1274
[[rules]]
path = "src/fastmcp/server/server.py"
max_lines = 3250
[[rules]]
path = "tests/tools/test_tool.py"
max_lines = 2026
[[rules]]
path = "tests/client/test_elicitation.py"
max_lines = 1132
[[rules]]
path = "src/fastmcp/client/client.py"
max_lines = 1885
[[rules]]
path = "tests/utilities/test_json_schema_type.py"
max_lines = 1584
[[rules]]
path = "src/fastmcp/server/auth/oauth_proxy/proxy.py"
max_lines = 1796
[[rules]]
path = "tests/server/test_dependencies.py"
max_lines = 1046
[[rules]]
path = "tests/client/test_sampling.py"
max_lines = 1002
[[rules]]
path = "tests/server/auth/test_jwt_provider.py"
max_lines = 1101
[[rules]]
path = "src/fastmcp/server/providers/local_provider.py"
max_lines = 1187
[[rules]]
path = "tests/server/test_versioning.py"
max_lines = 1235