Closed (fixed)
Project:
Password Policy
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
1 Mar 2016 at 10:48 UTC
Updated:
10 Mar 2022 at 16:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
sophie.skPatch attached. Includes unit testing.
Comment #3
sophie.skChanging category to feature request, as it kind of is that.
Comment #4
sophie.skAn interesting thing to note: I upgraded this because our client has a need for blacklisting the 10,000 most common passwords. These are exported as a single-line string in the config, as
blacklist: one\ntwo\nthree\n....For me, working locally on Ubuntu 14.04 with a standard LAMP stack, this 112,000-character long string causes Apache to segfault and restart when I try to import the config (as part of a module install).
I had to change the format to
Which then imported fine ... I just can't find a way of editing how the config is exported.
I suppose there's never really going to be many people who have that many blacklisted passwords, but it's something worth bearing in mind and possibly trying to find a way around - I certainly couldn't find anything :(
Comment #5
nerdsteinThanks for helping out with this, I'll review it. And, I am behind on reviewing the other issue as well. I'll try to take care of both as soon as possible.
Comment #6
nerdsteinIn the schema...
This should likely be a sequence of strings to support an array of blacklisted passwords.
Example found in config/schema/password_policy.schema.yml:
You can see the code that saves this sequence in src/Form/PasswordPolicyRolesForm.php
More feedback...
To support the sequence, you'll need to make this a text field with unlimited cardinality. I might recommend moving up the 'match_substrings' checkbox above it, because this list might get long.
error_message = @Translation("Your password contains restricted words or phrases.")Does this cover both "match substrings" and "exact match" searches?
Comment #7
nerdsteinCan you please take a stab at implementing this feedback?
Comment #8
nerdsteinMarking as 'needs work'
Comment #9
sophie.skAgree that the schema file might not have been the best (I couldn't find any useful documentation), but... the whole reason I upgraded this constraint was because our client has 10,000 passwords that they want to blacklist. I'd rather not change it so we have to input each password by hand, unless that really is the only way of making the config work.
Will take a look at the rest when I have a moment this week.
Comment #10
bisonbleu commentedHello, is the patch in #2 viable ? I'm wondering what its status is considering the fact that it's been dormant for 3 years.
Comment #11
hmendes commentedHello,
I changed the patch to be available to the Drupal9 version, and changed the approach in the patch from #2 to export a array, instead of a string (as shown in the image).
I didn't changed the $form['blacklist'] because it's working without this change and I think that creating a field with unlimited cardinality would be too much information on the screen, with multiple text fields...
Changing this to Needs Review.
Comment #12
hmendes commentedComment #14
hmendes commentedSorry, forgot to change the tests.
Comment #15
marcusvsouza commentedThe patch works as expected
Steps performed:
1. Installed the module
2. Enable the module
3. Create a constraint type blacklist
4. Create a list of forbidden passwords
5. Test the passwords in the list
6. Test the code with phpcs against the module directory
In the last step I found some errors, se the files attached.
Comment #16
hmendes commentedFixing the problems reported in #15 and also removing the old patch from inside the patch.
Comment #17
marcusvsouza commentedI tested again with phpcs against the password_policy_blacklist folder inside the module folder and no errors returned.
moving to RTBC
Comment #19
paulocsFixed error
implode(): Argument #2 ($array) must be of type ?array, string given in implodeon commit.Thanks!