Plugin Directory: Treat a new ref at the same version as a new release - #808
Open
obenland wants to merge 1 commit into
Open
Plugin Directory: Treat a new ref at the same version as a new release#808obenland wants to merge 1 commit into
obenland wants to merge 1 commit into
Conversation
update_single_plugin() decided newness from the served version alone, so a new tag (or a tag<->trunk flip) carrying the same Version header skipped the cooldown and block gates and shipped its different content immediately — the scan could not hold it. Newness now also compares the served stable tag, so a same-version ref change passes through the gates like any other release. The truncation guard extends to the stable_tag column, mirroring the version column's varchar(128) allowance. A pre-existing hold test that left stable_tag unset now sets it, so it isolates version truncation as intended. Combined with the stable-tag release resolution in WordPress#807, this closes the same-version ref-change bypass for arbitrary tag names; on its own it already covers tag<->trunk transitions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
update_single_plugin()decided whether a release was "new" — and therefore whether it had to pass through the cooldown and block gates — from the served version alone:So a new ref carrying the same Version header (tag A → tag B, or a tag↔trunk flip, all at the same version) had
is_new_version = false, skipped both gates, and wrote its different content straight intoupdate_source. With the release cooldown live in production, this defeated the window the security scan needs: the candidate shipped immediately, and the later high-risk callback couldn't un-ship an already-served version. A one-line SVN action (re-tag the same version) walked past the entire gate.What it does
update_single_plugin()readsupdate_source.stable_tagalongsideversionand compares both. A same-version ref change is recognised as a new release and passes through the cooldown and block gates like any other. This aligns the write path withcron_trigger()'s out-of-date query, which already treats astable_tagchange as needing an update.versioncolumn now extends tostable_tagtoo, so a long ref that stores truncated doesn't read as perpetually-new.$is_new_versionis renamed$is_new_releaseat its three use sites to match the broadened meaning; the current stable tag is read once and reused for the row write.Relationship to #807
This is the newness half of making
(version, ref)the canonical release identity; #807 is the resolution half (resolving the held release from the stable tag). They compose: with #807 also in place, this closes the same-version ref-change bypass for arbitrary tag names (where the new tag's name differs from the version, whichupdate_single_plugin's version-keyedget_release()can't otherwise resolve). On its own, this PR already covers the tag↔trunk transitions, where the ref is resolvable by version. It's independently correct and independently mergeable.Not addressed here (separate, larger work): binding a scan verdict to the scanned bytes (mutable ZIP), gating the direct-download / new-install surface, and the callback/cooldown races.
Testing
tests/Release_Newness_Test.php(3 tests): a new ref at the already-served version is deferred by the cooldown (not written), a blocked new-ref-same-version is held out of the row with its deferred serve cancelled, and an unchanged release (same version and ref) is not spuriously deferred. Verified the first two fail against the previous version-only newness. A pre-existing truncation hold test was made ref-consistent so it still isolates version truncation (and now also exercises the stable_tag truncation path).🤖 Generated with Claude Code