fix: handle unsupported system transaction type [PM-19971]#840
Merged
Conversation
Contributor
fc2354f to
c30d20a
Compare
justinfrevert
approved these changes
Mar 4, 2026
Extract get_system_tx_type as a standalone free function. Change return type to Result<&'static str, LedgerApiError>. Wildcard arm now logs an error and returns Err(SystemTransactionError::UnknownError) for unrecognized SystemTransaction variants. Addresses Least Authority audit Issue AC.
…pe.md Co-authored-by: justinfrevert <81839854+justinfrevert@users.noreply.github.com>
79419e4 to
cfa202d
Compare
4 tasks
gilescope
pushed a commit
that referenced
this pull request
Apr 8, 2026
m2ux
added a commit
that referenced
this pull request
Apr 23, 2026
Signed-off-by: Mike Clay <mike.clay@shielded.io>
m2ux
added a commit
that referenced
this pull request
Apr 23, 2026
Signed-off-by: Mike Clay <mike.clay@shielded.io>
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
Reject unrecognized
SystemTransactionvariants with an explicit error instead of silently labeling them as "unknown" for metrics, closing an observability gap identified by the Least Authority audit.🎫 Ticket 📐 Engineering 🧪 Test Plan
Motivation
A security audit (Least Authority, Issue AC) identified that
get_system_tx_typein the ledger host function used a wildcard match arm (_ => "unknown") for unrecognizedSystemTransactionvariants. While the binary deserialization layer already prevents truly malformed transactions from reaching this code, the silent labeling creates an observability gap: if a newermidnight-ledgerintroduces a new variant, an older node build would quietly process it without any warning or error, making version mismatches invisible to operators.Changes
get_system_tx_type— Changed return type from&'static strtoResult<&'static str, LedgerApiError>. The wildcard arm now logs an error and returnsErr(SystemTransactionError::UnknownError)(code 204). Extracted fromimpl Bridge<S, D>to a standalone free function to enable direct unit testing (the generic bounds on the impl block prevented calling it from test modules).apply_system_transaction— Propagates the newResultvia?, rejecting unknown variants before processing.SystemTransactionvariants (7/8 known variants;OverwriteParametersrequires complexLedgerParametersconstruction). The wildcard path is untestable by design due to#[non_exhaustive].audit-handle-unsupported-system-transaction-type.md.📌 Submission Checklist
🔱 Fork Strategy
🗹 TODO before merging