Skip to content

Add Semgrep rules for authlib, Firebase Auth, and Lucia Auth (#1)#2

Closed
xyaz1313 wants to merge 1 commit intoNeelagiri65:mainfrom
xyaz1313:add-authlib-firebase-lucia-rules
Closed

Add Semgrep rules for authlib, Firebase Auth, and Lucia Auth (#1)#2
xyaz1313 wants to merge 1 commit intoNeelagiri65:mainfrom
xyaz1313:add-authlib-firebase-lucia-rules

Conversation

@xyaz1313
Copy link
Copy Markdown

Closes #1

Added 3 new Semgrep rules and test fixtures for OAuth email-as-primary-key detection:

New rules (in oauth-email-key-extended.yaml):

  1. authlib-google-oauth-email-as-primary-key — Catches Python (Django/Flask) + authlib using as user lookup key. Covers , , , and patterns.

  2. firebase-auth-getUserByEmail — Catches calls in Node.js. This is Firebase Auth's primary way to resolve users by email.

  3. lucia-auth-email-as-primary-key — Catches Lucia v3 email-based user lookups via and .

New test fixtures:

File Type
Triggers authlib rule
Uses — should NOT trigger
Triggers Firebase rule

Happy to add more patterns or adjust the Semgrep syntax if needed.

…ri65#1)

New rules:
- authlib-google-oauth-email-as-primary-key: catches Django/Flask + authlib using userinfo['email'] as lookup key
- firebase-auth-getUserByEmail: catches admin.auth().getUserByEmail() usage
- lucia-auth-email-as-primary-key: catches Lucia v3 email-based user lookup

New fixtures:
- authlib-vulnerable.py / authlib-safe.py
- firebase-vulnerable.js
@Neelagiri65
Copy link
Copy Markdown
Owner

Thanks for this — your rules were already merged into main via 7ba9bc0 with attribution.

I evaluated the three patterns (authlib, Firebase Auth, Lucia v3), deduplicated the authlib patterns against the existing Python rule, added the missing safe fixtures (authlib-safe, firebase-safe, lucia-safe), and upgraded CI to dynamic per-fixture validation so future contributions validate automatically.

The CI failure here is expected — this branch predates the CI changes on main, so the finding count no longer matches. No action needed on your end.

Appreciate the contribution. If you spot other ecosystems worth covering (OmniAuth/Ruby is the obvious gap), feel free to open a new PR against current main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Help wanted: additional OAuth library patterns

2 participants