Remembered-secret search costs O(values x text) on every redaction call
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- go
- Lĩnh vực
- performance, security
Hướng nghiên cứu
Read internal/redact/redact.go around rememberedMatches and its caller, then trace the Remember calls in internal/seed/common.go and the infrastructure seed files. Compare candidate matching approaches and inspect how per-file and per-run limits could be reported. Done means one text pass without copying the global set, both caps with a run note, and a benchmark demonstrating improvement with 10,000 values.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Every redaction call copies all remembered token-like values into a new map and runs one substring search over the whole text per value. The number of values is set by the scanned tree, so a tree with many secret-named values in infrastructure files makes every tool call slow.
Where
internal/redact/redact.go:532-547(rememberedMatches)internal/redact/redact.go:348(called from every redaction-mode scan)internal/redact/redact.go:391(maxRemembered = 1 << 20)internal/seed/common.go:82,internal/seed/k8s.go:217,internal/seed/terraform.go:137,internal/seed/docker.go:154(Remembercallers)
Details
One call costs O(V) allocations plus O(V x len(text)) scanning, where V is the number of remembered values. The infrastructure checks call redact.Remember for every secret-named value in every Dockerfile, Kubernetes YAML and Terraform file, with no per-file or per-run cap below the global bound. A value of 12 or more token characters with a letter and a digit is global, so it is searched for in all text. This runs for every file the tools read or search for the first time, twice per tool result, once per new model message and once per lead.
Impact
Unmeasured; estimates from the code. With a few hundred values the cost is negligible. With about 10,000 token-like values (a monorepo with many generated manifests or variable files, or fixtures full of dummy credentials) each call makes 10,000 passes over its text: seconds per 1 MB file, so the first whole-target search of a run takes minutes. Near the bound, a scan effectively stops making progress, and tool calls are outside the model-call deadline.
Suggested fix
Match all remembered values in one pass: build an Aho-Corasick automaton (or a first-bytes index plus map lookup, since token-like values use a fixed character set) for the global set, rebuild it only when the set changes (a generation counter), and reuse it across calls. Iterate the global set under the read lock without copying it per call. Independently, cap token-like global values per file and per run well below the current bound and note in the run when the cap was hit.
Acceptance criteria
- One pass over the text per call, whatever the number of values
- No per-call copy of the global set
- A per-file and per-run cap with a run note when it is hit
- A benchmark with 10,000 values shows the improvement
Getting started
- Relevant files: internal/redact/redact.go, internal/seed/common.go
- How to run tests:
make test-short(Unix) or.\make.ps1 test-short(Windows PowerShell);make lintbefore you call it done - Related docs: CONTRIBUTING.md, docs/ARCHITECTURE.md
Filed by repo-audit/full-audit at 50e92ec. Severity: medium. Effort: M. audit-key: performance|internal/redact/redact.go|rememberedMatches
- Ngôn ngữ chính
- Go
- Star
- 0
- Fork
- 1
- Merge trung bình
- 8 giờ 14 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TMHSDigital/Spackle
-
ci good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
TMHSDigital/Spackle#206 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ci severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TMHSDigital/Spackle#205 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
TMHSDigital/Spackle#199 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue severity: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 87/100
TMHSDigital/Spackle#195 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue severity: medium
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
TMHSDigital/Spackle#188 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của TMHSDigital/Spackle
Issue tương tự
-
deskclose human-decided leaves the legacy decision-needed label and applies no human-decidedĐang mởbug effort:s impact:med raised-by:worker risk:low to:worker
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
medici-finance/assay#8120 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
factory:subtask
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
agent-substrate/substrate#4308 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
celestiaorg/celestia-app#8877 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sweep
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
bketelsen/truenas-mcp#112 ·
Maintainer thường phản hồi trong vòng 1 ngày