Skip to content

fix(security): bind sealed secrets to their target, verify peer re-wraps, drop deleted regions' keys, TLS-only agent server URL - #840

Merged
fclairamb merged 32 commits into
mainfrom
security/scan-specs-2026-11-11
Nov 11, 2026
Merged

fclairamb merged 32 commits into
mainfrom
security/scan-specs-2026-11-11

Conversation

@fclairamb

@fclairamb fclairamb commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Security scan of 2026-11-11 on the browser-sealed check secrets (#834, #835): all four findings are implemented.

What changed

  • AJ1 (Medium): a sealed blob is bound to the check's type and target fields (_binding, shared Go/TS digest fixture). The agent refuses a retargeted check or a blob overriding a public field. The server answers 409 SEALED_TARGET_CHANGED on PATCH, apply and import. dash0 reopens the secret inputs on a target edit. Legacy unbound blobs are accepted with a warning and listed on the Re-seal page.
  • AJ2 (Medium): peer re-wrap now needs a possession challenge, only secret-field keys in a sealed plaintext, and a confirmation by a second recipient (rewrap_verify); without a second agent online the blob is stored flagged unconfirmed. Duplicate agent keys are refused at enrollment. Retired region keys are kept (public part only).
  • AJ3 (Low): deleting a private region removes its shared region key; orphaned keys are no longer returned.
  • AJ4 (Low): an agent refuses a non-TLS server URL outside loopback unless SP_AGENT_ALLOW_INSECURE_SERVER=true, which also turns re-wrap off by default.
  • Batch gate fix: the duplicate-key check still sees keys of deleted regions.

Breaking: solidping seal now requires --type and --config-json; agents older than 0.48 are not picked for re-wrap; an http:// agent URL to a non-loopback host no longer starts; editing a target field of a sealed check requires the secrets again. client_generated.go not regenerated (per-batch convention).

Decided by autopilot

  • Spec 01, unbound legacy blobs: accept with a warning and list them on the Re-seal page; refuse them in the next minor (recommended answer).

Gate: build, lint, make test, dash0 typecheck/lint, Playwright 1011 passed / 0 failed / 15 skipped (SQLite side-car).

🤖 Generated with Claude Code

@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.90521% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.31%. Comparing base (4bb06f7) to head (c207608).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
server/internal/rewraptask/verify.go 87.09% 16 Missing ⚠️
server/internal/handlers/agents/region_keys.go 84.00% 4 Missing ⚠️
server/internal/handlers/agentws/handler.go 88.88% 3 Missing ⚠️
server/internal/handlers/checks/browser_sealing.go 90.32% 3 Missing ⚠️
server/pkg/cli/seal.go 96.66% 3 Missing ⚠️
server/internal/crypto/credentials/sealing.go 92.00% 2 Missing ⚠️
server/internal/handlers/agents/service.go 66.66% 2 Missing ⚠️
server/internal/rewraptask/server.go 96.87% 2 Missing ⚠️
server/internal/sealing/sealing.go 96.96% 2 Missing ⚠️
server/internal/config/config.go 96.66% 1 Missing ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #840      +/-   ##
==========================================
+ Coverage   89.26%   89.31%   +0.05%     
==========================================
  Files        1346     1351       +5     
  Lines      137974   138731     +757     
==========================================
+ Hits       123164   123914     +750     
- Misses      14801    14808       +7     
  Partials        9        9              
Files with missing lines Coverage Δ
server/internal/agentmode/agentmode.go 83.19% <100.00%> (+1.61%) ⬆️
...internal/checkers/checkclickhouse/config/config.go 92.00% <ø> (ø)
...l/checkers/checkclickhouse/config/secret_fields.go 100.00% <100.00%> (ø)
...internal/checkers/checkftp/config/secret_fields.go 100.00% <100.00%> (ø)
...erver/internal/checkers/checkgrpc/config/config.go 94.87% <100.00%> (+0.04%) ⬆️
...erver/internal/checkers/checkhttp/config/config.go 97.42% <100.00%> (+<0.01%) ⬆️
...nternal/checkers/checkimap/config/secret_fields.go 100.00% <100.00%> (ø)
server/internal/checkers/checkjs/config/config.go 91.20% <100.00%> (+0.07%) ⬆️
...ternal/checkers/checkkafka/config/secret_fields.go 100.00% <100.00%> (ø)
...rnal/checkers/checkmongodb/config/secret_fields.go 100.00% <100.00%> (ø)
... and 43 more

... and 23 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

fclairamb and others added 17 commits November 11, 2026 08:15
The sealed plaintext now carries a reserved _binding object: the check type
and a SHA-256 digest of the type's target fields (url, host, port,
database, tunnel...). The agent recomputes the digest from the job's config
and refuses a blob sealed for another target, or one carrying a key that is
not a secret field of the type. The server answers 409 SEALED_TARGET_CHANGED
when a PATCH, an import or an apply moves the target of a browser-sealed
check without new secrets. solidping seal now requires --type and
--config-json. Legacy unbound browser blobs still run, with a warning, and
are listed on the Re-seal page (reason unbound).

