Skip to content

hooks: attach X-Cogos-Grant to kernel write requests (v0.16.29 enforcement) - #26

Open
chazmaniandinkle wants to merge 1 commit into
mainfrom
feat/grant-auth-consumers
Open

hooks: attach X-Cogos-Grant to kernel write requests (v0.16.29 enforcement)#26
chazmaniandinkle wants to merge 1 commit into
mainfrom
feat/grant-auth-consumers

Conversation

@chazmaniandinkle

Copy link
Copy Markdown
Contributor

Summary

  • Kernel v0.16.29 now requires an X-Cogos-Grant header on all POST/PUT/PATCH/DELETE routes; unauthenticated writes get 401 missing_grant.
  • Adds a small per-process grant helper to the three cogos-harness hooks that write to the kernel: user-scope-session-start.py, user-scope-session-end.py, seat-identity-heal.py (session registration and session-end).
  • Helper reads ~/.cog/vault/node-root-grant first, falls back to the loopback GET /v1/identity/grants/current?surface=node-root, and caches the result in-process.
  • Fail-open by design: any grant-acquisition failure (missing/corrupt vault, kernel unreachable) means the hook proceeds without the header, exactly as before this change. A broken vault must not break hook execution -- the existing fire-and-forget error handling absorbs the resulting 401 the same way it already absorbs a down kernel.
  • compaction-handoff.py never calls the kernel (verified via grep) and kernel-vitals-probe.py is GET-only -- neither is touched.

Test plan

  • python3 -m py_compile on all three changed files
  • End-to-end verification against a live kernel: POST /v1/sessions/register with the grant header returned 200, followed by POST /v1/sessions/<id>/end to clean up (see operator session transcript)
  • Confirmed byte-identical mirror between this repo's plugins/cogos-harness/hooks/ and the installed plugin cache copy before and after edits

Do not merge -- awaiting independent review per this org's merge policy.

…ement)

Kernel v0.16.29 requires an X-Cogos-Grant header on all POST/PUT/PATCH/
DELETE routes. Adds a per-process grant helper to the three cogos-harness
hooks that POST to the kernel (session registration and session-end):
user-scope-session-start.py, user-scope-session-end.py,
seat-identity-heal.py. The helper reads ~/.cog/vault/node-root-grant,
falls back to the loopback grants/current endpoint, and caches the
result in-process. Grant-acquisition failure is fail-open -- the hook
proceeds without the header exactly as before, so a broken vault
degrades to the pre-v0.16.29 401 rather than blocking the hook.

compaction-handoff.py and kernel-vitals-probe.py are unaffected:
the former never calls the kernel, the latter is GET-only.
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.

1 participant