Skip to content

Match the account name as a whole word in /doc-review's scrub - #139

Merged
mattmenefee merged 1 commit into
mainfrom
scrub-username-whole-word
Sep 16, 2026
Merged

mattmenefee merged 1 commit into
mainfrom
scrub-username-whole-word

Conversation

@mattmenefee

@mattmenefee mattmenefee commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • /doc-review's pre-publish scrub matched the account name from id -un as a bare substring, so any word containing it — and a public GitHub handle that begins with it — blocked a clean post. It fails closed, so nothing leaked, but a gate that routinely blocks harmless text teaches whoever runs it to work around it
  • The name now has to stand alone, bounded by anything other than a letter or digit. That still catches a home-directory path, the dash-encoded form in per-project directory names, an email address and the bare name in prose
  • The name is escaped before it enters the pattern, so an account name containing . or another regex metacharacter matches only itself
  • Found while posting the review for PR Make /doc-review record findings honestly and publish them safely #123, where the substring form blocked comments on words like "matters" and "formatting"

Test plan

  • markdownlint-cli with the repository's .markdown-lint.yml passes on doc-review.md
  • Pattern block extracted from the command and run under bash and zsh against a corpus: with the old pattern, ordinary words and the public handle were flagged; with the new one they are not, while a home path, a dash-encoded path, the bare name, an email address and a line consisting only of the name are all still flagged
  • Escaping checked with a dotted account name: john.doe is matched in a path and the look-alike johnxdoe is not
  • CI lint passes

The pre-publish scrub matched the account name from `id -un` as a
bare substring. Any ordinary word containing it tripped the gate, as
did a public GitHub handle that begins with it, so a clean review
could not be posted without overriding the scrub. A gate that blocks
harmless text teaches whoever runs it to work around it, which defeats
the reason it fails closed.

The name now has to stand alone, bounded by anything other than a
letter or digit. That still catches every form that identifies the
user: a home-directory path, the dash-encoded form in per-project
directory names, an email address and the bare name in prose. The
name is also escaped before it enters the pattern, since an account
name can contain a dot or another character the regular expression
would otherwise read as syntax.
@mattmenefee mattmenefee self-assigned this Sep 16, 2026
@mattmenefee
mattmenefee merged commit 505628d into main Sep 16, 2026
8 checks passed
@mattmenefee
mattmenefee deleted the scrub-username-whole-word branch September 16, 2026 21:08
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.

1 participant