Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Refuse --attest-read person on a credential with --attest-sources; scope reads keep folder coverage fail-closed through dispatch
garrytan2055b920de51
diff --git a/docs/guides/qm.md b/docs/guides/qm.mdindex ef70b49cc0..a410f7ed0c 100644--- a/docs/guides/qm.md+++ b/docs/guides/qm.md@@ -55,7 +55,7 @@ gbrain auth rescope --client <dm_client_id> --attest-read person # named sou`scope` also refuses any call that names no person (`actor_not_attested`, reason`actor_required`), so the client never reads as itself. `person` is for a client that-serves only one person's own conversations; a `person` client that reads a source a+serves only one person's own conversations, so a client with `--attest-sources` refuses it; a `person` client that reads a source aroom client reads is flagged by `gbrain doctor` (`attest_read_shared_scope`). Unset(`none`) reads named sources as the scope and still serves calls that name no person.diff --git a/test/qm-scope-writes.test.ts b/test/qm-scope-writes.test.tsindex 9f39caebce..246d04feea 100644--- a/test/qm-scope-writes.test.ts+++ b/test/qm-scope-writes.test.ts@@ -303,6 +303,15 @@ for (const kind of testBackends()) {expect(row!.source_id).toBe(HOME);}, 60_000);+ test('a scope-writing credential never reads the sources it names as the person: --attest-read person is refused', async () => {+ const scopes = { kind: 'client' as const, id: clients.scopes!.id };+ expect((await refusal(bindCredential(engine, scopes, { attestRead: 'person' })))?.message).toContain('never as the person');+ const [row] = await engine.executeRaw<{ attest_read: string | null }>('SELECT attest_read FROM oauth_clients WHERE client_id = $1', [clients.scopes!.id]);+ expect(row!.attest_read).toBeNull();+ expect((await bindCredential(engine, scopes, { attestRead: 'scope' })).attest_read).toBe('scope');+ expect((await bindCredential(engine, scopes, { attestRead: null })).attest_read).toBeNull();+ }, 60_000);+test('a squatted scope page takes no scope write; no other remote writer may write memory/scope', async () => {await importFromContent(engine, 'memory/scope', '---\ntype: note\ntitle: Scope memory\nreadable_by:\n - member:alice-example\n - member:bob-example\n---\n# Scope memory\n', { sourceId: SCOPE_B });const squat = await write(alice, [{ fact: 'Squatted scope canarysquatscope', provenance: 'x' }], { source_id: SCOPE_B });