Repository navigation
test(sdkharness): lock.bypass_governance and lock.per_file_retention accept B2's 401 access_denied - #621
Merged
Conversation
…accept B2's 401 access_denied A delete of a governance-locked version without bypassGovernance is refused by B2 with 401 access_denied (b2sdk: Unauthorized), as this repository's raw-API contract test shows. The two repository-owned conformance checks accepted AccessDenied, RetentionWriteError, Conflict or BadRequest only. They now also accept Unauthorized whose code is access_denied, and still fail when the delete is allowed or refused for another reason (bad token, other 401 code, 5xx, network). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
What
The repository-owned conformance checks
lock.bypass_governanceandlock.per_file_retentiondelete a governance-locked version withoutbypassGovernanceand require a refusal. They accepted onlyAccessDenied,RetentionWriteError,ConflictorBadRequest. B2 refuses that delete with 401 (b2sdk:Unauthorized), as this repository's raw-API contract test shows (test/integration/test_raw_api.py:with pytest.raises(Unauthorized): raw_api.delete_file_version(...)on a governance-locked version, then the bypassing delete succeeds). The standalone B2 simulator (v0.4.1, default profile) now answers the same, so both checks failed against it withrefused with Unauthorized.Change
refused()takesaccess_denied_401=Truefor the delete-without-bypass call: it additionally acceptsUnauthorizedonly when its code isaccess_denied.InvalidAuthToken(bad or expired token), any otherUnauthorizedcode, 5xx, 404 and network errors still fail. Delete allowed still fails ("the call was permitted").test/unit/test_sdkharness_lock_refusal.py: 20 tests; 18 fail on the previous leaves and pass now (accepted: 401 access_denied and the old classes; still failing: allowed operation, bad token, other 401 codes, unverified email, 5xx, not found).+sdkharness-lock-refusal.infrastructure.md.Verified
Through the dispatchers (
.sdkharness/tests/run-conformance), Python 3.12:ruff checkandruff format --checkare clean on the touched files.Not run: the full nox matrix and the integration suites. CI on this PR will show the known live-encryption failures (#614) unrelated to the change.
Opened for review; not merged.
🤖 Generated with Claude Code