docs: correct plugin failure-classification comment in authorizer - #119
Open
alberto-crossmint wants to merge 1 commit into
Open
docs: correct plugin failure-classification comment in authorizer#119alberto-crossmint wants to merge 1 commit into
alberto-crossmint wants to merge 1 commit into
Conversation
The inline comment next to the Err(Err(_)) arm listed "panic!, host trap, TTL expiry" together. That was inaccurate: on Soroban 22 a plain `panic!` in a plugin produces Err(Ok(_)) (intentional rejection / fail-closed), NOT Err(Err(_)) (host trap / fail-open). Only genuine host traps — storage archival, budget exhaustion, contract not found, stack overflow — reach the fail-open arm. The inaccurate grouping risked misleading future maintainers into thinking a buggy unwrap in a plugin would be silently bypassed. It won't; it blocks auth like any intentional rejection. No behaviour change. Only the comment is fixed, and a regression test is added pinning the actual classification so future refactors must preserve it.
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.
Summary
The inline comment next to the
Err(Err(_))arm inauthorizer.rs::call_plugins_on_authlisted "panic!, host trap, TTL expiry" together in the fail-open branch. That is inaccurate on Soroban 22.Actual classification, pinned by the new test:
try_*shapeOk(Ok(_))Ok(Err(_))contracterror/panic_with_error!/ plainpanic!/unwrap()/ overflowErr(Ok(_))Err(Err(_))The practical implication: a buggy plugin that panics at runtime will block authorization (fail-closed) — it will not be silently bypassed. The fail-open path is environmental only.
This is a docs-only PR plus a regression test.
Changes
match res {to match reality and to note explicitly that plainpanic!andunwrap()are fail-closed.test_plugin_plain_panic_is_fail_closedtoplugin_test.rs— installs a plugin whoseon_authdoespanic!(...)and asserts__check_authreturnsErr(Ok(Error::PluginOnAuthFailed)). Future Soroban runtime changes that alter this classification will surface here.Test plan
test_plugin_plain_panic_is_fail_closed— plainpanic!blocks auth.test_plugin_intentional_rejection_blocks_auth—panic_with_error!also blocks auth (documents symmetry).test_uninstall_plugin_persists_removalandtest_max_plugins_limitunaffected.Why not also pin the fail-open branch?
Err(Err(_))requires an actual host trap (archival, budget exhaustion, missing contract). Those are hard to simulate deterministically in a unit test without fixture setup proportional to the payoff, and the Soroban SDK doesn't expose a stable way to force them. The classification of the common branches is pinned; fail-open-under-trap is documented but not asserted.