oliver-zehentleitner / maity
hub: seal the remaining plain verifiers, then refuse plain ones (follow-up to #1789)
tsk-ebc2fhdxttm7 Done Maity Coder Claude 002
Follow-up to #1789 (tsk-d9r02hn5n32y), which seals credential verifiers with the instance key.
Rows that are still plain after the sealing migration stay as they are today. This card finishes the job:
- an operator command (e.g.
maity-hub seal-verifiers) that seals every plain row when the key is set, idempotent, with a count; - a setting that, once every row is sealed, refuses plain rows instead of accepting them;
- docs for operators: run it after adding the key, and after a rolling deploy;
- tests for a mixed table, a key added later and the refuse setting.
Details are with the lead.
Notes
Lotse · Nov 17, 2026, 20:03 UTC
#1935 description of record for head 693e90fc9c27676a9aafc50b76120cd5b2fa3dc6, part 1 of 2 (from k5ax 155013; the GitHub body is older):
Card: tsk-ebc2fhdxttm7 (hub: seal the remaining plain verifiers, then refuse plain ones; follow-up to #1789 and #1840). Plan approved by the lead lotse (seq 152522, confirmed seq 153623). Head
693e90fc9c27676a9aafc50b76120cd5b2fa3dc6on mainfd461be6.What is in
- `maity-hub seal-verifiers` (
hub/src/maity_hub/cli.py_seal_verifiers,auth/verifiers.pycount,seal_and_count,Counted): - prints
sealed N, already sealed M, plain left Kper table (credential,runner_credential) and astotal. N = rows this run sealed, M = rows sealed before it, K = plain rows after it. Revoked rows count too, because the command seals them; - exits 1 when K > 0 after a real run, which means a plain row was written meanwhile (an old pod during a rolling deploy);
--dry-runonly counts, writes nothing, and needs neitherMAITY_SEAL_VERIFIERSnor the key. A real run still refuses (exit 2) without both.- `MAITY_SEALED_VERIFIERS_ONLY` (
config.pyparse_sealed_verifiers_only, default off): - it is a
ConfigErrorwithoutMAITY_SEAL_VERIFIERS=1(and so without the key); app.check_startuprefuses the start while a live plain verifier is left, naming the count andmaity-hub seal-verifiers. The startup log count stays;- at runtime,
verifiers.accepted(used byauth/caller.py_verifier) returns None for a plain row. That is the answer a sealed row the key does not open gets today: 401unauthenticatedon bearer, 401signature_invalidon signed, for agents and runners. There is no new error detail; - the leak check keeps reading plain rows (
usable), so a leaked plain credential is still revoked; - it is listed in
settings_overview.pyand in hub/README's Configuration table. - Reseal on use: with sealing on, a plain row that verified a call is sealed in that call's existing
last_used_atupdate (_agent,_runner). It is guarded byCASE verifier WHEN <plain read>, so a credential replaced meanwhile keeps its value, and it adds no statement. Not covered: an isolated agent's calls, which write nothing, and idle credentials. - Helm:
secretKey.sealedVerifiersOnly, defaultfalse. It is in the schema and values, rendersMAITY_SEALED_VERIFIERS_ONLY=1for the hub and the migrate Job, and the chart refuses it withoutsecretKey.sealVerifiers.check.shhas cases for the default, the rendering and the refusal. - Docs:
docs/api.md§2.2;docs/install/README.md"Backups", with the operator order: key and sealing on,seal-verifiersafter that and after every rolling deploy untilplain left 0, then sealed-only in a rollout of its own, plus the rollback;- hub/README, the chart README and values;
changelog.d/agent-c-k5ax-sealed-only.md, with the operator note the release author uses for the upgrade page.- Keep the Why:
hub/context/credentials.md, entry0ce47fbe-77f9-4576-8e20-bb7f4d2a4ff2, is extended. It records the gate, reseal on use, the signed-path answer, that the leak check reads plain rows, and five more rejected alternatives. The index line is updated. It is in its own commit, 6c04ee04.
Prod: both switches are off by default everywhere, Helm included, so an upgrade turns nothing on. Switching on
MAITY_SEAL_VERIFIERS=1, and laterMAITY_SEALED_VERIFIERS_ONLY=1, is Oliver's decision after a deploy. Neither is part of this PR.- `maity-hub seal-verifiers` (
Lotse · Nov 17, 2026, 20:03 UTC
#1935 description of record for head 693e90fc9c27676a9aafc50b76120cd5b2fa3dc6, part 2 of 2 (from k5ax 155013; the GitHub body is older):
Tests added
hub/tests/test_sealed_verifiers.py:- a mixed table (sealed, plain, revoked plain, plain runner): the dry run counts and writes nothing; the run seals them all and a second run seals none;
- a key added later: plain rows are resealed by their first call with sealing on, for agent and runner;
- reseal leaves a row replaced meanwhile alone;
- sealed-only refuses plain rows at runtime (bearer, signed, runner) with the bodies an unopenable sealed row gets, and lets sealed rows through;
- sealed-only refuses the start with a live plain row, but not with only a revoked one after sealing;
- sealed-only still revokes a leaked plain credential.
- One existing test now calls with sealing off, so that reseal on use does not change what it counts.
hub/tests/test_cli.py: the new output, the dry run (with no key, and with sealing on), and exit 1 with a plain row left.hub/tests/test_config.py: the new setting's default, its dependency onMAITY_SEAL_VERIFIERSand its parsing.
How it was verified
Size, from
git diff origin/main...HEAD | grep -E '^[+-]' | grep -vE '^(\+\+\+|---) 'on head 693e90fc: 597 lines added, 51 removed, in 20 files (git diff --stat origin/main...HEAD:20 files changed, 597 insertions(+), 51 deletions(-)).Ran locally on head 6c04ee04:
$ python3 tools/changelog.py check changelog.d: 24 fragment(s), all valid $ ktw-lint hub ktw-lint 0.20.3.1: 0 error(s), 0 warning(s) (context-schema 0.20.3, context: context/)Ran locally on head 693e90fc, from the clone root:
$ make -C hub lint PYTHON=.venv/bin/python .venv/bin/python -m black --check src tests scripts hatch_build.py All done! 828 files would be left unchanged. .venv/bin/python -m ruff check src tests scripts hatch_build.py All checks passed! $ make -C hub typecheck PYTHON=.venv/bin/python .venv/bin/python -m mypy Success: no issues found in 828 source filespytest on SQLite, each file run alone:
hub/tests/test_sealed_verifiers.py: 17 passed;hub/tests/test_cli.py: 61 passed, 1 skipped;hub/tests/test_config.py: 21 passed;hub/tests/test_auth_agent.py: 53 passed, 4 skipped;hub/tests/test_runners.py: 42 passed;hub/tests/test_signing.py: 17 passed.
Not run locally
CI on 693e90fc covers these. Not run here:
- pytest on PostgreSQL:
scripts/with_postgres.shstops becausetools/run_slot.shcannot write its lock under~/.local/state/maity/run-slots, which is read-only in the agent sandbox. Reported to the runner owner; - pytest on MariaDB;
- the contract tests;
tools/guards.sh: the sandbox shows placeholder files in the tree, so its clean-tree check fails before any guard runs;deploy/helm/check.sh:helmis not installed;- the counter-checks of the new tests (CONTRIBUTING, evidence rules). They are still owed.
Known risks in the new tests. Both hold on SQLite (
test_sealed_verifiers.pypasses); PostgreSQL and MariaDB are unverified until CI runs:- The sealed-only runtime test compares the refused bodies with the unopenable-row bodies via
.json(). It fails if error bodies carry a per-request field. - Tests that build several apps rely on the module-wide state that
verifiers.configuresets. The last app created decides sealing for every client, so the sealed-only test sets it again before its calls.
Lotse · Nov 17, 2026, 23:49 UTC
#1935 description of record for head 2342ccd6f93b8068f999b93e90053fe94bb43f01 (k5ax 156792; replaces nte-8nkfjpjv471s and nte-79bn6jfp8qe1), part 1 of 2:
Card: tsk-ebc2fhdxttm7 (hub: seal the remaining plain verifiers, then refuse plain ones; follow-up to #1789 and #1840). Plan approved by the lead lotse (seq 152522, confirmed seq 153623). Head
2342ccd6f93b8068f999b93e90053fe94bb43f01on mainfd461be6.What is in
- `maity-hub seal-verifiers` (
hub/src/maity_hub/cli.py_seal_verifiers,auth/verifiers.pycount,seal_and_count,Counted): - prints
sealed N, already sealed M, plain left Kper table (credential,runner_credential) and astotal. N = rows this run sealed, M = rows sealed before it, K = plain rows after it. Revoked rows count too, because the command seals them; - exits 1 when K > 0 after a real run, which means a plain row was written meanwhile (an old pod during a rolling deploy);
--dry-runonly counts, writes nothing, and needs neitherMAITY_SEAL_VERIFIERSnor the key. A real run still refuses (exit 2) without both.- `MAITY_SEALED_VERIFIERS_ONLY` (
config.pyparse_sealed_verifiers_only, default off): - it is a
ConfigErrorwithoutMAITY_SEAL_VERIFIERS=1(and so without the key); app.check_startuprefuses the start while a live plain verifier is left, naming the count andmaity-hub seal-verifiers. The startup log count stays;- at runtime,
verifiers.accepted(used byauth/caller.py_verifier) returns None for a plain row. That is the answer a sealed row the key does not open gets today: 401unauthenticatedon bearer, 401signature_invalidon signed, for agents and runners. There is no new error detail; - the leak check keeps reading plain rows (
usable), so a leaked plain credential is still revoked; - it is listed in
settings_overview.pyand in hub/README's Configuration table. - Reseal on use: with sealing on, a plain row that verified a call is sealed in that call's existing
last_used_atupdate (_agent,_runner). It is guarded byCASE verifier WHEN <plain read>, so a credential replaced meanwhile keeps its value, and it adds no statement. Not covered: an isolated agent's calls, which write nothing, and idle credentials; the docs say so, andmaity-hub seal-verifiersseals those. - Helm:
secretKey.sealedVerifiersOnly, defaultfalse. It is in the schema and values, rendersMAITY_SEALED_VERIFIERS_ONLY=1for the hub and the migrate Job, and the chart refuses it withoutsecretKey.sealVerifiers.check.shhas cases for the default, the rendering and the refusal. - Docs:
docs/api.md§2.2;docs/install/README.md"Backups", with the operator order: key and sealing on,seal-verifiersafter that and after every rolling deploy untilplain left 0, then sealed-only in a rollout of its own, plus the rollback;- hub/README, the chart README and values;
docs/install/README.md: in a rolling update the earlier processes keep serving while the new start is refused; withRecreate(the chart's single-pod default) or a single process the hub stays down untilmaity-hub seal-verifiershas run or the setting is unset again;changelog.d/agent-c-k5ax-sealed-only.md, with the operator note the release author uses for the upgrade page.- Keep the Why:
hub/context/credentials.md, entry0ce47fbe-77f9-4576-8e20-bb7f4d2a4ff2, is extended. It records the gate, reseal on use, the signed-path answer, that the leak check reads plain rows, and five more rejected alternatives. The index line is updated. It is in its own commit, 6c04ee04.
Prod: both switches are off by default everywhere, Helm included, so an upgrade turns nothing on. Switching on
MAITY_SEAL_VERIFIERS=1, and laterMAITY_SEALED_VERIFIERS_ONLY=1, is Oliver's decision after a deploy. Neither is part of this PR.- `maity-hub seal-verifiers` (
Lotse · Nov 17, 2026, 23:49 UTC
#1935 description of record for head 2342ccd6f93b8068f999b93e90053fe94bb43f01 (k5ax 156792; replaces nte-8nkfjpjv471s and nte-79bn6jfp8qe1), part 2 of 2:
Tests added
hub/tests/test_sealed_verifiers.py:- a mixed table (sealed, plain, revoked plain, plain runner): the dry run counts and writes nothing; the run seals them all and a second run seals none;
- a key added later: plain rows are resealed by their first call with sealing on, for agent and runner;
- reseal leaves a row replaced meanwhile alone;
- sealed-only refuses plain rows at runtime (bearer, signed, runner) with the bodies an unopenable sealed row gets, and lets sealed rows through;
- sealed-only refuses the start with a live plain row, but not with only a revoked one after sealing;
- sealed-only still revokes a leaked plain credential;
- an isolated agent's plain row stays plain through its permitted
GET /me(bearer and signed, 200), and is resealed after the lift. - One existing test now calls with sealing off, so that reseal on use does not change what it counts.
hub/tests/test_cli.py: the new output, the dry run (with no key, and with sealing on), and exit 1 with a plain row left.hub/tests/test_config.py: the new setting's default, its dependency onMAITY_SEAL_VERIFIERSand its parsing.
Review rounds
- A1163 (tqgb, CHANGES, F1): reseal on use qualified in docs/install/README.md, docs/api.md, hub/README.md and the changelog fragment; test above. Commit
8269a424. - A1164 (funj, APPROVE, P3): the rolling-update qualifier in docs/install/README.md. Commit
2342ccd6.
How it was verified
Size on head 2342ccd6: 623 lines added, 51 removed, in 20 files (
git diff --stat origin/main...HEAD:20 files changed, 623 insertions(+), 51 deletions(-)).Ran locally on head 2342ccd6:
make -C hub lint: black 828 files unchanged, ruff all checks passed;make -C hub typecheck: mypy, no issues in 828 source files;python3 tools/changelog.py check: 24 fragments, all valid;ktw-lint hub: 0 errors, 0 warnings.
pytest on SQLite, each file run alone:
hub/tests/test_sealed_verifiers.py: 18 passed;hub/tests/test_cli.py: 61 passed, 1 skipped;hub/tests/test_config.py: 21 passed;hub/tests/test_auth_agent.py: 53 passed, 4 skipped;hub/tests/test_runners.py: 42 passed;hub/tests/test_signing.py: 17 passed;hub/tests/test_isolation.py: 18 passed;hub/tests/test_settings_overview.py: 11 passed.
Not run locally
CI on 2342ccd6 covers these. Not run here:
- pytest on PostgreSQL:
scripts/with_postgres.shstops becausetools/run_slot.shcannot write its lock under~/.local/state/maity/run-slots, which is read-only in the agent sandbox. Reported to the runner owner; - pytest on MariaDB;
- the contract tests;
tools/guards.sh: the sandbox shows placeholder files in the tree, so its clean-tree check fails before any guard runs;deploy/helm/check.sh:helmis not installed;- the counter-checks of the new tests (CONTRIBUTING, evidence rules). They are still owed.
Known risks in the new tests. Both hold on SQLite (
test_sealed_verifiers.pypasses); PostgreSQL and MariaDB are unverified until CI runs:- The sealed-only runtime test compares the refused bodies with the unopenable-row bodies via
.json(). It fails if error bodies carry a per-request field. - Tests that build several apps rely on the module-wide state that
verifiers.configuresets. The last app created decides sealing for every client, so the sealed-only test sets it again before its calls.
Lotse · Nov 17, 2026, 23:51 UTC
#1935 addendum: head is now c6367f3f7f6b2766e1ad8e393d3d06ac7623b579 (one commit on 2342ccd6: the same rolling-update qualifier in the Keep the Why entry, hub/context/credentials.md). The squash text names it under "Review rounds".
Lotse · Nov 17, 2026, 23:51 UTC
#1935 description of record for head c6367f3f7f6b2766e1ad8e393d3d06ac7623b579 (k5ax 156792 and 156809; replaces nte-rzfnqnb0r0v4, nte-xsvj1s6jfw6e and nte-6jsp408eh5sn), part 2 of 2:
Tests added
hub/tests/test_sealed_verifiers.py:- a mixed table (sealed, plain, revoked plain, plain runner): the dry run counts and writes nothing; the run seals them all and a second run seals none;
- a key added later: plain rows are resealed by their first call with sealing on, for agent and runner;
- reseal leaves a row replaced meanwhile alone;
- sealed-only refuses plain rows at runtime (bearer, signed, runner) with the bodies an unopenable sealed row gets, and lets sealed rows through;
- sealed-only refuses the start with a live plain row, but not with only a revoked one after sealing;
- sealed-only still revokes a leaked plain credential;
- an isolated agent's plain row stays plain through its permitted
GET /me(bearer and signed, 200), and is resealed after the lift. - One existing test now calls with sealing off, so that reseal on use does not change what it counts.
hub/tests/test_cli.py: the new output, the dry run (with no key, and with sealing on), and exit 1 with a plain row left.hub/tests/test_config.py: the new setting's default, its dependency onMAITY_SEAL_VERIFIERSand its parsing.
Review rounds
- A1163 (tqgb, CHANGES, F1): reseal on use qualified in docs/install/README.md, docs/api.md, hub/README.md and the changelog fragment; test above. Commit
8269a424. - A1164 (funj, APPROVE, P3): the rolling-update qualifier in docs/install/README.md (commit
2342ccd6) and in the Keep the Why entry inhub/context/credentials.md(commitc6367f3f).
How it was verified
Size on head c6367f3f: 625 lines added, 51 removed, in 20 files (
git diff --stat origin/main...HEAD:20 files changed, 625 insertions(+), 51 deletions(-)).Ran locally on head 2342ccd6:
make -C hub lint: black 828 files unchanged, ruff all checks passed;make -C hub typecheck: mypy, no issues in 828 source files;python3 tools/changelog.py check: 24 fragments, all valid;ktw-lint hub: 0 errors, 0 warnings.
pytest on SQLite, each file run alone:
hub/tests/test_sealed_verifiers.py: 18 passed;hub/tests/test_cli.py: 61 passed, 1 skipped;hub/tests/test_config.py: 21 passed;hub/tests/test_auth_agent.py: 53 passed, 4 skipped;hub/tests/test_runners.py: 42 passed;hub/tests/test_signing.py: 17 passed;hub/tests/test_isolation.py: 18 passed;hub/tests/test_settings_overview.py: 11 passed.
On head c6367f3f (only hub/context/credentials.md changed):
ktw-lint hubandktw-lint --strict hub0 errors, 0 warnings;python3 tools/changelog.py check24 valid.Not run locally
CI on c6367f3f covers these. Not run here:
- pytest on PostgreSQL:
scripts/with_postgres.shstops becausetools/run_slot.shcannot write its lock under~/.local/state/maity/run-slots, which is read-only in the agent sandbox. Reported to the runner owner; - pytest on MariaDB;
- the contract tests;
tools/guards.sh: the sandbox shows placeholder files in the tree, so its clean-tree check fails before any guard runs;deploy/helm/check.sh:helmis not installed;- the counter-checks of the new tests (CONTRIBUTING, evidence rules). They are still owed.
Known risks in the new tests. Both hold on SQLite (
test_sealed_verifiers.pypasses); PostgreSQL and MariaDB are unverified until CI runs:- The sealed-only runtime test compares the refused bodies with the unopenable-row bodies via
.json(). It fails if error bodies carry a per-request field. - Tests that build several apps rely on the module-wide state that
verifiers.configuresets. The last app created decides sealing for every client, so the sealed-only test sets it again before its calls.
Lotse · Nov 17, 2026, 23:51 UTC
#1935 record, head c6367f3f, part 1 of 2 (replaces nte-rzfnqnb0r0v4, nte-6jsp408eh5sn):
Card: tsk-ebc2fhdxttm7 (hub: seal the remaining plain verifiers, then refuse plain ones; follow-up to #1789 and #1840). Plan approved by the lead lotse (seq 152522, confirmed seq 153623). Head
c6367f3f7f6b2766e1ad8e393d3d06ac7623b579on mainfd461be6.What is in
- `maity-hub seal-verifiers` (
hub/src/maity_hub/cli.py_seal_verifiers,auth/verifiers.pycount,seal_and_count,Counted): - prints
sealed N, already sealed M, plain left Kper table (credential,runner_credential) and astotal. N = rows this run sealed, M = rows sealed before it, K = plain rows after it. Revoked rows count too, because the command seals them; - exits 1 when K > 0 after a real run, which means a plain row was written meanwhile (an old pod during a rolling deploy);
--dry-runonly counts, writes nothing, and needs neitherMAITY_SEAL_VERIFIERSnor the key. A real run still refuses (exit 2) without both.- `MAITY_SEALED_VERIFIERS_ONLY` (
config.pyparse_sealed_verifiers_only, default off): - it is a
ConfigErrorwithoutMAITY_SEAL_VERIFIERS=1(and so without the key); app.check_startuprefuses the start while a live plain verifier is left, naming the count andmaity-hub seal-verifiers. The startup log count stays;- at runtime,
verifiers.accepted(used byauth/caller.py_verifier) returns None for a plain row. That is the answer a sealed row the key does not open gets today: 401unauthenticatedon bearer, 401signature_invalidon signed, for agents and runners. There is no new error detail; - the leak check keeps reading plain rows (
usable), so a leaked plain credential is still revoked; - it is listed in
settings_overview.pyand in hub/README's Configuration table. - Reseal on use: with sealing on, a plain row that verified a call is sealed in that call's existing
last_used_atupdate (_agent,_runner). It is guarded byCASE verifier WHEN <plain read>, so a credential replaced meanwhile keeps its value, and it adds no statement. Not covered: an isolated agent's calls, which write nothing, and idle credentials; the docs say so, andmaity-hub seal-verifiersseals those. - Helm:
secretKey.sealedVerifiersOnly, defaultfalse. It is in the schema and values, rendersMAITY_SEALED_VERIFIERS_ONLY=1for the hub and the migrate Job, and the chart refuses it withoutsecretKey.sealVerifiers.check.shhas cases for the default, the rendering and the refusal. - Docs:
docs/api.md§2.2;docs/install/README.md"Backups", with the operator order: key and sealing on,seal-verifiersafter that and after every rolling deploy untilplain left 0, then sealed-only in a rollout of its own, plus the rollback;- hub/README, the chart README and values;
docs/install/README.md: in a rolling update the earlier processes keep serving while the new start is refused; withRecreate(the chart's single-pod default) or a single process the hub stays down untilmaity-hub seal-verifiershas run or the setting is unset again;changelog.d/agent-c-k5ax-sealed-only.md, with the operator note the release author uses for the upgrade page.- Keep the Why:
hub/context/credentials.md, entry0ce47fbe-77f9-4576-8e20-bb7f4d2a4ff2, is extended. It records the gate, reseal on use, the signed-path answer, that the leak check reads plain rows, and five more rejected alternatives. The index line is updated. It is in its own commit, 6c04ee04. Commit c6367f3f adds the rolling-update qualifier to the entry's sealed-only bullet (the old pods keep serving only in a rolling update; withRecreateor a single process the hub stays down untilseal-verifiershas run or the setting is unset).
Prod: both switches are off by default everywhere, Helm included, so an upgrade turns nothing on. Switching on
MAITY_SEAL_VERIFIERS=1, and laterMAITY_SEALED_VERIFIERS_ONLY=1, is Oliver's decision after a deploy. Neither is part of this PR.- `maity-hub seal-verifiers` (