Repository navigation
fix(verification): decode gzip/deflate bodies before the S1 quote check - #169
Merged
Merged
Conversation
…quote check Compressed HTML responses are stored as captured, so the S1 receipt check saw them as binary and returned not_assessed. readBoundResponse now undoes the Content-Encoding declared in the snapshot's response head before the text/binary detection and the quote search. decodeEvidenceBody handles identity and a single layer of gzip or deflate (zlib-wrapped or bare), bounded by verificationReadCap on the decoded side. Any other coding, stacked codings, or a stream that fails to decode is an error, which the caller reports as not_assessed (evidence body unreadable). The stored evidence bytes are unchanged.
…uote A response captured with Content-Encoding: gzip and no body (HEAD, 304) is decoded to an empty body without error. Pin that behaviour, and pin that an empty body, compressed or not, matches no non-empty quote through readBoundResponse and quoteInBodies, so it can never lead to a verified finding.
Merged
usinfosec
pushed a commit
to usinfosec/ARTEX
that referenced
this pull request
Nov 17, 2026
sseUrl() 原先无条件把 SSE 地址拼成 ${hostname}:8787,连生产静态导出
也带这个硬编码。反代到 443 的部署里页面从 https://域名/ 加载,SSE 却被
指向 https://域名:8787/...,而 8787 未对公网开放,导致活动流连不上、反复重连。
改为用 NODE_ENV 区分:生产默认同源(相对路径),仅 next dev 保留 :8787
以绕过 Next.js /api 反代对 SSE 的缓冲。NEXT_PUBLIC_SSE_BASE 覆盖口保留。
验证:NEXT_EXPORT=1 next build 后生产包里 :8787 分支已被 tree-shake。
补充 README 反向代理部署文档(同源说明 + nginx 关缓冲配置)。
Closes BaaRai#169
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.
What
Verification S1 now decodes HTTP
Content-Encodingon bound response bodies before the quote check. Captured HTML that the proxy stores gzip-compressed was seen as binary and always came backnot_assessed, so an exact quote could never verify such a finding.decodeEvidenceBody: gzip or deflate (zlib or raw), one layer only, output capped at 4 MiB decoded. Invalid, truncated or unknown encodings are errors (fail-closed); the raw bytes are never returned in their place.readBoundResponsedecodes after the raw read; the stored bytes are unchanged.assessFindingVerificationis unchanged: an unreadable body still givesnot_assessed.Decisions to review
Content-Encoding: gzip(HEAD, 304) is not an error. It is safe because an empty text body cannot validate a quote.not_assessed, with the noteevidence body unreadable: unsupported content-encoding.Verification
go build ./...,go vet ./server/: pass. gofmt clean on the CR-stripped content.go test ./server/ -run 'TestDecodeEvidenceBody|TestDecodeBoundResponse': 13 pass, no Postgres needed.TestVerification*tests, which need Postgres. The end-to-end path from a gzip body toverifiedis therefore not exercised yet. CI runs them against Postgres.Do not merge before
go,shellandwebare green on the exact head SHA.