Skip to content

Reject trailing newlines in MAC addresses and regional identifiers - #501

Open
xiehuanyi wants to merge 1 commit into
python-validators:masterfrom
xiehuanyi:fix/validators-full-values
Open

xiehuanyi wants to merge 1 commit into
python-validators:masterfrom
xiehuanyi:fix/validators-full-values

Conversation

@xiehuanyi

Copy link
Copy Markdown
Contributor

MAC addresses, Finnish business IDs/SSNs, French SSNs, and Indian Aadhaar numbers currently accept a final newline because $ can match before it. For example, mac_address("01:23:45:67:ab:CD\n") returns True.

Use full matches for these complete identifier patterns while preserving their existing alphabets and checksum rules. Add a shared 35-case regression covering valid values and trailing LF, CRLF, spaces, and extra text.

Validation: the regression fails in 7 cases on unchanged master; all 1,162 tests and doctests pass after the fix. Ruff lint and formatting, Pyright (0 errors), and Bandit checks pass.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 11:30

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
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