Add router-side blacklist-guard fail-closed unit test (#456) #1001
No reviewers
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic!1001
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "qa/456-router-blacklist-guard-test"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up on #456 (SEC-I03 F02, closed). The blacklist guard is default-deny in both the pair and the router now, but only the pair side had a test for the fail-closed arm (
factory_blacklist_query_error_blocks_swap). The router'sassert_router_swap_not_blacklistedErr(_) => BlacklistGuardUnavailablebranch had no coverage — the existingrouter_multihop_rejects_blacklisted_walletonly exercises the healthy-factoryblocked=truepath.This adds a mock-querier unit test for the router: the factory answers the
Pairquery (which the router does first) but errors onBlacklistCheck, and the guard must reject withBlacklistGuardUnavailable. Plus healthy and blacklisted control cases.Test-only, no behavior change. Router suite 3/3, fmt + clippy clean. Confirmed the fail-closed test fails against a fail-open guard before landing it (pre-fix proof).
mentioned in issue #456
mentioned in commit
14e53a7915Security review — MR !1001
Commit reviewed:
30ab853c32a3e22d6e0eac798b8c261eaaf50d59(merge:14e53a7915d86585b322417388f580d493c324b1)Scope: Added
#[cfg(test)]unit tests insmartcontracts/contracts/router/src/blacklist_guard.rs— mock-querier coverage forassert_router_swap_not_blacklistedfail-closed (BlacklistGuardUnavailable), healthy-allow, and blacklisted-deny paths. No production/router wasm logic changes.Method: Diff review; traced attacker-controlled inputs to sinks in modified code only; confirmed
mod testsis excluded from release/wasm builds.Outcome:
FINDINGS: 0medium+Inline threads: none (no findings to anchor)
Security review: no medium+ findings on this diff. Test-only change strengthens regression coverage for SEC-I03 F02 default-deny blacklist guard behavior already enforced in production code (
Err(_) => BlacklistGuardUnavailableat lines 67–70). No new injection surfaces, authz boundaries, secret exposure, dependency changes, or deployable attack paths introduced.