[log] Add debug logging to internal/hmacutil - #12192
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The new logging behavior lacks tests, and the logger name violates the repository’s naming convention.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds safe debug tracing to HMAC signing and verification.
Changes:
- Adds a file-scoped logger.
- Logs input lengths and verification outcomes without sensitive contents.
File summaries
| File | Description |
|---|---|
internal/hmacutil/hmacutil.go |
Adds debug logging around HMAC operations. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "github.com/github/gh-aw-mcpg/internal/logger" | ||
| ) | ||
|
|
||
| var log = logger.ForFile() |
|
|
||
| // Sign returns the HMAC-SHA256 signature for message using key. | ||
| func Sign(key []byte, message string) []byte { | ||
| log.Printf("Signing message: keyLen=%d, messageLen=%d", len(key), len(message)) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@copilot address review feedback |
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
🔒 mcpg Read-Only Stress — gVisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE Notes:
References: §33405863846
|
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
|
🔒 mcpg Read-Only Stress — docker-sbxSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No writes leaked through on any surface. The overall enforcement guarantee holds, but gateway-specific (DIFC) enforcement was not directly exercised in this run due to backend read-only mode and invalid
|
Summary
Adds debug logging to
internal/hmacutil/hmacutil.go, which previously had no logging infrastructure at all.Changes
var log = logger.ForFile()(namespacehmacutil:hmacutil)Sign: logs key/message lengths on entry and signature length on completionVerify: logs key/message/MAC lengths on entry and whether verification succeeded or failedNo side effects were introduced in log arguments (only length/boolean values are logged, never key or message contents, to avoid leaking sensitive data).
Validation
go build -o awmg .— succeedsgo vet ./internal/hmacutil— cleango test ./internal/hmacutil— passesEnable with
DEBUG=hmacutil:* ./awmg --config config.toml.