fix: increase redactValue threshold from 8 to 20 chars#1820
fix: increase redactValue threshold from 8 to 20 chars#1820devin-ai-integration[bot] wants to merge 3 commits into
Conversation
Co-Authored-By: Gabriel Moura <gabriel.moura@paella.dev>
Co-Authored-By: Gabriel Moura <gabriel.moura@paella.dev>
Original prompt from Gabriel
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
🦋 Changeset detectedLatest commit: 464dd21 The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
packages/common/base/src/logger/utils.ts:40-43
**Consider adding a boundary test for the new threshold**
There are no unit tests covering the `redactValue` threshold change. A test asserting that a 20-character string returns `[REDACTED]` and a 21-character string returns the `first4...last4` form would lock in the intended behavior and catch regressions at the boundary.
Reviews (1): Last reviewed commit: "chore: add changeset for redact threshol..." | Re-trigger Greptile |
|
Reviews (2): Last reviewed commit: "test: add boundary tests for redactValue..." | Re-trigger Greptile |
|
Reviews (3): Last reviewed commit: "test: remove redundant non-string test c..." | Re-trigger Greptile |
|
Reviews (4): Last reviewed commit: "test: restore non-string sensitive value..." | Re-trigger Greptile |
Co-Authored-By: Gabriel Moura <gabriel.moura@paella.dev>
ac3bf58 to
464dd21
Compare
|
Reviews (5): Last reviewed commit: "test: add boundary tests for redactValue..." | Re-trigger Greptile |
There was a problem hiding this comment.
Did you do this properly using the bump version command?
Description
The
redactValuefunction in the SDK logger was using a threshold of 8 characters to decide whether to show a truncated preview (first 4 + last 4 chars) or fully redact the value. This meant a 9-character sensitive string like an API key would display as1234...6789, exposing nearly the entire value.This change increases the threshold to 20 characters so that strings of 20 chars or fewer are fully replaced with
[REDACTED], and only strings longer than 20 chars show thefirst4...last4preview.Test plan
packages/common/base/src/logger/utils.test.tsverifying:pnpm lint— no issuesPackage updates
@crossmint/common-sdk-base: patch — changeset added via.changeset/increase-redact-threshold.mdLink to Devin session: https://crossmint.devinenterprise.com/sessions/31b246f034b643978fdc43ee10048653
Requested by: @gabriel-moura-dev