fix(security): credential redaction in 0f8b000 misses JSON bodies access_token, refresh_token, clientSecret, and password print verbatim with --verbose

Đang mở Phù hợp với người mới
#503 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
88/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
cli, security

Hướng nghiên cứu

Bắt đầu với redactSensitiveContent và các pattern hiện có, sau đó chạy pkg/config/redact_probe_test.go bằng go test ./pkg/config/ -run TestRedactProbe -v. Kiểm tra các vị trí gọi được nêu trong keycloak_client.go:96 và microcks_client.go:371. Hoàn tất khi sáu lỗi probe đều vượt qua và access_token, refresh_token, clientSecret cùng password không còn được in nguyên văn trong đầu ra verbose.

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

Mô tả

component/cli kind/bug

Problem

i added credential redaction to verbose HTTP dumps. It works for Authorization headers but misses both places where secrets actually appear.

Leak 1 Keycloak token response (keycloak_client.go:96)

The response body is JSON. The regex expects name=value (form encoding), so "access_token":"eyJ..." prints verbatim.

Leak 2 create-test request body (microcks_client.go:371)

OAuth2ClientContext is marshalled into the POST body. Fields clientSecret, password, and refreshToken aren't in the pattern at all.

The header redaction fires correctly, which is exactly what makes this easy to miss:

Authorization: [REDACTED]       ← works
{"oAuth2Context":{"clientSecret":"SECRET","password":"SECRET",...}}   ← leaks

Root Cause

// only matches name=value — never fires on JSON bodies
var sensitiveParamPattern = regexp.MustCompile(
    `(?i)(access_token|refresh_token|id_token|code)=([^&\s]+)`,
)

Apply it alongside the existing patterns in redactSensitiveContent.

Reproduce

Drop into pkg/config/redact_probe_test.go and run go test ./pkg/config/ -run TestRedactProbe -v — 6 FAILs, all confirmed against the real function.

Ngôn ngữ chính
Go
Star
52
Fork
67
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
13

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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 microcks/microcks-cli

Tất cả issue của microcks/microcks-cli

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.