Skip to content

feat: add safe configurable sensitive word detection - #26

Merged
kiku-jw merged 2 commits into
mainfrom
codex/sensitive-words-safe
Jul 28, 2026
Merged

feat: add safe configurable sensitive word detection#26
kiku-jw merged 2 commits into
mainfrom
codex/sensitive-words-safe

Conversation

@kiku-jw

@kiku-jw kiku-jw commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

  • preserve @Timik232’s configurable sensitive-word implementation and original commit authorship
  • prevent configured phrases from partially overriding higher-priority PII such as email addresses
  • support punctuation-ending terms and expose SENSITIVE_WORD consistently in API schemas, scores, policy, and docs

Supersedes #5 with the requested safety fix.

Verification

  • pytest --cov=app --cov-report=term-missing — 102 passed, 19 skipped, 83.33% coverage
  • ruff check app/
  • ruff format --check app/
  • git diff --check

Add SENSITIVE_WORD entity type that detects user-defined words
from MASKER_SENSITIVE_WORDS env var (comma-separated).

- Case-insensitive word boundary matching
- Lowest priority in overlap resolution (EMAIL/CARD/PHONE/PERSON win)
- Full support for detect, mask, and redact endpoints
- Policy entry in default.yaml

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c89dba773

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +239 to 240
all_entities = regex_entities + ner_entities + sensitive_entities
unique_entities = self._remove_overlaps(all_entities)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Filter entity types before resolving sensitive-word overlaps

When a caller requests only SENSITIVE_WORD, overlap resolution still considers unrequested PII and always gives it precedence. For example, with MASKER_SENSITIVE_WORDS=secret, masking secret@example.com with entities: ["SENSITIVE_WORD"] keeps the EMAIL match, discards the requested sensitive-word match, and then filters the email out, returning the input unchanged. Filter candidates before resolving overlaps so an unrequested entity cannot suppress an explicitly selected redaction.

Useful? React with 👍 / 👎.

@kiku-jw
kiku-jw force-pushed the codex/sensitive-words-safe branch from 0c89dba to 3436dff Compare July 28, 2026 16:22
@kiku-jw
kiku-jw merged commit 158ed95 into main Jul 28, 2026
2 checks passed
@kiku-jw
kiku-jw deleted the codex/sensitive-words-safe branch July 28, 2026 16:24
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