Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

No PKCE Implementation in OAuth Authorization Code Flow

Aperta
#87 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@andrewmusselman ci sta già lavorando.

Dal 23/4/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

ASVS priority

Issue: FINDING-061 - No PKCE Implementation in OAuth Authorization Code Flow

Labels: bug, security, priority:high, asvs-level:L2

ASVS Level(s): [L2-only]

Description:

Summary

The OAuth flow uses the state parameter for CSRF protection but does not implement Proof Key for Code Exchange (PKCE). ASVS 10.1.2 specifically names PKCE code_verifier as a client-generated secret that should be transaction-specific and session-bound. Without PKCE, the authorization code itself is the sole bearer credential for obtaining tokens, vulnerable to code interception attacks via Referer header leak, browser history, open redirector, malicious browser extensions, or network-level interception.

Details

Affected Files and Lines:

  • src/asfquart/generics.py:48-101 - OAuth flow without PKCE

The flow lacks PKCE protection, making authorization codes vulnerable to interception.

Recommended Remediation

Implement PKCE (RFC 7636) if the ASF OAuth service supports it:

# On login initiation
code_verifier = secrets.token_urlsafe(64)
code_challenge = base64.urlsafe_b64encode(
    hashlib.sha256(code_verifier.encode()).digest()
).rstrip(b'=').decode()

# Store code_verifier in pending_states
pending_states[state]['code_verifier'] = code_verifier

# Include in authorization request
oauth_url = (
    f"{OAUTH_URL_AUTHORIZE}?"
    f"response_type=code&"
    f"client_id={CLIENT_ID}&"
    f"redirect_uri={redirect_uri}&"
    f"state={state}&"
    f"code_challenge={code_challenge}&"
    f"code_challenge_method=S256"
)

# On token exchange
code_verifier = state_data['code_verifier']
token_params = {
    'code': code,
    'code_verifier': code_verifier,
    # ... other params
}
Acceptance Criteria
  • PKCE implementation added
  • code_verifier generated
  • code_challenge computed
  • Challenge included in auth request
  • Verifier included in token exchange
  • Unit test verifying the fix
References
  • Source reports: L2:10.1.2.md, L2:10.2.1.md
  • Related findings: FINDING-060, FINDING-062
  • ASVS sections: 10.1.2, 10.2.1
Priority

High

Lingua principale
Python
Stelle
7
Fork
13
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/infrastructure-asfquart

Tutte le issue di apache/infrastructure-asfquart

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.