# caller-key-zero-entry-review

> Review a surviving zero numeric Map insertion at a direct caller key without required initial same-key membership.

Canonical: https://nightshade.dicksonwu.xyz/rules/caller-key-zero-entry-review.html
Release: Nightshade 0.1.1 (v0.1.1)

| Field | Value |
| --- | --- |
| Rule ID | `caller-key-zero-entry-review` |
| Severity | info |
| Confidence | high |
| Maturity | experimental |
| Selection | Opt-in |
| Policy intent | not required |
| Default enabled | no |
| Category | Other active opt-ins / Authorization, identity and membership |
| Engine facts used | entry-zero-history, exact-map-preconditions, all-successful-predicates, ordered-writes |
| Release | v0.1.1 |

## Selection and scope

Not selected by default. Select it with `--detectors` or the `detectors` list in nightshade.json. Either one replaces profile selection, so list every rule you want.

```sh
./.nightshade/node_modules/.bin/nightshade ./contracts --detectors caller-key-zero-entry-review
./.nightshade/node_modules/.bin/nightshade detector show caller-key-zero-entry-review
```

The 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 |
| ---: | ---: | ---: | ---: | ---: |
| 2/2 | 2/2 | 2/2 | 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](https://nightshade.dicksonwu.xyz/evaluation.md#synthetic-corpus).

## Rule documentation

From https://github.com/DicksonWu654/nightshade/blob/v0.1.1/docs/detectors/caller-key-zero-entry-review.md at v0.1.1.

Availability: **opt-in**; no policy required. Severity: **info**. Confidence:
**high** for the supported static source relationship.

Select with `--detectors caller-key-zero-entry-review`. The observer fixes an
actual numeric entry parameter to zero and preserves other inputs and helper
arguments. APIs inserting literal zero use complete ordinary histories and need
no fabricated amount parameter. It reports a numeric `Map<Bytes<32>, ...>.insert` whose amount retains an unchanged entry-input identity or is literal zero,
and whose key retains an unchanged entry-input identity, when the write survives a modeled full
successful invocation without required initial membership at that exact key or
an enforced finite literal key domain. One qualifying successful history suffices;
other zero histories may perform no insertion.

Required same-key initial membership excludes existing-only updates. Unrelated
may-alias keys do not establish equal entries. Literal key domains, fixed-key
writes, transformed amounts, positive guards, and writes later removed, reset or
overwritten are quiet. A later overlapping write withholds survival evidence
unless its exact ordered insert/remove operation addresses the same Map with an
immutable key required distinct on that same successful history. Possible Boolean
alternatives, wildcard addresses, ancestor resets and unproven aliases supply no
disequality proof. Withheld survival evidence does not claim the write was
necessarily removed.

Exact collection/query revisions and ordered write positions are shared with
`zero-amount-initial-membership`. Ordinary scans are unchanged. Missing exact
facts, unqualified no-zero-success cases, reached checkpoints and exhausted
budgets produce rule diagnostics. Direct nonzero entry guards are a narrow
qualified rejection boundary; other zero-path failures remain unavailable.

An API that intentionally creates a zero-valued entry can match. Review whether
the application requires an existing key or a positive amount before treating
the finding as a defect; the rule does not infer that policy.

## 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:

```compact
// nightshade-disable-next-line caller-key-zero-entry-review -- Reason this match is intentional
```

Diagnostics cannot be suppressed, and an unmatched directive for a selected rule makes analysis incomplete. See [configuration](https://nightshade.dicksonwu.xyz/configuration.md#suppress-an-intentional-match) for fingerprint suppressions and baselines.

## References

- [Rule source document at v0.1.1](https://github.com/DicksonWu654/nightshade/blob/v0.1.1/docs/detectors/caller-key-zero-entry-review.md)
- [Catalog entry in rules.json](https://nightshade.dicksonwu.xyz/rules.json)
- [All rules](https://nightshade.dicksonwu.xyz/rules.md#authorization-identity-and-membership)
- [Limitations](https://nightshade.dicksonwu.xyz/limitations.md)
