Rule
openzeppelin-preconditions
Opt-in documented preconditions of authenticated OpenZeppelin Compact modules.
Specimen 37 of 96 · Policy-dependent rules
- Severity
- medium
- Confidence
- high
- Maturity
- experimental
- Selection
- Configured builtins
- Policy intent
- required
- Release
- v0.1.1
- Engine facts used
resolved-callscall-reachescomplete-caller-coveragebuiltin-policy
Selection and scope#
Selected when configuration declares the supported OpenZeppelin builtins. An explicit --detectors selection must also include it.
./.nightshade/node_modules/.bin/nightshade ./contracts --detectors openzeppelin-preconditions
./.nightshade/node_modules/.bin/nightshade detector show openzeppelin-preconditionsThe 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 |
|---|---|---|---|---|
| 6/6 | 6/6 | 6/6 | 0/0 | 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/openzeppelin-preconditions.md at v0.1.1.
Availability: opt-in built-in policies required through policies.builtins. An explicit detector selection must also include openzeppelin-preconditions. Severity medium, confidence high for the documented precondition evidence.
Checks authenticated OpenZeppelin Compact 0.4.0-alpha.3, revision ec1331cd8195694c747d291e8fc8ab6d2914a976, including resolved dependency hashes. It reports universally rejecting application calls with library assertion evidence, Ownable initialization outside construction, and Initializable import composition contrary to its documented top-layer/single-importer restriction.
Example and review scenario#
Enable any relevant names under policies.builtins: openzeppelin-ownable, openzeppelin-access-control, openzeppelin-pausable, or openzeppelin-initializable; see configuration.
For example, pausing twice can make the second call universally reject. Review the matched library contract and fix ordering, arguments, or initialization and import placement. One valid ordering is:
P__pause();
P__unpause();False positives and limitations#
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 openzeppelin-preconditions -- 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.