Skip to content

Add a pull request privacy scan - #8

Merged
mikehaldas merged 1 commit into
mainfrom
cursor/privacy-scan-bc2d
Oct 14, 2026
Merged

mikehaldas merged 1 commit into
mainfrom
cursor/privacy-scan-bc2d

Conversation

@mikehaldas

Copy link
Copy Markdown
Owner

Summary

This adds a privacy check that runs on pull requests for every branch. The workflow calls .github/scripts/privacy_scan.py with the Python 3 standard library. No bot or model is involved.

The script checks added lines from the three-dot diff, the pull request title and body from the event payload, and commit messages from git log. A failure prints file:line and the rule name. Confidential-term matches are printed as [confidential term] and the matched text is not logged.

Copied from the privacy scan on viewtron-python-sdk (cursor/privacy-scan-cd16) without changing these files:

  • .github/scripts/privacy_scan.py
  • scripts/hash_terms.py
  • .github/privacy-scan-allow.txt
  • .github/privacy-scan-plates-approved.txt (the only approved plate is the fake test plate IB36NL)
  • tests/test_privacy_scan.py

This repository has no project test runner, so .github/workflows/privacy-scan.yml also installs pytest in a temporary virtualenv and runs tests/test_privacy_scan.py. That is the only change to the workflow. The README has a short Privacy scan section.

  • Term digests live in the PRIVACY_SCAN_TERMS secret: one SHA-256 hex line per lowercase term. The scanner hashes word n-grams of one to three words, and the same n-grams with spaces, hyphens, and underscores removed. If that secret is unset, the job warns and skips only that rule. Use scripts/hash_terms.py locally to build the digests.
  • Address matches are the 10/8, 172.16/12, 192.168/16, and 169.254/16 ranges. .github/privacy-scan-allow.txt still has no entries.
  • A plate hit is a digest from PRIVACY_SCAN_PLATES, a value in a plate field, or a quoted token of 4 to 8 uppercase letters and digits that contains a letter and a digit on a line that mentions plate, lpr, anpr, or the phrase license plate. Common tech tokens, model names with an ip-, lpr-, or nvr- prefix, and hex or uuid-like strings are ignored. .github/privacy-scan-plates-approved.txt contains one fake test plate, IB36NL, approved by Mike on 2026-10-14.

Scan of the repository tip

Tracked files at HEAD were scanned, along with the tip commit message. Term digests and plate digests were not configured in this environment, so those two digest checks were skipped with a warning. Counts are by rule and file. Matched text is omitted.

private-ip: 103

  • docs/api-reference/alarm/http-post-webhook-config.md: 4
  • docs/api-reference/alarm/legacy-alarm-server.md: 1
  • docs/api-reference/alarm/trigger-virtual-alarm.mdx: 5
  • docs/api-reference/events/ipc-event-format.md: 2
  • docs/api-reference/events/nvr-event-format.md: 9
  • docs/api-reference/events/real-time-target-tracking-traject.md: 1
  • docs/api-reference/image/get-snapshot.md: 2
  • docs/api-reference/ptz/ptz-control-movement.md: 3
  • docs/applications/active-deterrent-sound-light-alarm-api.mdx: 3
  • docs/applications/face-detection-recognition-api.mdx: 1
  • docs/applications/human-detection-intrusion-api.mdx: 1
  • docs/applications/license-plate-recognition-camera-api.mdx: 4
  • docs/applications/people-counting-traffic-analytics-api.mdx: 2
  • docs/applications/perimeter-security-line-crossing-api.mdx: 1
  • docs/applications/ptz-camera-control-api.mdx: 2
  • docs/applications/real-time-object-tracking-api.mdx: 1
  • docs/applications/relay-control-iot-automation-api.mdx: 4
  • docs/applications/video-snapshots-recording-search-api.mdx: 5
  • docs/applications/webhook-event-notification-api.mdx: 1
  • docs/getting-started/authentication.md: 3
  • docs/getting-started/http-post-setup.md: 2
  • docs/getting-started/python-sdk.md: 2
  • docs/getting-started/request-response-format.md: 4
  • docs/index.md: 2
  • docs/integrations/home-assistant.md: 3
  • docs/integrations/node-red.md: 1
  • docs/viewtron-api-guide.md: 20
  • examples/ipc-v1x/alarm-status.xml: 1
  • examples/ipc-v1x/keepalive.xml: 1
  • examples/nvr-v2/alarm-status.xml: 3
  • examples/nvr-v2/face-detection.xml: 1
  • examples/nvr-v2/keepalive.xml: 1
  • examples/nvr-v2/line-crossing.xml: 1
  • examples/nvr-v2/region-intrusion.xml: 1
  • examples/nvr-v2/target-counting-by-area.xml: 1
  • examples/nvr-v2/target-counting-by-line.xml: 1
  • examples/nvr-v2/vehicle-lpr.xml: 1
  • examples/nvr-v2/video-metadata.xml: 1
  • viewtron_client.py: 1

license-plate: 30

  • docs/api-reference/events/nvr-event-format.md: 1
  • docs/api-reference/smart-detection/license-plate-recognition-config.md: 5
  • docs/applications/license-plate-recognition-camera-api.mdx: 6
  • docs/getting-started/python-sdk.md: 4
  • docs/integrations/home-assistant.md: 3
  • docs/viewtron-api-guide.md: 5
  • examples/ipc-v1x/lpr.xml: 1
  • examples/nvr-v2/vehicle-lpr.xml: 1
  • viewtron_client.py: 4

The diff for this pull request has no findings. Local pytest: 35 passed. This pull request is a draft and is not merged.

Open in Web Open in Cursor 

Check added lines, the pull request title and body, and commit messages
on every branch. This repository has no project test runner, so the
workflow also runs the privacy scan tests.

Co-authored-by: Mike Haldas <mikehaldas@users.noreply.github.com>
@mikehaldas
mikehaldas marked this pull request as ready for review October 14, 2026 19:36
@mikehaldas
mikehaldas merged commit 3d33fdc into main Oct 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants