Remembered-secret eviction and three single-line network guards have no test

Đang mở
#202 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
78/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
testing

Hướng nghiên cứu

Read the four listed locations in internal/redact/redact.go, internal/llm/offline.go, internal/dast/client.go, and internal/authz/scope.go, then inspect the related tests and CONTRIBUTING.md. Add tests for eviction bookkeeping, redirect refusal, User-Agent validation, and invalid request ports; use a reduced eviction bound as suggested. Run make test-short and make lint; done means all four protections have tests that fail if the guarded behavior is removed.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

good first issue severity: low testing

Summary

Four small pieces of protective code are at zero coverage and their behavior is asserted in no test, so each can be deleted or inverted with every test green.

Where

  • internal/redact/redact.go:391, :473, :486 (maxRemembered, forgetOldest)
  • internal/llm/offline.go:83 (provider client refuses redirects)
  • internal/dast/client.go:142 (User-Agent with CR, LF or NUL refused)
  • internal/authz/scope.go:325 (request URL port outside 1 to 65535 refused)

Details

  • Eviction of remembered values. forgetOldest drops every value of the oldest file and adjusts the process-wide reference counts. The bound is the constant 1 << 20, so a test cannot reach it. Make the bound a package variable (or add an unexported setter used with t.Cleanup) and test with a bound of about 8: values of the oldest file stop matching, a value shared with a newer file is still redacted, a single file over the bound evicts nothing, and an alias of an evicted file no longer matches.
  • Provider redirect refusal. The comment says it keeps an API key from being replayed to another host; the word "redirect" does not occur in the llm tests. Test: an httptest server answers 307 to a second server; each provider returns an error and the second server receives nothing.
  • User-Agent validation. Test: NewClient with a User-Agent containing CRLF returns an error and sends nothing.
  • Request port range. Scope entries with bad ports are tested; a request URL with one is not. Test: Permits on a URL with port 99999 and port 0 is refused.

Impact

A long-running process such as the MCP server depends on the eviction bookkeeping to keep redacting values; the three guards each protect a boundary (provider key, live-target request headers, scope).

Suggested fix

See the checklist above.

Acceptance criteria

  • Each of the four items has a test that fails when the guarded line is removed

Related: #28

Getting started

  • Relevant files: internal/authz/scope.go, internal/dast/client.go, internal/llm/offline.go, internal/redact/redact.go
  • How to run tests: make test-short (Unix) or .\make.ps1 test-short (Windows PowerShell); make lint before you call it done
  • Related docs: CONTRIBUTING.md, docs/ARCHITECTURE.md

Filed by repo-audit/full-audit at 50e92ec. Severity: low. Effort: S. audit-key: testing|internal/redact/redact.go|forgetOldest

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

Mở trong Codespaces

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.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TMHSDigital/Spackle

Tất cả issue của TMHSDigital/Spackle

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.