feat(session): add signed broker authorization - #901
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds revision-1 Ed25519 authentication primitives, immutable app-scoped grants, replay-protected caller sessions, signed response envelopes, and default-deny authorization for the generic broker HTTP API.
Confidence Score: 4/5The PR appears safe to merge, with only a non-blocking indentation inconsistency across the newly added TypeScript implementation. Authentication, replay protection, authorization, and signed-response paths are covered by focused tests, while the sole accepted concern is consistency with the repository's documented indentation convention. Files Needing Attention: packages/session-broker/src/authentication.ts and other changed TypeScript implementation files Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant Auth as Broker Authenticator
participant Daemon
participant App as App Authorizer
participant Session
Caller->>Auth: Signed hello challenge/proof
Auth-->>Caller: Short-lived caller session
Caller->>Daemon: Signed request and sequence
Daemon->>Auth: Verify signature, grant, expiry, revocation, replay
Auth-->>Daemon: Authenticated principal
Daemon->>App: Authorize operation and command version
App-->>Daemon: Allow or deny
alt Allowed dispatch
Daemon->>Session: Versioned command
Session-->>Daemon: Command result
end
Daemon-->>Caller: Signed response envelope
Prompt To Fix All With AI### Issue 1
packages/session-broker/src/authentication.ts:768-776
**Inconsistent TypeScript indentation**
The new authentication implementation uses two-space indentation throughout, conflicting with the repository's documented four-space TypeScript convention and establishing an inconsistent pattern across several substantial new modules.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "feat(session): add signed broker authori..." | Re-trigger Greptile |
| private assertCallerSessionActive(callerSessionId: string, session: CallerSessionRecord): void { | ||
| if (this.callerSessions.get(callerSessionId) !== session) { | ||
| authenticationError("caller-session-expired"); | ||
| } | ||
| this.requireActiveGrant(session.grant); | ||
| if (this.currentTime() >= session.expiresAt) { | ||
| this.callerSessions.delete(callerSessionId); | ||
| authenticationError("caller-session-expired"); | ||
| } |
There was a problem hiding this comment.
Inconsistent TypeScript indentation
The new authentication implementation uses two-space indentation throughout, conflicting with the repository's documented four-space TypeScript convention and establishing an inconsistent pattern across several substantial new modules.
Context Used: guidelines.mdc Cursor rule (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/session-broker/src/authentication.ts
Line: 768-776
Comment:
**Inconsistent TypeScript indentation**
The new authentication implementation uses two-space indentation throughout, conflicting with the repository's documented four-space TypeScript convention and establishing an inconsistent pattern across several substantial new modules.
**Context Used:** guidelines.mdc Cursor rule ([source](https://github.com/modem-dev/modem/blob/main/.cursor/rules/guidelines.mdc))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
0cb1a10 to
d2a2336
Compare
Summary
Validation
bun run lintbun run typecheckbun run deps:checkgit diff --checkStack
This PR description was generated by Pi using gpt-5.6-sol