Audit/2026 04 29#376
Draft
jasonmorais wants to merge 2 commits into
Draft
Conversation
Inaugural automated audit covering 50 commits (2025-12-01 → 2026-04-29) across all packages in the ShareThrift monorepo. Findings summary: Critical : 1 (missing auth on appeal-request resolvers — live in prod) High : 6 (unbounded DB queries, no-op event handlers, auth control-flow) Medium : 12 (N+1 resolvers, missing indexes, PII console.log, duplication) Low : 6 (type safety, schema workarounds, unindexed regex search) No auto-fixes were applied by analyzers this run. DependencySecurity report was unavailable; re-run required. See documents/audits/2026-04-29/audit.md for full findings and action plan.
- Full audit report with 1 Critical, 7 High, 9 Medium, 5 Low, 4 Info findings - DependencySecurity: removed 9 obsolete Snyk waivers from .snyk (auto-fix) - CodeQuality: 4 high (permissions layer dead, auth gaps, visa bypass, unimplemented stubs) - Performance: 4 high (N+1 queries, unbounded collection scans, in-memory pagination) - Establishes baseline for all future week-over-week trend comparisons
Contributor
Reviewer's GuideIntroduces a new, hook-enforced weekly audit workflow (Scoper → parallel analyzers → Synthesizer → Publisher) with dedicated agents and Node hooks, wires audit-specific shared state and report handling, adds the first generated audit report artifact, and refactors the implementation orchestrator config to use implementation-specific hooks and a central model-assignment table. Class diagram for audit shared state and hooksclassDiagram
class AuditState {
+string workflow
+string phase
+boolean active
+boolean scoperCompleted
+string[] analyzersCompleted
+boolean synthesizerCompleted
+boolean publisherCompleted
+number stopBlockCount
+string[] processedEvents
}
class SharedModule {
+string[] AUDIT_ANALYZERS
+string[] VALID_AGENTS
+number MAX_STOP_BLOCKS
+map~string, string[]~ PHASE_ALLOWED_AGENTS
+map~string, string~ PHASE_GUIDANCE
+stateDir() string
+stateFilePath(sessionId string) string
+loadState(sessionId string) AuditState~nullable~
+saveState(sessionId string, state AuditState) void
+createInitialState() AuditState
+eventKey(input any) string
+isDuplicate(state AuditState, input any) boolean
+extractAgentName(toolInput any) string~nullable~
+isSubagentTool(toolName string) boolean
+workflowSummary(state AuditState) string
+readHookInput() any
+runHook(handler function) void
+reportsDir(sessionId string) string
+analyzerReportFilename(analyzerId string) string
+listReports(sessionId string) ReportEntry[]
+analyzerReportStatus(sessionId string) AnalyzerStatus
+summarizeAnalyzerStatus(status AnalyzerStatus) string
}
class ReportEntry {
+string filePath
+string filename
+any data
}
class AnalyzerStatus {
+number expected
+string[] present
+string[] missing
+string[] failed
+map~string, string~ statusById
}
class SessionStartHookModule {
+handleSessionStart(input any) any
}
class PreToolUseHookModule {
+handlePreToolUse(input any) any
-denyOutOfPhase(state AuditState, agentName string) any~nullable~
-denyIfReportGate(state AuditState, agentName string, sessionId string) any~nullable~
}
class SubagentStartHookModule {
+handleSubagentStart(input any) any
}
class SubagentStopHookModule {
+handleSubagentStop(input any) any
-handleScoperStop(state AuditState) string
-handleAnalyzerStop(state AuditState, agentType string, sessionId string) string
-handleSynthesizerStop(state AuditState) string
-handlePublisherStop(state AuditState) string
}
class StopHookModule {
+handleStop(input any) any
}
class UserPromptSubmitHookModule {
+handleUserPromptSubmit(input any) any
}
SharedModule <.. SessionStartHookModule : uses
SharedModule <.. PreToolUseHookModule : uses
SharedModule <.. SubagentStartHookModule : uses
SharedModule <.. SubagentStopHookModule : uses
SharedModule <.. StopHookModule : uses
SharedModule <.. UserPromptSubmitHookModule : uses
AuditState <.. SharedModule : created and persisted
AnalyzerStatus <.. SharedModule : returned by
ReportEntry <.. SharedModule : returned by
Flow diagram for the new audit workflow phases and agentsflowchart TD
subgraph Phases
P1["Phase init\n(Scoper only)"]
P2["Phase scoping\n(Scoper running)"]
P3["Phase scoping_complete\n(ready for analyzers)"]
P4["Phase analyzing\n(analyzers and Synthesizer gate)"]
P5["Phase synthesizing\n(Synthesizer running)"]
P6["Phase synthesis_complete\n(ready for Publisher)"]
P7["Phase publishing\n(Publisher running)"]
P8["Phase done\n(workflow complete)"]
end
subgraph Agents
A0["Audit_Orchestrator\n(agent: Audit-Orchestrator)"]
A1["Scoper"]
A2["DependencySecurity"]
A3["PracticeCompliance"]
A4["CodeQuality"]
A5["TestQuality"]
A6["Performance"]
A7["DocumentationDx"]
A8["Synthesizer"]
A9["Publisher"]
end
subgraph Hooks_and_State
H1["SessionStart hook\n(audit/session-start.mjs)"]
H2["PreToolUse hook\n(audit/pre-tool-use.mjs)"]
H3["SubagentStart hook\n(audit/subagent-start.mjs)"]
H4["SubagentStop hook\n(audit/subagent-stop.mjs)"]
H5["Stop hook\n(audit/stop.mjs)"]
S1["Shared_state\n(audit/shared.mjs)"]
R1["Reports_dir\n(reportsDir(sessionId))"]
end
A0 --> H1
H1 --> S1
H1 --> R1
P1 -->|spawn Scoper| A1
A0 -->|runSubagent Scoper| H2
H2 --> H3
H3 --> P2
A1 -->|writes scope.json| R1
A1 --> H4
H4 --> P3
P3 -->|spawn all analyzers in one response| A2
P3 --> A3
P3 --> A4
P3 --> A5
P3 --> A6
P3 --> A7
A0 -->|runSubagent analyzers| H2
H2 --> H3
H3 --> P4
A2 -->|DependencySecurity.json| R1
A3 -->|PracticeCompliance.json| R1
A4 -->|CodeQuality.json| R1
A5 -->|TestQuality.json| R1
A6 -->|Performance.json| R1
A7 -->|DocumentationDx.json| R1
A2 --> H4
A3 --> H4
A4 --> H4
A5 --> H4
A6 --> H4
A7 --> H4
H4 -->|check analyzerReportStatus| S1
H4 -->|all reports present| A0
P4 -->|spawn Synthesizer| A8
A0 -->|runSubagent Synthesizer| H2
H2 -->|deny if missing reports| A0
H2 -->|allow if all present| H3
H3 --> P5
A8 -->|read all reports + write audit.md| R1
A8 --> H4
H4 --> P6
P6 -->|spawn Publisher| A9
A0 -->|runSubagent Publisher| H2
H2 --> H3
H3 --> P7
A9 -->|branch + commit + push + PR| R1
A9 --> H4
H4 --> P8
A0 -->|Stop requested| H5
H5 -->|block until Publisher done or max blocks| A0
S1 -->|PHASE_ALLOWED_AGENTS, PHASE_GUIDANCE, analyzerReportStatus| H2
S1 --> H3
S1 --> H4
S1 --> H5
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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 by Sourcery
Introduce a new strictly enforced audit workflow with orchestrator, agents, and hooks, and record the initial 2026-04-29 repository audit.
New Features:
Enhancements: