Skip to content

feat(risk-presidio): drop IPv6 short-form and IPv4 unspecified IP false positives#2915

Merged
mfbx9da4 merged 3 commits into
mainfrom
da/presidio-fp-ipv6-shortform
May 19, 2026
Merged

feat(risk-presidio): drop IPv6 short-form and IPv4 unspecified IP false positives#2915
mfbx9da4 merged 3 commits into
mainfrom
da/presidio-fp-ipv6-shortform

Conversation

@mfbx9da4
Copy link
Copy Markdown
Contributor

Why

Production risk_results analysis on the read replica (1.38M total matches) showed Presidio's IP_ADDRESS detector dominating noise — 1.03M of the 1.38M findings, 75% of all triggered risks, come from a single entity type, almost all of them not-actually-IP text fragments.

Breakdown of the noise:

Match pattern Hits
:: (already filtered) 1,006,890
IPv6 short-form <hex>:: (b::, ad::, bed::, dead::, 1::, 2::, 3::, 5::, d::, deaf::, fad::) ~17,500
0.0.0.0 ~640 (across IP_ADDRESS + pii.ip_address)

These come from hex constants, partial address text in logs/code, and 0.0.0.0 bind-address literals. None of them are addresses anyone meaningfully uses.

What

Extend isPresidioFalsePositive to drop:

  1. All unspecified addresses via netip.ParseAddr(...).IsUnspecified() — automatically covers ::, ::0, 0::0, 0:0:0:0:0:0:0:0 (existing), 0.0.0.0 (new), and any other spelling Go's parser recognizes.
  2. IPv6 short-form <hex>:: via regex ^[0-9a-f]{1,4}::$ — catches the new ~17k class.

::1 (loopback) and dead::beef (two-group IPv6) are deliberately preserved as real addresses — covered by existing + new test cases.

Test plan

  • Unit tests in presidio_internal_test.go updated to cover 0.0.0.0, b::, dead::, 1::, DEAF:: (case-insensitive), and the dead::beef / ::1 negative cases
  • go vet ./internal/background/activities/risk_analysis/... clean
  • go test ./internal/background/activities/risk_analysis/ -run 'IsPresidioFalsePositive|FiltersIPv6Unspecified' passes

@mfbx9da4 mfbx9da4 requested a review from a team as a code owner May 19, 2026 10:44
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gram-docs-redirect Ready Ready Preview, Comment May 19, 2026 10:52am

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 19, 2026

🦋 Changeset detected

Latest commit: 0940bde

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
server Patch

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

Prompt-injection risk report

Corpus: 933 cases (384 malicious / 549 benign)
This PR: 9331fe91 · 2026-05-19T10:53:50Z

No main baseline artifact found yet; this comment shows the current run only.

Operational Modes

mode status total TP FP FN precision recall F1 FP-rate
L0 only ok 933 76 0 308 1 0.1979 0.3304 0
L0 + L1 opt-in skipped - - - - - - - -

L1 opt-in was not evaluated in this run: classifier URL is not set.

Generated by .github/scripts/risk-metrics-comment.py. Full source/rule breakdown and samples are in the risk-accuracy-metrics artifact.

Comment thread server/internal/background/activities/risk_analysis/presidio.go
@github-actions github-actions Bot added the preview Spawn a preview environment label May 19, 2026
@speakeasybot
Copy link
Copy Markdown
Collaborator

speakeasybot commented May 19, 2026

🚀 Preview Environment (PR #2915)

Preview URL: https://pr-2915.dev.getgram.ai

Component Status Details Updated (UTC)
✅ Database Ready Existing database reused 2026-05-19 10:58:15.
✅ Images Available Container images ready 2026-05-19 10:57:59.

Gram Preview Bot

@mfbx9da4 mfbx9da4 changed the title feat(risk/presidio): drop IPv6 short-form and IPv4 unspecified IP false positives feat(risk-presidio): drop IPv6 short-form and IPv4 unspecified IP false positives May 19, 2026
@mfbx9da4 mfbx9da4 added this pull request to the merge queue May 19, 2026
Merged via the queue into main with commit 1562656 May 19, 2026
30 checks passed
@mfbx9da4 mfbx9da4 deleted the da/presidio-fp-ipv6-shortform branch May 19, 2026 11:35
@github-actions github-actions Bot locked and limited conversation to collaborators May 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

preview Spawn a preview environment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants