[codex] always tag audit event source#32
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
Pull request overview
This PR ensures every emitted audit event includes an explicit source value so the UI and downstream log consumers can reliably attribute audit events to their origin (web app vs MCP).
Changes:
- Make
sourcenon-optional on audit event types and default SQL events tosource: 'web'unless explicitly tagged as MCP. - Display the
sourcebadge in the System audit tab as well as the Connection tab. - Expand audit tests and documentation to cover
sourceacross auth, SQL, and export events.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
server/lib/audit.ts |
Makes source required across audit event types and always sets it when emitting events (web default, mcp via opts). |
src/pages/AuditLog.tsx |
Passes entry.source into the action cell so the source badge renders in the System tab as well. |
tests/audit.test.ts |
Adds assertions/tests ensuring source is present for web, MCP, and system auth events. |
docs/features/audit-log.mdx |
Updates examples/field docs to document the source field for each relevant event. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile SummaryThis PR ensures every audit event carries an explicit
Confidence Score: 5/5Safe to merge — the change is additive, all callers are updated, the proto already carried the The core logic is straightforward: a required field replaces an optional one, every emitter is updated, and the No files require special attention; Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User Browser] -->|login/logout/SQL/export| B[Web Handler]
C[MCP Client] -->|SQL via MCP tool| D[MCP Handler]
B -->|auditLogin / auditLogout| E["source: 'web'"]
B -->|auditSQL no opts| E
B -->|auditExport| E
D -->|auditSQL opts.source='mcp'| F["source: 'mcp'"]
E --> G[AuditEvent store]
F --> G
G -->|listAuditEvents| H[Connection tab]
G -->|listSystemAuditEvents| I[System tab]
H --> J["ActionCell + source badge"]
I --> J
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[User Browser] -->|login/logout/SQL/export| B[Web Handler]
C[MCP Client] -->|SQL via MCP tool| D[MCP Handler]
B -->|auditLogin / auditLogout| E["source: 'web'"]
B -->|auditSQL no opts| E
B -->|auditExport| E
D -->|auditSQL opts.source='mcp'| F["source: 'mcp'"]
E --> G[AuditEvent store]
F --> G
G -->|listAuditEvents| H[Connection tab]
G -->|listSystemAuditEvents| I[System tab]
H --> J["ActionCell + source badge"]
I --> J
Reviews (1): Last reviewed commit: "fix: always tag audit event source" | Re-trigger Greptile |
Summary
sourcevalue for generated events:webfor web-app login/logout/SQL/export events and existingmcpfor MCP SQL execution.Why
The previous implementation only populated
sourcewhen SQL came through the MCP path. UI/web-originated SQL events, exports, and auth events could therefore display a blank source. This makes the origin explicit for every audit event we emit today.Validation
pnpm test tests/audit.test.tspnpm build