Refine PiiExposureExtractor to reduce false positives for common serializers#19
Conversation
Refined the `MASK_CALL_NEAR` and `PROJECTION` regexes to accommodate common
benign serialization and omission patterns across web frameworks, including:
- Lodash `omit(user, ...)`
- Prisma `.omit` inside queries
- Mongoose `.select('-email')`
- `.toJSON()` overrides
- Custom `anonymize*` and `sanitize*` functions
- Data-transform methods like `UserPresenter.present(user)`
Added 8 test snippets in `tests/test_pentest_regressions.py` under
`test_benign_serializers_dont_trigger` to prevent future regressions.
Updated `CHANGELOG.md` to reflect these improvements.
|
👋 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
PiiExposureExtractorfalsely triggered "raw-entity-pii-response" alerts for endpoints that handled PII fields safely but omitted them using standard tools like Lodashomit(), Prisma queries withomit: { email: true }, or Mongoose queries with.select('-email').This change:
MASK_CALL_NEARto recognizeomit(,exclude(,anonymize*(,sanitize*(,.toJSON(, and.present(.PROJECTIONto recognize Mongoose's.select(and Prisma'somit: {.docguard guardpasses.PR created automatically by Jules for task 3558047650001590058 started by @raccioly