# secret-binding-divergence-review

> Same-key ledger writers enforce different domain-qualified secret-binding declaration families.

Canonical: https://nightshade.dicksonwu.xyz/rules/secret-binding-divergence-review.html
Release: Nightshade 0.1.1 (v0.1.1)

| Field | Value |
| --- | --- |
| Rule ID | `secret-binding-divergence-review` |
| Severity | info |
| Confidence | varies |
| Maturity | experimental |
| Selection | Opt-in |
| Policy intent | not required |
| Default enabled | no |
| Category | Other active opt-ins / Privacy and cryptographic derivations |
| Engine facts used | secret-binding-histories, successful-predicates, digest-inputs, state-writes, completed-entries |
| 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 secret-binding-divergence-review
./.nightshade/node_modules/.bin/nightshade detector show secret-binding-divergence-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 |
| ---: | ---: | ---: | ---: | ---: |
| 7/7 | 2/2 | 2/3 | 9/9 | 0 |

Deviations recorded for this rule:

| Case | Kind | Expected to observed lines | Issue |
| --- | --- | --- | --- |
| manifest.json / secretBindingDivergence49/drafts/secret-binding49/controls/intentional-weaker-same-key.compact | lookalike | [18] to [18] | control hit |

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/secret-binding-divergence-review.md at v0.1.1.

Availability: **opt-in** with `--detectors secret-binding-divergence-review`.
Findings are informational source comparisons requiring intent review.

The rule compares exported numeric Map mutation occurrences on the same canonical
ledger declaration. One writer already binds its affected exact key to an unchanged
pre-existing record through a private, constant-domain-qualified native hash
preimage. A completed sibling writer binds its own affected key to that binding
family and an additional family with a different canonical witness declaration,
constant domain recipe and trusted ledger declaration. Every successful sibling
history must contain an occurrence enforcing both families at its own exact key.
One sibling is enough for a comparison; no majority premise applies.

These are declaration-family descriptors, not equality of private inputs, witness
results or account values across entries. Each key equality is established only
inside its original history: ordinary Map transfer derives the recorded storage
path from the exact immutable lookup/insertion operand. The selected transfer meters
that derivation and its retained encodings. Wildcard paths never establish equality.
The matcher compares these exact operand encodings within the history, admitting
direct, transitive and late atomic key equality only through required successful
predicates. Optional and unequal-key predicates do not supply that equality. It
compares only declaration-family descriptors between writers.

The required equality graph does not rebuild different compound key encodings or
derive function congruence from equal arithmetic/native inputs. Different derived
or compound operand encodings without a graph-proved whole-operand equality produce
explicit incomplete coverage. Identical exact encodings remain admissible; a shared
wildcard path never does. This conservative boundary prevents a discarded additional
binding from becoming a false missing-binding review.
Scalar-source classification uses the canonical represented declaration type,
including when the interpreter leaves a large aggregate unexpanded. Missing runtime
`items`/`fields` metadata cannot turn an opaque compound key into a scalar key.

The admitted hash recipe contains one raw scalar `Bytes<32>` witness input and
fully represented constant components, using canonical `persistentHash`. The
descriptor retains its primitive, input type and constant recipe. Published or
publicly fixed preimages, transformed inputs, incomplete recipes, changed trusted
record revisions and different effect keys cannot supply this relation. Boolean
alternatives contribute only their required intersections. A late binding against
an unchanged exact pre-existing record remains a constraint on atomic successful
completion; its position does not manufacture a missing binding.

The comparison concerns a mutation occurrence. Subsequent writes to another balance
key do not erase an earlier occurrence. Trusted authentication-record revisions
must remain unchanged at the compared effect and assertion. Enrollment without a
base authentication binding is outside this review, as are List effects and inferred
account groupings across different ledger declarations.

Reachable canonical kernel checkpoints, including those in helpers or callbacks,
produce explicit incomplete coverage during the selected metered callable walk.
Committed-prefix semantics are outside this initial atomic-history review; an
application circuit merely named `checkpoint` does not trigger that refusal.

Selected preparation, ordinary execution, retained capture, identity traversal,
matching and finding construction share the production limits: 40,000 steps per
entry, 256 paths per entry and 50,000 cumulative abstract values per rule. Missing,
unfinished or refused evidence produces diagnostics and incomplete rule coverage;
there is no retry or quiet result from a truncated sibling inventory.

The rule does not compare authentication strength or infer required policy,
feasibility, exploitability, cryptographic independence or application impact.
An intentionally different writer with this executable relationship still matches.
This rule remains opt-in because its intent-dependent matches require independent
review.

## 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 secret-binding-divergence-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/secret-binding-divergence-review.md)
- [Catalog entry in rules.json](https://nightshade.dicksonwu.xyz/rules.json)
- [All rules](https://nightshade.dicksonwu.xyz/rules.md#privacy-and-cryptographic-derivations)
- [Limitations](https://nightshade.dicksonwu.xyz/limitations.md)
