sidecar-admin: enforce single-document and 256 KiB cap in survey readDocument #153
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.35) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 171 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.308
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #153"
general
weight: 0.35
aaronbrethorst
Closes #152
Summary
decodeSingleJSONhelper incmd/sidecar-admin/import.gocombiningcappedReadersize enforcement,DisallowUnknownFields(), and a trailingdec.Token()io.EOFcheck so bothimportandsurveyCLI commands reuse the same strict single-JSON decoder without duplication.readDocument(cmd/sidecar-admin/surveys.go) to decode throughdecodeSingleJSONcapped atmaxSurveyDocBytes(256 << 10, matchingadminSurveysHandler'smaxSurveyBodyininternal/httpapi/admin_surveys.go), rejecting concatenated JSON values, trailing non-whitespace tokens, and oversized inputs on both files and stdin (--file -).TestSurveyReadDocument_TrailingAndSizeCapincmd/sidecar-admin/surveys_test.gocovering trailing JSON objects/tokens, over-cap documents and trailing whitespace past the cap onsurvey create/survey edit, and acceptance at the exactmaxSurveyDocBytesboundary and valid trailing whitespace.Verification
gofmt -lon LF-normalized copies ofcmd/sidecar-admin/import.go,cmd/sidecar-admin/surveys.go, andcmd/sidecar-admin/surveys_test.gogo vet ./...TZ=Asia/Kathmandu go test -count=1 -v ./cmd/sidecar-admin/... -run 'TestSurvey|TestImport|TestDecodeDocument|TestStudy'TZ=Asia/Kathmandu go test -count=1 ./cmd/sidecar-admin/...