fix(db): match digest subscriptions case-insensitively by login#1524
Open
galuis116 wants to merge 1 commit into
Open
fix(db): match digest subscriptions case-insensitively by login#1524galuis116 wants to merge 1 commit into
galuis116 wants to merge 1 commit into
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1524 +/- ##
=======================================
Coverage 95.45% 95.45%
=======================================
Files 195 195
Lines 21121 21121
Branches 7637 7637
=======================================
Hits 20161 20161
Misses 383 383
Partials 577 577
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1523.
upsertDigestSubscriptionandlistDigestSubscriptionsForLoginkeyed digest subscriptions on the rawloginwithout case-normalizing it — even though the email is already lowercased, and every sibling subscription/identity path (notification subscriptions, issue-watch, notification deliveries, official-miner detections) lowercases login on both write and read. GitHub logins are case-insensitive, so a subscriber stored as "Foo" was missed on a "foo" lookup, and the[login, email]conflict target accumulated case-variant duplicate rows.What changed
upsertDigestSubscriptionnow storeslogin: input.login.toLowerCase(), andlistDigestSubscriptionsForLoginlooks up withlogin.toLowerCase()— making storage and lookup consistent and the[login, email]dedup effective, exactly like the sibling subscription paths.Scope
CONTRIBUTING.md; nosite//CNAME/VitePress.Validation
git diff --checknpm run typechecknpm run test:coveragelocally (4619 passed); both changed lines are covered by a new case-insensitive + dedup test.npm run test:workersnpm audit --audit-level=moderateIf any required check was skipped, explain why:
DigestSubscriptionRecordshape are identical.Safety
Notes
src/db/repositories.ts; mirrors the existing case-insensitive handling in the notification/issue-watch subscription paths.