Skip to content

Guard add_word_list against reserved dictionary names#118

Merged
orien merged 1 commit into
masterfrom
guard-add-word-list-reserved-names
May 28, 2026
Merged

Guard add_word_list against reserved dictionary names#118
orien merged 1 commit into
masterfrom
guard-add-word-list-reserved-names

Conversation

@orien

@orien orien commented May 28, 2026

Copy link
Copy Markdown
Member

Context

TesterBuilder#add_word_list accepts any name. Passing a built-in dictionary name (e.g. "passwords") silently replaces the 30k built-in list with whatever the caller supplies. Passing "user_inputs" creates a permanent dictionary that is indistinguishable from per-call user inputs when filtering on match.dictionary_name.

Changes

  • Introduces Data::RESERVED_NAMES — the six built-in dictionary names plus "user_inputs".
  • add_word_list raises ArgumentError when the name is in that set.

Consequences

Callers using a reserved name get an immediate, descriptive error rather than silent misbehaviour. Any caller intentionally passing a built-in name to replace it will need to use a different name — this is a new API introduced in this release, so there is no backwards-compatibility concern.

`add_word_list("passwords", …)` silently replaced the 30k built-in list;
`add_word_list("user_inputs", …)` created a permanent dictionary
indistinguishable from per-call user inputs. Both now raise `ArgumentError`.
@orien orien force-pushed the guard-add-word-list-reserved-names branch from a989f60 to ea0acc9 Compare May 28, 2026 02:14
@orien orien merged commit 88a6fb6 into master May 28, 2026
10 checks passed
@orien orien deleted the guard-add-word-list-reserved-names branch May 28, 2026 02:16
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