Spec: specs/todos/2026-11-11-01-bind-sealed-secrets-to-check-target.md

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The check form seals a _binding (type and target digest) next to the
secrets, opens the secret inputs when a target field of a sealed check
changes, and refuses to save the new target without them. The Re-seal page
lists unbound blobs. Docs: binding, threat model, solidping seal flags.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A re-wrap now carries a random challenge sealed to the one key the agent was
picked for (its own, or a region key, current or retired); the server keeps
only its hash and refuses a result without it. A passed result is sent to a
second online agent holding a current key (rewrap_verify task), which opens
it, checks it carries only secret fields of the type (and the old plaintext
when it can open the old blob) before the swap. With no second holder, the
blob is stored marked unconfirmed and the check stays flagged (Re-seal page
reason 'unconfirmed', outcome code not_confirmed). The re-wrap executor also
refuses a plaintext that is not only secret fields (REWRAP_NOT_SECRET).
Rotated or removed region keys are kept in sealing.retired_region_keys.

Spec 2026-11-11-02.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…on key

An X25519 key equal to another live agent's key, or to a region key of the
org (current or retired), is refused with an error frame before the token is
consumed: an agent that registers a copied public key would be picked for
blobs it cannot open (spec 2026-11-11-02).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…challenge

The Re-seal page lists a check re-sealed without a second agent's
confirmation (reason unconfirmed), the re-seal button reports it apart from
the done ones, and the new refusal codes have their messages. The location
page counts unconfirmed blobs as needing a re-seal. Only agents that run the
confirmation (0.48+) are picked to re-wrap, since older ones cannot answer
the challenge. The peer re-wrap E2E now runs a second agent to confirm.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
BindingCheckFor moves to configregistry so the sp CLI (which links
rewraptask) never links a checker implementation. The peer re-wrap E2E passes
--type and --config-json to solidping seal, required since the target
binding. Unit tests for the challenge and the unconfirmed flag.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… its own word, and its result is stored unchecked

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deleting a private region now drops and retires its shared region key
(audit region_key_removed, reason region_deleted). RegionKeys ignores
keys of regions that do not exist, and creating a region clears any stale
key for its slug.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ared region key behind

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…CURE_SERVER

With the override, a warning is logged at every start and peer re-wrap is off unless SP_AGENT_REWRAP_ENABLED=true.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Comment thread server/internal/sealing/sealing.go Fixed
Comment thread server/internal/sealing/sealing.go Fixed
fclairamb and others added 3 commits November 11, 2026 09:36
… allocation may overflow'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Comment thread server/internal/sealing/sealing.go Fixed
Comment thread server/internal/sealing/sealing.go Fixed
@fclairamb fclairamb added the frozen Batch PR under review: takes only its own fixes, new work goes to the next batch label Nov 11, 2026
@fclairamb

Copy link
Copy Markdown
Owner Author

autopilot: merged main in (one e2e spec conflict, both tests kept). CodeQL alerts 126/127 (allocation size overflow in KnownRegionRecipients): the overflow guard wasn't recognised, so I dropped the computed map capacity hint; threads resolved.

@fclairamb

Copy link
Copy Markdown
Owner Author

