feat: Block DOI registration by spam or not-yet-approved communities#3600
Merged
feat: Block DOI registration by spam or not-yet-approved communities#3600
Conversation
gabestein
approved these changes
Apr 22, 2026
Member
gabestein
left a comment
There was a problem hiding this comment.
LGTM from a functionality perspective. I do wonder if we want to still let people preview deposits for evaluating the tool, since it's a popular use-case? But seems like a bit of an edge case that, if it came up, could be a pretty quick follow.
Member
Author
|
Nice - agreed. Removed the gate on the previews in the latest commit |
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.
Any community could mint DOIs (via Crossref or DataCite) regardless of whether the community had been approved by a moderator. Communities with a SpamTag status of
'unreviewed'or'confirmed-spam'should not be able to issue DOIs.Approach
Server-side enforcement
A new shared guard function
assertCommunityApprovedForDoi(communityId)is added toserver/doi/permissions.ts. It loads the community's SpamTag and throws aForbiddenErrorif the status is anything other than'confirmed-not-spam'. Legacy communities with no SpamTag record (pre-dating the spam system) are allowed through.The guard is added to all DOI-minting API endpoints:
POST /api/doi,GET /api/doiPreview,GET /api/generateDoi(viapreviewOrDepositDoi()and the generateDoi handler inserver/doi/api.ts)POST /api/pubs/:pubId/doi,POST /api/pubs/:pubId/doi/preview(inserver/pub/api.ts)POST /api/collections/:collectionId/doi,POST /api/collections/:collectionId/doi/preview(inserver/collection/api.ts)Intentionally not gated:
GET /api/doi/validate— read-only validation, does not mint DOIsserver/doi/updateUrls.ts— maintenance path for updating existing DOI URLs during community destructionClient-side UX
PubSettings:canIssueDoinow requires bothcanAdminCommunityand community approvalCollectionSettings:canIssueDoi(was hardcodedtrue) now checks community approval;allowUpdateDoion the Crossref metadata editor also gatedDepositcomponent: shows a warning callout explaining DOI minting requires approval when the community is unapproved, replacing the deposit UI entirelySpamBanner: updated "unreviewed" banner text — previously said "all features and functionality are available", now notes that DOI minting is unavailableChanged files
server/doi/permissions.tsassertCommunityApprovedForDoi()guardserver/doi/api.tsserver/pub/api.tsserver/collection/api.tsclient/components/Deposit/Deposit.tsxclient/containers/DashboardSettings/PubSettings/PubSettings.tsxcanIssueDoichecks approvalclient/containers/DashboardSettings/CollectionSettings/CollectionSettings.tsxcanIssueDoiandallowUpdateDoicheck approvalclient/containers/App/SpamBanner.tsx