[WHIT-3020] Make preview token generation opt-in#11542
Open
TonyGDS wants to merge 1 commit into
Open
Conversation
5aba05f to
176854d
Compare
1951e36 to
e81735c
Compare
176854d to
7b71ef9
Compare
e81735c to
eadfa72
Compare
7b71ef9 to
dc3e859
Compare
63bdfd2 to
8d87f89
Compare
dc3e859 to
c2e1e13
Compare
5e9c977 to
b484ac4
Compare
c2e1e13 to
9163764
Compare
b484ac4 to
6762146
Compare
9163764 to
f642e3e
Compare
6762146 to
8da762a
Compare
2 tasks
f642e3e to
d35f18e
Compare
8da762a to
ba50c8f
Compare
d35f18e to
719aeea
Compare
7491e19 to
e6b1009
Compare
92202fe to
381379d
Compare
e6b1009 to
f7bdde1
Compare
381379d to
b25327c
Compare
f7bdde1 to
d6c67cb
Compare
b25327c to
729c9eb
Compare
d6c67cb to
06ac55d
Compare
729c9eb to
30f8365
Compare
06ac55d to
e90b442
Compare
Remove the before_create callback that assigned every edition an auth_bypass_id, making preview token generation opt-in: a draft has no token until a publisher generates one. Redrafting no longer carries the previous edition's token forward either — auth_bypass_id is excluded from the attributes create_draft copies — so a new draft also starts token-less. Editions now have no token by default: the factory carries a :with_auth_bypass_id trait for the cases that still need one, and the tests assert the empty-token default (presenter payloads serialise an empty auth_bypass_ids array).
30f8365 to
192753b
Compare
e90b442 to
0dd17f3
Compare
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.
Part 3 of 3 for WHIT-3020. Stacked on #11543
Jira
What
Makes preview-token generation opt-in. Previously every draft edition was auto-assigned a JWT auth-bypass token on creation, and the draft Content Store evaluates that token before access limits — granting access and skipping the allow-list if a token is present — so a document locked to named users was still viewable by anyone holding the share link. This removes the auto-generation, so a draft has no token until a publisher generates one (the generate/delete UI landed in #11543).
How
before_create :set_auth_bypass_idcallback onEdition— a new draft no longer gets a token, and none is sent to the Publishing API.auth_bypass_idfrom the attributesEdition#create_draftcopies, so redrafting a published document no longer carries its token forward — the new draft starts token-less.auth_bypass_idinto a:with_auth_bypass_idtrait so test editions match production (no token by default), applying it only where a token must be present.auth_bypass_idsarray; dedicated presence tests cover the token case).Acceptance criteria
Screenshots
Before — a brand-new draft auto-shows a generated preview link
After — a brand-new draft shows the empty state
Test plan
Run against integration with two sessions: a signed-in publisher and a signed-out browser (incognito) for the preview links. "403" below means the signed-out browser is refused.
A. Token lifecycle (once, on a Publication — representative of all types)
B. Document-type coverage (section renders + generate/delete behave as in A)
C. Access limiting
D. Asset propagation (upload to a draft with a token, then delete the token and re-check signed-out)
draft: true): with a token, signed-out can fetch the asset; after delete → 403. (token enforced)draft: false): confirm the token (or[]) is sent to Asset Manager, but see the limitation below.draft: false): as above.E. Other checks
auth_bypass_ids([token]or[]).Follow-ups (separate tickets/stories)
auth_bypass_idson publish — Currently if an edition has anauth_bypass_idit is propagated when the Edition is published. Once published theauth_bypass_idhas no effect on the display of the content. Thereforeauth_bypass_idshould be removed from the edition and downstream services when the edition is published. (WHIT-3585)