Repository navigation
Realize custody §1–§3: the binding named, the secrets refused by name - #395
Conversation
…erence, enforced
The hosting record now declares WHERE the account's credential is held, and the
validator makes "by reference only" a rule rather than an intention.
§1 — the `custody:` block names the BINDING (binding_kind / binding_client /
binding_id) and carries no provider, no vault, no secret_ref, no value. That is
the design, not an omission: the reference is sufficient to find the credential
through the governed path and insufficient to obtain it without one. It states
what the custody covers (password AND totp_seed — a password in a vault beside a
TOTP seed on someone's phone is a single point of failure wearing governance),
and it states the honest reach: `interactive_step_remains: true`, because
Google's sign-in for this account is an interactive browser flow and custody does
not change that.
§2 — the validator enforces both halves, and they are deliberately asymmetric.
An operator-hosted declaration MUST name its binding; a self-hosted one need not,
matching the two-case model — no operator, no obligation. But NEITHER case may
carry credential material, and the refusal runs over the whole hosting block
rather than the custody sub-tree, because material does not care which key it was
filed under.
Keyed on the field NAME, not the value's shape. A value-shaped heuristic
("does this look like a password?") fails open on anything unusual, and the one
thing worse than no check is a check that says a leaked secret looks fine.
`secret_ref` is refused too, and it is not secret material — it is BINDING
DETAIL, and carrying one field of the binding here invites the rest to follow
(review note, 2026-08-23). The refusal names the binding as the remedy and
explicitly NOT redaction in place: a redacted secret is a secret that was
already committed, so the fix is rotation.
The refusal is exact-match, which is load-bearing: the record's own required
`nlm_profile: company` names a CLI profile and must keep passing, while an
`exported_profile` must not. A test pins that distinction.
§3 — the story lands in three places a reader actually hits: §12 of the
projection doc (custody, per-system bindings, what revocation does NOT reach —
it stops future fetches and cannot un-disclose a fetched password or end a live
session, so eviction means rotation, which necessarily reaches every consumer);
a new runbook step 1a (fetch through your own binding, then sign in BY HAND);
and a callout at the login gate itself that the resulting session is NOT a
custody subject, on the same grounds credential-contracts already refuses
distributing refreshable session state.
The base test fixture gained the custody block rather than the custody tests
bolting one on, because every other test here asserts against "an otherwise
conforming record" and would otherwise have been asserting against a
non-conforming one. Three previously-passing tests failed until it did, which is
the requirement working.
Gates: tests/notebooklm 143 passed + 24 subtests (29 new custody/secret tests),
tests/credential_contracts 2, tests/doc-health 895, openspec 77/77 strict,
hosting validator 0 errors, dashboard contracts validator 0 errors,
doc-health ZERO NEW findings vs main (65/65).
contracts/ UNTOUCHED — no bundle cut, `target_release: implemented` stands. The
binding-template consumer-identity extension is the named successor (§4.5) and
DOES carry the release ritual; §1-§3 establishes the record shape it will have to
represent, which is why it goes first.
NOTE for the next runner: `pytest tests/ideation-dashboard tests/doc-health` in
ONE invocation produces 47 collection errors from duplicate module basenames —
on main as well as here. Run the suites separately; each collects 4473 clean.
Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
Hi @brettheap! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
|
@codex review |
There was a problem hiding this comment.
Pull request overview
This PR realizes §1–§3 of the add-notebook-hosting-credential-custody change by (a) adding a by-reference-only hosting.custody block for operator-hosted declarations, (b) enforcing asymmetric custody requirements while refusing secret material by field name anywhere under hosting, and (c) documenting the custody model and the “session state is not custody” rule in the lifecycle doc and migration runbook.
Changes:
- Extend the hosting validator to require a custody binding reference for
operator_hostedrecords and refuse secret-shaped fields (andsecret_ref) anywhere underhosting. - Update the example hosting declaration and add/expand tests covering custody requirements and secret-material refusal.
- Add documentation clarifying custody-by-reference, per-system bindings, revocation limits, and the non-custody nature of refreshable session state.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/notebooklm/test_validate_hosting.py | Expands fixtures and adds custody/secret-refusal tests for the hosting validator. |
| scripts/validate-notebook-projection-hosting.py | Adds hosting.custody validation and a recursive secret-shaped field refusal helper. |
| openspec/changes/add-notebook-hosting-credential-custody/tasks.md | Marks §1–§3 tasks complete in the governing change task list. |
| examples/notebook-projection-hosting.yaml | Documents and adds the by-reference-only custody block to the canonical example. |
| docs/notebook-projection-migration-runbook.md | Adds step 1a and a prominent warning that the created session/profile is not a custody subject. |
| docs/lifecycle-notebook-projection.md | Documents custody-by-reference, per-system bindings, revocation limitations, and session-state exclusion. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if not isinstance(node, dict): | ||
| return |
| if __name__ == "__main__": | ||
| unittest.main() | ||
|
|
||
|
|
||
| class CustodyValidationTests(unittest.TestCase): | ||
| """add-notebook-hosting-credential-custody § 2 — custody BY REFERENCE ONLY. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b9bf92c93
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # The secret-shaped refusal runs FIRST and over the whole hosting block, not | ||
| # just the custody sub-tree, because the failure being prevented is material | ||
| # in the file — and material does not care which key it was filed under. | ||
| _refuse_secret_shaped(hosting, "hosting", errors) |
There was a problem hiding this comment.
Scan the entire hosting record for credential material
Pass the complete parsed record to the secret scanner rather than only hosting. A top-level field such as password: hunter2, or credential material nested under share_out or denied, is currently never visited and the validator can report success despite the documented guarantee that secret-shaped fields are refused anywhere in the record.
Useful? React with 👍 / 👎.
| if not isinstance(node, dict): | ||
| return |
There was a problem hiding this comment.
Traverse YAML sequences while scanning for secrets
Handle lists as well as mappings in the recursive scanner. For example, hosting: {metadata: [{password: hunter2}]} reaches this early return when metadata is visited, so the nested password is accepted even though the new rule claims to refuse credential material anywhere under the hosting record.
Useful? React with 👍 / 👎.
| "password", "passphrase", "secret", "token", "api_key", "apikey", | ||
| "totp", "totp_seed", "otp_seed", "recovery_code", "recovery_codes", | ||
| "backup_code", "backup_codes", "cookie", "cookies", "session", | ||
| "session_token", "profile", "exported_profile", "private_key", | ||
| "credential", "credentials", |
There was a problem hiding this comment.
Reject compound names for credential fields
Do not limit the refusal to these exact key spellings. A plausible field such as account_password: hunter2—the same credential name used by this change in covers—does not match password and therefore passes validation, as do common names such as client_secret and refresh_token; either reject unknown fields structurally or recognize secret-bearing compound names so this guard cannot approve committed credentials.
Useful? React with 👍 / 👎.
| "it — a reader deciding whether the projection can run " | ||
| "unattended needs the answer here, not in a runbook they may " | ||
| "not open") | ||
| elif "interactive_step_remains" not in custody: |
There was a problem hiding this comment.
Reject false interactive-step declarations
Reject interactive_step_remains: false for this NotebookLM hosting flow, or otherwise validate it against a supported unattended flow. The current branch reports an error only when the field is absent, so both false and arbitrary non-boolean values pass even though this change establishes that Google sign-in remains interactive; such a declaration incorrectly tells operators that custody material alone supports unattended execution.
Useful? React with 👍 / 👎.
| ## Step 1a — Get the credential from custody, not from a person | ||
|
|
||
| Before you can sign in as the hosting account you need its credential, and the |
There was a problem hiding this comment.
Move the custody fetch before the login gate
Place this step before the runbook's login command. In the current ordering, lines 31–40 already instruct the operator to authenticate as the hosting account, while this new section only afterward says the credential must be fetched from custody “before you can sign in” and then directs the operator to sign in; following the runbook top-to-bottom therefore bypasses the governed-fetch instruction during the very login it is meant to govern.
Useful? React with 👍 / 👎.
…uite Copilot on PR #395. Both findings are the same shape as the defect the validator exists to prevent, which is why neither is cosmetic. 1. `_refuse_secret_shaped()` descended only into MAPPINGS. A secret-shaped key inside a list — `hosting.some_list: [{password: hunter2}]` — was skipped outright and the record validated CLEAN with credential material sitting in it. Reproduced before fixing across four shapes: nested in a sequence, list of lists, a cookie beside innocent keys in a roster-like entry, and four levels through mixed containers. All four passed the validator; all four are refused now, and the clean record still passes. THE FAIL-OPEN FAMILY, INSIDE THE REFUSAL WRITTEN TO PREVENT IT: a path that could not answer returned "nothing to see" instead of looking. YAML nests freely, so a walk covering one container type is not a walk — the recursion is over the DOCUMENT, not over the shape its author happened to picture. Six tests pin it, including that the error path names the list INDEX (a refusal the operator cannot locate is half a refusal) and that sequences without secrets still pass, so the fix cannot be satisfied by refusing lists as such. Mutation-proved: removing the sequence walk fails 5, dropping the index from the path fails 1. 2. `if __name__ == "__main__": unittest.main()` sat MID-FILE, before the custody and secret-refusal classes. Direct execution therefore ran 15 of 29 tests and printed OK — measured, not inferred. Moved to the end: direct execution now runs 35, matching pytest exactly, and a comment says why it must stay there. Same shape again, in the test file this time: a green result that could not see two-thirds of the suite and said fine rather than saying it could not see them. Proved by moving it back — direct drops to 29 while pytest still reports 35. Gates: notebooklm + credential_contracts 151 passed / 24 subtests (35 in this file, up from 29), openspec 77/77 strict, hosting validator 0 errors, contracts/ untouched. Co-Authored-By: Claude Fable 5 <[email protected]>
@copilot — both real, both the same shape, fixed in
|
| shape | before | after |
|---|---|---|
some_list: [{password: …}] |
✗ passed | refused |
outer: [[{password: …}]] |
✗ passed | refused |
share_like: [{name: a, cookie: …}] |
✗ passed | refused |
| four levels, mixed containers | ✗ passed | refused |
The walk descended into mappings only, so a path that could not answer returned "nothing to see" instead of looking. YAML nests freely — a walk covering one container type isn't a walk. The recursion is over the document, not over the shape its author happened to picture. That this landed inside the very function written to refuse secrets is the part worth remembering.
Six tests pin it, including two that stop the fix being satisfied cheaply: the error path must name the list index (a refusal the operator can't locate is half a refusal), and sequences without secrets must still pass. Mutation-proved: removing the sequence walk fails 5 tests, dropping the index from the path fails 1.
2. The block — same shape, in the test file
You were right, and it was worse than "silently not collecting": I measured it. Direct execution ran **15 of 29 tests and printed **.
Moved to the end. Direct now runs 35, matching pytest exactly. Proved by moving it back — direct drops to 29 while pytest still reports 35. A comment says why it must stay last.
A green result that couldn't see two-thirds of the suite and said fine rather than I can't see them — the same failure mode as finding 1, which is why both are in one commit rather than filed as unrelated tidy-ups.
Gates: 151 passed / 24 subtests, openspec 77/77 strict, validator 0 errors, contracts/ untouched.
|
Correction to my reply above — two phrases were eaten by shell backtick expansion before posting. Finding 2 in full: 2. The
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
tests/notebooklm/test_validate_hosting.py:312
- The new secret-material tests don’t currently cover alternate (camelCase) key spellings, which would be a realistic bypass if someone tries to sneak material in under a different spelling. Adding regression tests for
apiKey/totpSeedandsecretRefhelps pin the intended “keyed on field name” behavior across common variants.
def test_secret_ref_is_refused_as_binding_detail(self):
"""Not secret material — binding detail. Carrying it here invites the
rest of the binding to follow (review note, 2026-08-23)."""
text = BASE.replace(
" binding_id: notebook_projection_hosting\n",
scripts/validate-notebook-projection-hosting.py:243
- The secret-material refusal can be bypassed by using non-underscore key spellings (e.g.
secretRef,totpSeed). Since_check_hostingdoes not reject unknown keys, it’s safer to compare both the raw lower-cased key and an underscore-collapsed variant, and to report the actual key spelling in the error path so operators can locate it quickly.
lowered = str(key).lower()
if lowered in SECRET_SHAPED_FIELDS:
_err(errors,
f"{path}.{key}: credential material MUST NOT appear in the "
f"hosting record, in this repository, or in any projection "
| SECRET_SHAPED_FIELDS = frozenset({ | ||
| "password", "passphrase", "secret", "token", "api_key", "apikey", | ||
| "totp", "totp_seed", "otp_seed", "recovery_code", "recovery_codes", | ||
| "backup_code", "backup_codes", "cookie", "cookies", "session", | ||
| "session_token", "profile", "exported_profile", "private_key", | ||
| "credential", "credentials", | ||
| }) |
Realizes §1–§3 of the ratified
add-notebook-hosting-credential-custody(9 of 18 tasks). Moving off a personal identity only half-solves the problem it was raised for: an account nobody but its creator can sign into is still a single point of failure, just a better-named one.§1 — the record names the binding, and nothing else
custody:carriesbinding_kind/binding_client/binding_idand no provider, no vault, nosecret_ref, no value. That is the design: the reference is sufficient to find the credential through the governed path and insufficient to obtain it without one.It names what custody covers — password and TOTP seed, because a password in a vault beside a seed on someone's phone is a single point of failure wearing governance — and states the honest reach:
interactive_step_remains: true.§2 — the validator, and two deliberate choices
Enforcement is asymmetric on purpose: operator-hosted must name its binding, self-hosted need not (no operator, no obligation) — but neither may carry material, and that check runs over the whole hosting block, because material does not care which key it was filed under.
Keyed on the field NAME, not the value's shape. A "does this look like a password?" heuristic fails open on anything unusual, and the one thing worse than no check is a check that says a leaked secret looks fine.
secret_refis refused too, and it is not secret material — it is binding detail, and carrying one field of the binding invites the rest to follow (review note, 2026-08-23). The refusal names the binding as the remedy and explicitly not redaction in place: a redacted secret is a secret that was already committed, so the fix is rotation.Exact-match is load-bearing — the record's own required
nlm_profile: companymust keep passing while anexported_profilemust not. A test pins that distinction, and switching to substring matching fails 8 tests.§3 — three places a reader actually hits
§12 of the projection doc (custody, per-system bindings, and what revocation does not reach — it stops future fetches, cannot un-disclose a fetched password or end a live session, so eviction means rotation, which necessarily reaches every consumer); a new runbook step 1a (fetch through your own binding, then sign in by hand); and a callout at the login gate that the resulting session is not a custody subject, on the same grounds
credential-contractsalready refuses distributing refreshable session state.Note on the test fixture
The base fixture gained the custody block rather than the custody tests bolting one on — every other test asserts against "an otherwise conforming record" and would otherwise have been asserting against a non-conforming one. Three previously-passing tests failed until it did, which is the requirement working.
Gates
notebooklm 143 + 24 subtests (29 new), credential_contracts 2, doc-health 895, openspec 77/77 strict, both validators 0 errors, doc-health zero-new (65/65). Revert-proved 4/4.
contracts/UNTOUCHED — no bundle cut,target_release: implementedstands. The binding-template consumer-identity extension is the named successor (§4.5) and does carry the release ritual (a v1.45 candidate now); §1–§3 establishes the record shape it will have to represent, which is why it goes first.🤖 Generated with Claude Code