Repository navigation
fix(strr-api): keep a regular draft from being turned into a renewal outside the window (REGBACKLOG-391) - #1965
Merged
severinbeauvais merged 1 commit intoDec 3, 2026
Conversation
…outside the window (REGBACKLOG-391)
The registration ID check now applies to POST as well as PUT on /applications/{number}, so an existing draft can only skip the renewal window and in-progress checks if it is already a renewal of the requested registration.
Addresses review feedback on bcgov#1964.
severinbeauvais
requested review from
Jacky-Pham and
jimmypalelil
as code owners
December 2, 2026 23:14
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the renewal-window safeguard update.
No open issues 🎉
What changed in this PR
Closes a direct-API bypass in #1964’s renewal safeguards that allowed regular drafts to become renewals outside the permitted window.
Changes:
- Applies the registration ID mismatch check to existing applications regardless of HTTP method.
- Adds POST and PUT regression tests before the renewal window opens and after it closes.
| File | Description |
|---|---|
| strr-api/tests/unit/resources/test_renewal_window_api.py | Tests rejection and verifies the draft remains unchanged. |
| strr-api/src/strr_api/resources/application.py | Enforces registration ID matching for all existing applications. |
Review effort: Balanced
Jacky-Pham
approved these changes
Dec 3, 2026
Jacky-Pham
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. The regular draft tests passed for POST and PUT.
panish16
approved these changes
Dec 3, 2026
severinbeauvais
merged commit Dec 3, 2026
e2b3e0a
into
bcgov:feature-REGBACKLOG-391-v2
9 checks passed
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.



Addresses Copilot's review comment on #1964.
Problem:
/applications/{number}accepts POST as well as PUT, but the registration ID mismatch check ran only on PUT. Calling POST withisDrafton an existing regular draft, with a renewal payload, skipped that check. It also skipped the renewal window checks and theRENEWAL_ALREADY_IN_PROGRESScheck, all of which exempt existing applications.save_applicationthen turned the draft into a renewal. The web apps always use PUT for existing applications, so only a direct API call could do this.Fix: run the mismatch check for any existing application, whatever the method. An existing draft now gets past those checks only if it is already a renewal of the requested registration.
Tests:
test_regular_draft_cannot_become_renewal_outside_windowcovers POST and PUT, before the window opens and after it closes. Without the fix, both POST cases fail.