Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #33 +/- ##
==========================================
+ Coverage 95.15% 95.27% +0.11%
==========================================
Files 30 31 +1
Lines 1239 1269 +30
==========================================
+ Hits 1179 1209 +30
Misses 59 59
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds an obfuscation (reversible encryption) capability to the logger package so sensitive values can be logged in encrypted form and later recovered with the same key.
Changes:
- Introduces
(*Logger).Obfuscate/(*Logger).Unobfuscateimplemented with AEAD (GCM) and a!ENC!:{...}marker. - Extends
logger.Create(...)to accept acipher.Blockand propagate it to child loggers. - Adds an obfuscator test suite and documents usage in the README (plus dependency bumps).
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| obfuscator.go | Implements obfuscation/unobfuscation using cipher.Block + GCM and a marker-based encoding format. |
| logger.go | Adds storage/propagation of the obfuscation key and wires it into Create and child logger creation paths. |
| obfuscator_test.go | Adds test coverage for obfuscation, missing key behavior, and failure scenarios. |
| README.md | Documents the new obfuscation feature and how to use it. |
| go.mod / go.sum | Bumps a few dependencies as part of the merge. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ```go | ||
| log.Infof("This is some sensitive information: %s. Do not show it!", logger.Obfuscate(sensitiveData)) | ||
| ``` |
There was a problem hiding this comment.
The example calls logger.Obfuscate(...), but Obfuscate is a method on *Logger. Update the snippet to call it on the log instance created above.
README.md
Outdated
| ```go | ||
| log := logger.Create("MYAPP", cipherBlock) | ||
|
|
||
| fmt.Printf("Here is the data: %s", logger.Unobfuscate(obfuscatedData)) |
There was a problem hiding this comment.
The example calls logger.Unobfuscate(...) and ignores the returned error, but Unobfuscate is a *Logger method returning (string, error). Update the snippet to call log.Unobfuscate(...) and handle/propagate the error.
| fmt.Printf("Here is the data: %s", logger.Unobfuscate(obfuscatedData)) | |
| data, err := log.Unobfuscate(obfuscatedData) | |
| if err != nil { | |
| fmt.Printf("failed to unobfuscate data: %v", err) | |
| } else { | |
| fmt.Printf("Here is the data: %s", data) | |
| } |
|
@copilot review again |
Co-authored-by: gildas <56485+gildas@users.noreply.github.com>
Fix README documentation examples for obfuscator methods
Feature obfuscator. Do not delete the feature branch after the merge.