hooks: attach X-Cogos-Grant to kernel write requests (v0.16.29 enforcement) - #26
Open
chazmaniandinkle wants to merge 1 commit into
Open
hooks: attach X-Cogos-Grant to kernel write requests (v0.16.29 enforcement)#26chazmaniandinkle wants to merge 1 commit into
chazmaniandinkle wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
X-Cogos-Grantheader on all POST/PUT/PATCH/DELETE routes; unauthenticated writes get401 missing_grant.user-scope-session-start.py,user-scope-session-end.py,seat-identity-heal.py(session registration and session-end).~/.cog/vault/node-root-grantfirst, falls back to the loopbackGET /v1/identity/grants/current?surface=node-root, and caches the result in-process.compaction-handoff.pynever calls the kernel (verified via grep) andkernel-vitals-probe.pyis GET-only -- neither is touched.Test plan
python3 -m py_compileon all three changed filesPOST /v1/sessions/registerwith the grant header returned 200, followed byPOST /v1/sessions/<id>/endto clean up (see operator session transcript)plugins/cogos-harness/hooks/and the installed plugin cache copy before and after editsDo not merge -- awaiting independent review per this org's merge policy.