autopilot: merged main in (behind). The two go/allocation-size-overflow alerts (126, 127) are on an older commit; dc84ba9 already dropped the computed capacity hint, so they should clear at the next analysis.

@fclairamb

Copy link
Copy Markdown
Owner Author

autopilot: added tests for the uncovered lines (rewraptask, credentials, sealing, cli seal, region keys, agentmode, configregistry); ~92.7% patch coverage measured locally vs 87% target.

@fclairamb
fclairamb enabled auto-merge (squash) November 11, 2026 21:37
@fclairamb
fclairamb merged commit 4b70e46 into main Nov 11, 2026
35 checks passed
@fclairamb
fclairamb deleted the security/scan-specs-2026-11-11 branch November 11, 2026 21:48
fclairamb added a commit that referenced this pull request Nov 12, 2026
…eplay masking of remaining secret inputs, rewrap list cap, secret headers on redirects (#851)

Specs from the security scan of 2026-11-12. All five specs are
implemented and archived; each has a regression test plus a positive
control. Batch gate green (build, lint, Go tests, dash0 typecheck, lint,
unit tests; Playwright not run, no E2E touched).

| Spec | Severity | Finding | What it fixes |
|---|---|---|---|
| `specs/todos/2026-11-12-02-bind-js-env-and-plugin-configs.md` | Medium
| AK2 | The target binding of browser-sealed secrets also covers a JS
check's `env`, and every key of a plugin type (#840 bypass, unreleased).
|
|
`specs/todos/2026-11-12-03-rewrap-strict-keys-for-server-sealed-blobs.md`
| Medium | AK3 | A peer re-wrap refuses non-secret keys for
server-sealed blobs too, and agent-produced blobs are checked at claim.
|
| `specs/todos/2026-11-12-04-replay-masking-remaining-secret-inputs.md`
| Medium | AK4 | The kubeconfig, webhook URL and revealed
provider-secret inputs are kept out of the dash0 session replay. |
| `specs/todos/2026-11-12-05-cap-rewrap-check-list.md` | Low | AK5 | The
sealing re-wrap endpoints cap and dedup their check list. |
| `specs/todos/2026-11-12-06-http-secret-headers-cross-host-redirect.md`
| Low | AK6 | HTTP checks stop resending secret headers to another host
on a redirect. |

🤖 Generated with [Claude Code](https://claude.com/claude-code)


## Decided by autopilot
- No open questions in the specs. Spec 05: the repo's validation error
is 422, not the 400 the spec says. `CHANGELOG.md` left to release-please
(notes are in commit bodies).
- Breaking for existing data: browser-sealed JS checks with a non-empty
`env` and plugin checks sealed earlier must be sealed again (Re-seal
page lists them).
- Unrelated flake fixed in the gate: discord gateway fake double close.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
fclairamb added a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.48.0](v0.47.0...v0.48.0)
(2026-11-12)


### Features

* lease sizing, Telegram sign-in and four small fixes (2026-11-11
issues) ([#848](#848))
([9972dde](9972dde))
* **notifications:** SMS Factor integration
([#846](#846))
([1b68d2a](1b68d2a))


### Bug Fixes

* **deps:** update github.com/dop251/goja digest to f493a2b
([#842](#842))
([dba208b](dba208b))
* **deps:** update go dependencies (non-major)
([#844](#844))
([621d492](621d492))
* **deps:** update go dependencies (non-major)
([#847](#847))
([4bb06f7](4bb06f7))
* **security:** bind JS env and plugin configs, strict re-wrap keys,
replay masking of remaining secret inputs, rewrap list cap, secret
headers on redirects
([#851](#851))
([32fd560](32fd560))
* **security:** bind sealed secrets to their target, verify peer
re-wraps, drop deleted regions' keys, TLS-only agent server URL
([#840](#840))
([4b70e46](4b70e46))
* **security:** keep shown-once secrets out of dash0 session replay
([#839](#839))
([9bb8e8b](9bb8e8b))
* **security:** require a verified email for GitLab sign-in and stop
linking existing accounts by email
([#850](#850))
([1a0cea9](1a0cea9))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge autopilot frozen Batch PR under review: takes only its own fixes, new work goes to the next batch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants