feat(detectors): add admin_event_missing detector (Detectors wave 3) - #863
Open
playmaker410 wants to merge 2 commits into
Open
feat(detectors): add admin_event_missing detector (Detectors wave 3)#863playmaker410 wants to merge 2 commits into
playmaker410 wants to merge 2 commits into
Conversation
Contributor
|
@playmaker410, resolve conflicts please |
playmaker410
force-pushed
the
feat/detector-admin-event-missing
branch
from
July 27, 2026 14:32
8c45d55 to
3850eb2
Compare
Contributor
|
@playmaker410, please resolve conflicts |
Adds SANCT_ADMIN_EVENT_MISSING static-analysis detector that flags admin/config-change functions which mutate Soroban storage without emitting a corresponding on-chain event. Privileged config changes that emit no event are invisible to monitors and audits. This detector makes them visible. Acceptance criteria met: - Flags admin/config mutations lacking an event emit - No FP when an event is emitted (env.events().publish / emit / log) - Follows the rule pattern in tooling/sanctifier-core/src/rules/ - Insta golden snapshot committed (3 violations from fixture) - All CI tests pass (258 tests, 0 failures) Files changed: - src/finding_codes.rs: add SANCT_ADMIN_EVENT_MISSING constant + FindingCode entry - src/rules/admin_event_missing.rs: full Rule implementation with syn visitor - src/rules/mod.rs: register module and rule in with_default_rules() - tests/detector_snapshots.rs: wire snapshot_admin_event_missing test - tests/fixtures/detectors/admin_event_missing.rs: fixture with 3 violations, 3 clean cases, 1 suppressed, 1 test-module exclusion - tests/snapshots/detector_snapshots__admin_event_missing.snap: golden snapshot - tests/fixtures/corpus/differential-corpus.json: wire SANCT_ADMIN_EVENT_MISSING into rule-to-code map and update upgrade_auth observed_codes - tests/fixtures/gallery/upgrade_auth_fixed.rs: add event emit to fixed gallery fixture - tests/snapshots/gallery_snapshots__upgrade_auth_vulnerable.snap: update snapshot for new detector - docs/detectors/admin_event_missing.md: documentation page - docs/detectors/README.md: add table row Suppression: sanctifier:ignore[SANCT_ADMIN_EVENT_MISSING]
playmaker410
force-pushed
the
feat/detector-admin-event-missing
branch
from
July 29, 2026 09:53
3850eb2 to
b9c84a2
Compare
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
Closes #789
Adds the
admin_event_missingstatic-analysis detector (finding codeSANCT_ADMIN_EVENT_MISSING) as part of the Detectors wave 3 epic.Privileged config changes that emit no event are invisible to monitors and audits. This detector makes them visible.
Acceptance Criteria
env.events().publish,emit,log)tooling/sanctifier-core/src/rules/Detection Logic
Flags any
#[contractimpl]function whose name contains an admin/config-change keyword (set_,update_,change_,configure,pause,unpause,upgrade,transfer_admin,set_admin,set_owner,migrate) that:.set/.update/.removeon.persistent()/.instance()/.temporary()).events().publish(…)orpublish/emit/logmethod call)Suppression:
// sanctifier:ignore[SANCT_ADMIN_EVENT_MISSING]Files Changed
src/finding_codes.rsSANCT_ADMIN_EVENT_MISSINGconstant +FindingCodeentrysrc/rules/admin_event_missing.rssrc/rules/mod.rswith_default_rules()tests/detector_snapshots.rssnapshot_admin_event_missingtesttests/fixtures/detectors/admin_event_missing.rstests/snapshots/detector_snapshots__admin_event_missing.snaptests/fixtures/corpus/differential-corpus.jsontests/fixtures/gallery/upgrade_auth_fixed.rstests/snapshots/gallery_snapshots__upgrade_auth_vulnerable.snapdocs/detectors/admin_event_missing.mddocs/detectors/README.mdTesting