Skip to content

P3.1: Detector — oauth_flow scaffold and registration #77

Description

@bjcorder

Parent tracker: #62
Spec: docs/superpowers/specs/2026-05-21-edge-case-hardening-design.md
Milestone: P3

Goal

Create the new oauth_flow detector and register it. The detector recognises OAuth/OIDC authorization-code flow construction across the supported libraries so P3.2–P3.5 classifier rules can flag PKCE / state / nonce / redirect_uri risks.

Acceptance criteria

  • New module crates/sessionscope-detectors/src/oauth_flow/mod.rs.
  • Detector registered in crates/sessionscope-detectors/src/registry.rs.
  • Recognises auth-code flow construction in:
    • passport-oauth2 strategy configuration
    • openid-client Issuer.discover / client.authorizationUrl calls
    • next-auth provider blocks (OAuthProvider, OIDCProvider)
    • authlib OAuth2Client, OAuth2Session, OAuth registry
    • Generic crypto-near-identifier patterns: crypto.randomBytes(...) / secrets.token_urlsafe(...) near identifiers named state, nonce, code_verifier, code_challenge.
  • Emits artifact type for the auth-code flow.
  • Audit whether to add a new artifact type oauth_auth_code_flow or reuse an existing one (e.g., session_record or opaque_bearer_token) — flag for the consolidated P4.8 audit if a new artifact type is required.
  • All evidence excerpts pass through redaction (P3.9 adds OAuth-specific redaction patterns).

Files touched

  • crates/sessionscope-detectors/src/oauth_flow/mod.rs (new)
  • crates/sessionscope-detectors/src/registry.rs (register)
  • crates/sessionscope-model/src/artifact.rs (conditional — only if new artifact type lands)

Audit-then-decide

  • Artifact-type decision flagged for the consolidated P4.8 audit.
  • No new finding category from this issue — findings land in P3.2–P3.5.

Doc-update checklist

  • docs/USAGE.md notes the new detector under a new "OAuth/OIDC flow" subsection.
  • Coverage-matrix entries deferred until P3.2–P3.5 land findings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions