pkce-reviewer

Review test cases for PKCE (Proof Key for Code Exchange) implementation. Covers code_challenge/code_verifier validation, S256 transformation, and all PKCE requirements per OAuth 2.1 Sections 4.1.1, 4.1.3, 7.5.1, 7.5.2. PKCE is MANDATORY in OAuth 2.1.

$ Instalar

git clone https://github.com/majiayu000/claude-skill-registry /tmp/claude-skill-registry && cp -r /tmp/claude-skill-registry/skills/development/pkce-reviewer ~/.claude/skills/claude-skill-registry

// tip: Run this command in your terminal to install the skill


name: pkce-reviewer description: Review test cases for PKCE (Proof Key for Code Exchange) implementation. Covers code_challenge/code_verifier validation, S256 transformation, and all PKCE requirements per OAuth 2.1 Sections 4.1.1, 4.1.3, 7.5.1, 7.5.2. PKCE is MANDATORY in OAuth 2.1.

PKCE Test Case Reviewer

Review test cases for PKCE implementation in OAuth 2.1 / OpenID Connect Basic OP.

Scope

  • Feature: PKCE (Proof Key for Code Exchange)
  • Specifications: OAuth 2.1 Section 4.1.1, 4.1.3, 7.5.1, 7.5.2
  • Status: MANDATORY for all Authorization Code flow clients

Review Process

  1. Identify which PKCE requirement the test targets
  2. Check against the checklist below
  3. Verify both success and error scenarios
  4. Ensure S256 transformation is tested (mandatory)
  5. Report gaps with specific spec section references

Code Verifier Requirements

PropertyRequirementSpec Reference
Characters[A-Z] / [a-z] / [0-9] / "-" / "." / "_" / "~"OAuth 2.1 4.1.1
Min Length43 charactersOAuth 2.1 4.1.1
Max Length128 charactersOAuth 2.1 4.1.1
EntropyHigh entropy, cryptographically randomOAuth 2.1 4.1.1

Code Challenge Transformation Methods

MethodCalculationStatus
S256BASE64URL(SHA256(ASCII(code_verifier)))MANDATORY
plaincode_challenge = code_verifierOPTIONAL

Server Requirements Checklist

CheckRequirementSpec Reference
[ ]Support code_challenge parameterOAuth 2.1 4.1.1
[ ]Support code_challenge_method parameterOAuth 2.1 4.1.1
[ ]Support S256 transformation (MANDATORY)OAuth 2.1 4.1.1
[ ]MAY support plain transformationOAuth 2.1 4.1.1
[ ]Verify code_verifier at token endpointOAuth 2.1 4.1.3
[ ]Reject if code_challenge present but code_verifier missingOAuth 2.1 4.1.3
[ ]Reject if code_verifier present but no code_challenge was sentOAuth 2.1 4.1.3

Authorization Request Tests

TestExpected Result
[ ] Valid S256 code_challengeAccept
[ ] Valid plain code_challengeAccept (if supported)
[ ] Missing code_challengeReject (OAuth 2.1)
[ ] Invalid code_challenge formatReject
[ ] Unknown code_challenge_methodReject

Token Request Tests

TestExpected Result
[ ] Valid code_verifier matching S256 challengeAccept
[ ] Valid code_verifier matching plain challengeAccept (if supported)
[ ] Missing code_verifier when challenge was sentReject (invalid_grant)
[ ] Wrong code_verifier (hash mismatch)Reject (invalid_grant)
[ ] code_verifier present but no challenge was sentReject
[ ] code_verifier too short (<43 chars)Reject
[ ] code_verifier too long (>128 chars)Reject
[ ] code_verifier with invalid charactersReject

S256 Test Vector

code_verifier: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk

SHA256(ASCII(code_verifier)):
  [byte array]

BASE64URL(SHA256 result):
  E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM

Example Authorization Request

GET /authorize?
  response_type=code
  &client_id=s6BhdRkqt3
  &redirect_uri=https%3A%2F%2Fclient.example.org%2Fcb
  &scope=openid%20profile
  &state=af0ifjsldkj
  &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
  &code_challenge_method=S256

Example Token Request

POST /token HTTP/1.1
Host: server.example.com
Content-Type: application/x-www-form-urlencoded
Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW

grant_type=authorization_code
&code=SplxlOBeZQQYbYS6WxSbIA
&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk

Security Considerations

Why PKCE is Mandatory in OAuth 2.1

AttackPKCE Protection
Code interceptionAttacker lacks code_verifier
Code injectioncode_verifier bound to original request
Replay attackcode_verifier is single-use

Review Output Format

## Test Case: [Name]
### Target Feature: PKCE - [specific aspect]
### Test ID: OP-PKCE-[xxx]
### Spec Compliance:
- [x] Covers required behavior per [spec section]
- [ ] Missing: [specific requirement]
### OAuth 2.1 Compliance:
- [x/blank] S256 validation included
### Verdict: PASS / FAIL / PARTIAL
### Recommendations: [if any]