Repository navigation
Preprint API security fixes: owner data exposure, owner publishing, title XSS, search scope - #5618
Merged
Merged
Conversation
This was referenced Oct 7, 2026
ajrbyers
force-pushed
the
b-preprint-api-publish-title-xss-1.9
branch
from
October 7, 2026 11:49
8f83b59 to
03a1625
Compare
mauromsl
approved these changes
Oct 7, 2026
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.
Fixes five problems in the preprint API that are already in 1.9. None are introduced by #5612.
Fixes
PreprintSerializerhasdepth = 2and listsowner, so every preprint returned the owner's fullAccountrow: password hash, email, activation and confirmation codes,is_superuserand so on. That includes the public, anonymous/api/published_preprints/endpoint.owneris now the account's ID only. Affectsr-v1.9.x,v1.9-RC-1andmaster; the 1.8 releases don't listownerand are not affected./api/user_preprints/an owner could setstage,date_published,date_accepted,preprint_doi,ownerandrepository, and edit preprints after submission. A newUserPreprintSerializermakes it match the web submission flow:date_submitted, which was previously wiped.|safein about 50 templates.Preprint.title,PreprintVersion.titleandVersionQueue.titleare nowJanewayBleachCharField, asArticle.titleis. Migrationrepository0059 sanitises existing titles that contain<. Thecitation_titlemeta tag now usesstriptags, since sanitising alone does not stop a"breaking out of the attribute. The version form keeps its plain text input.?search=on/api/preprints/returned a 500 (it filtered onaccount__institution, which doesn't exist), and the result set was not restricted to the current repository. Fixing only the error would have listed other repositories' preprints. Search now runs in the database within the current repository, and affiliation search uses the author's ROR or custom organisation name.Testing
api/tests/test_user_preprints_api.pycover each fix.apiandrepositorytest suites pass.Merging with #5612
#5612 rewrites the same search block for FrozenAuthor and already restricts it to the repository; keep its version. Migration 0059 here becomes 0062 after #5612's 0059–0061.