Skip to content

fix: reject duplicate recipient policy keys in BuildPolicyJson#48

Merged
rubenhensen merged 1 commit into
mainfrom
fix/reject-duplicate-policy-keys
Jul 24, 2026
Merged

fix: reject duplicate recipient policy keys in BuildPolicyJson#48
rubenhensen merged 1 commit into
mainfrom
fix/reject-duplicate-policy-keys

Conversation

@dobby-coder

@dobby-coder dobby-coder Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

SealPipeline.BuildPolicyJson keyed the policy dictionary by recipient email with policy[r.Email] = .... Two recipients that resolve to the same email collapsed to one key, so one silently overwrote the other and was dropped from the sealed policy.

This mirrors the duplicate-entry guard already in ZipHelper.CreateZip: on collision it now throws ArgumentException with nameof(recipients) as the parameter name instead of overwriting.

A regression test in BuildPolicyJsonTests covers two recipients colliding on the same email; it fails before the change and passes after.

Tests run on net10.0 (83 passed); net8.0 builds but its runtime is absent in the workspace, so CI covers that TFM.

Closes #47

Two recipients sharing an email collapsed to the same policy key and one
silently overwrote the other, dropping a recipient from the sealed policy.
Throw ArgumentException(nameof(recipients)) on collision, mirroring the
duplicate-entry guard in ZipHelper.CreateZip.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dobby-coder
dobby-coder Bot requested a review from rubenhensen July 23, 2026 23:34

@dobby-coder dobby-coder Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: approve

Rules Dobby 2 — sign-off (cycle 1)

Reviewed against the applicable rule set (conventional-commit PR title, Closes keyword, reviewer assignment) plus the correctness of the diff. No blocking or non-blocking findings.

  • SealPipeline.BuildPolicyJson now rejects a duplicate policy key with ArgumentException(nameof(recipients)) via Dictionary.TryAdd, mirroring the duplicate-entry guard documented for ZipHelper.CreateZip — instead of silently overwriting and dropping a recipient.
  • The throw reuses the existing nameof(recipients) param-name convention already present in the same method's unknown-base-type guard.
  • BuildPolicyJsonTests.DuplicatePolicyKey_Throws covers two recipients colliding on the same email and asserts ParamName == "recipients".
  • Title is conventional-commit compliant; Closes #47 links the issue; @rubenhensen is requested as reviewer.
  • Tests: 83/83 pass on net10.0; both TFMs build (net8.0 runtime absent in workspace by design — CI covers it).

No security advisory referenced — not embargoed.

@dobby-coder
dobby-coder Bot marked this pull request as ready for review July 23, 2026 23:39
@rubenhensen
rubenhensen merged commit f5ad9b8 into main Jul 24, 2026
2 checks passed
@rubenhensen
rubenhensen deleted the fix/reject-duplicate-policy-keys branch July 24, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BuildPolicyJson silently drops duplicate-email recipients

1 participant