Rule
source-claim-map-getter-review
An explicitly documented configured Map getter returns only default without reading the selected Map.
Specimen 39 of 96 · Policy-dependent rules
- Severity
- info
- Confidence
- varies
- Maturity
- experimental
- Selection
- Opt-in + policy
- Policy intent
- required
- Release
- v0.1.1
- Engine facts used
explicit-source-map-getter-policyparser-owned-adjacent-commentcomplete-original-setter-getter-historiescomplete-getter-source-closure
Selection and scope#
Not selected by default. Select it with --detectors or the detectors list in nightshade.json, and declare the matching application intent in policies. Selecting it alone does not supply that intent.
./.nightshade/node_modules/.bin/nightshade ./contracts --detectors source-claim-map-getter-review
./.nightshade/node_modules/.bin/nightshade detector show source-claim-map-getter-reviewThe first command runs only this rule; --detectors takes a comma-separated list. The second prints the rule's metadata from your installed version.
Severity is review priority. It does not express exploitability or impact. Confidence is detector metadata, not a probability. All built-in rules are experimental.
Compiler scope: the engine supports the pinned profiles 0.28.0, 0.29.0, 0.30.0, 0.31.1, 0.33.0-rc.2, 0.34.0, 0.35.0-rc.1 and 0.35.0, with ZKIR2 by default. Support for this rule can be narrower; the rule documentation below states any narrower scope.
Corpus checks#
Synthetic corpus checks for this rule in the 0.1.1 proof run. A check counts only with compiler acceptance and complete analysis.
| Positive detected | Corrected quiet | Lookalike quiet | Other negative quiet | Incomplete |
|---|---|---|---|---|
| 4/4 | 2/2 | 2/2 | 10/10 | 0 |
No deviations were recorded for this rule.
These are behavior checks on synthetic fixtures, not a precision or recall estimate. See evaluation.
Rule documentation#
From docs/detectors/source-claim-map-getter-review.md at v0.1.1.
Availability: opt-in, policy-required; severity info. Select --detectors source-claim-map-getter-review and supply policies.sourceMapGetters:
{
"sourceMapGetters": [{
"setter": "setAdmin", "getter": "getRoleAdmin", "map": "roleAdmin",
"setterKey": "role", "setterValue": "admin", "getterKey": "role",
"quote": "// Documentation claims DEFAULT_ADMIN_ROLE is customizable by roleAdmin entry."
}]
}An outdated or overbroad documentation quote can produce an intentional policy mismatch. Verify that the quoted claim is current and that the setter/getter selectors reflect the actual API before changing code; the rule checks the configured claim and does not infer user expectations.
This explicit contract says the getter should reflect the selected Map value configured by the setter for the same key. The analyzer does not infer this meaning from names or prose. Circuit/Map selectors resolve to unique active canonical symbols; parameter selectors are ordinary original names or canonical parameter IDs. Key and value types must agree exactly with the native Map and getter result, retaining nominal identities.
Activation requires one complete parser-owned comment, including delimiters, exactly equal to the quote and immediately preceding the exported setter, with only whitespace between them. Removing the quote and the obsolete setter/Map is quiet. An exact quote remaining with missing or ambiguous setter identity is an invalid/incomplete observation. A different quote or nonadjacent comment is not-applicable. Existing sourceClaims policies retain their original semantics.
A finding requires complete original successful setter histories with a surviving root-Map insertion of the selected original key/value operands, and complete getter histories returning the same exact default constant. The complete resolved getter source closure must have no read of this Map, including helpers, imports, lambdas and syntactically present zero-iteration callbacks. Unsupported external calls, unresolved effects, checkpoints, unavailable history identity or exhausted allowances produce rule-scoped incomplete diagnostics.
Experimental Counter mode lacks the selected original setter/getter histories. Selecting this rule with a configured contract in that mode returns incomplete coverage and a diagnostic.
Preparation, execution, matching and finding retention share the unchanged 40,000-step per-entry and 50,000-value cumulative rule allowance; histories are limited to 256. This source/API contract review does not execute a setter followed by a getter, infer cross-transaction feasibility, or establish deployed behavior or impact. Findings are informational and require the supplied contract.
Suppress a match#
If a match is intentional, suppress it on the line before with the exact rule ID and a reason of at least eight characters:
// nightshade-disable-next-line source-claim-map-getter-review -- Reason this match is intentionalDiagnostics cannot be suppressed, and an unmatched directive for a selected rule makes analysis incomplete. See configuration for fingerprint suppressions and baselines.