🔒 Fix Insufficient Data Masking (Data Exposure) in helpers.ts#453
Conversation
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🎯 What: Improved the regular expressions used in
⚠️ Risk: The previous regexes were too strict (e.g., CCs required exactly 16 digits split by dashes/spaces in groups of four). This could lead to data exposure where unbroken strings of digits or cards with different lengths (like 15-digit Amex) were not redacted when logged or displayed.
src/helpers.ts(CC_REGEXandSSN_REGEX) for masking sensitive data.🛡️ Solution: Updated
CC_REGEXto/\b(?:\d[ -]*?){13,16}\b/gandSSN_REGEXto/\b\d{3}[-\s]?\d{2}[-\s]?\d{4}\b/gto catch various formats of credit card numbers and SSNs safely, without excessive backtracking. Reordered regex execution inmaskSensitiveDatato match Credit Cards before Phone numbers, preventing partial matches from exposing remaining digits. Added unit tests to verify behavior and prevent regressions.PR created automatically by Jules for task 10008601063142684167 started by @zknpr