Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

fix(8.1): record why the two WebAuthn second-factor routes are public

Beenu Aroraa9d2a6c8ebd2
diff --git a/scripts/check_route_auth.py b/scripts/check_route_auth.py
index d9692757e..60082cc18 100644
--- a/scripts/check_route_auth.py
+++ b/scripts/check_route_auth.py
@@ -189,17 +189,31 @@ IN_BAND_CREDENTIAL_ROUTES: dict[str, tuple[str, str]] = {
),
# -- the second factor, which is part of establishing a credential ------
#
- # All three verify in band through `read_challenge`, which refuses a
+ # All five verify in band through `read_challenge`, which refuses a
# token that is not of type `mfa_challenge` — so an access token
# presented here is rejected rather than honoured, and a live session
# cannot mint another one with no code. `/enroll/*` additionally accept
# an ordinary bearer, through `get_current_user`; the anonymous arm is
# what lets a user whose tenant has just started requiring a factor
# enrol at all, since they hold a correct password and no session.
+ #
+ # The two `webauthn/*` routes are the same challenge discharged with a
+ # security key instead of a code. Both take the user from the signed
+ # challenge and never from the body: an endpoint that let a caller name
+ # whose credentials to list would answer "does this address hold a
+ # passkey" to anybody who asked.
"services/api/app/api/v1/endpoints/mfa.py::verify": (
"read_challenge",
"completes the sign-in that POST /auth/login answered with 202; the challenge token it takes is the credential",
),
+ "services/api/app/api/v1/endpoints/mfa.py::webauthn_challenge": (
+ "read_challenge",
+ "assertion options for the user the challenge names -- the second factor's equivalent of POST /verify's first half",
+ ),
+ "services/api/app/api/v1/endpoints/mfa.py::webauthn_verify": (
+ "read_challenge",
+ "discharges that same challenge with a security key; the credential must belong to the user the challenge names",
+ ),
"services/api/app/api/v1/endpoints/mfa.py::enroll_begin": (
"read_challenge",
"a session when one exists, otherwise the enrolment challenge from a 202 sign-in -- the path that stops a tenant "
diff --git a/services/api/tests/test_sso_provisioning.py b/services/api/tests/test_sso_provisioning.py
index 46b443425..5b388dba8 100644
--- a/services/api/tests/test_sso_provisioning.py
+++ b/services/api/tests/test_sso_provisioning.py
@@ -150,9 +150,7 @@ class TestTheHandlersUseIt:
"""Depth 8.1. The callback lands on the second-factor page with a
challenge, and **no tokens at all** — a fragment that carried both
would hand over the session the challenge exists to withhold."""
- fragment = saml._session_fragment(
- {"mfa_required": True, "mfa_token": "challenge-token", "methods": ["totp", "webauthn"]}
- )
+ fragment = saml._session_fragment({"mfa_required": True, "mfa_token": "challenge-token", "methods": ["totp", "webauthn"]})
assert "access_token" not in fragment
assert "refresh_token" not in fragment