Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 - allow all symbols by default, set the default min length to 12 instead of 10, fix license filename (fix #78) #81

Merged
merged 8 commits into from
Dec 18, 2024

Conversation

Ennoriel
Copy link
Collaborator

@Ennoriel Ennoriel commented Dec 2, 2024

  • allow all symbols by default (any character except the 26 latin lowercase, uppercase letters and 10 digits)
  • set the default min length to 12 instead of 10
  • fix license filename

@deanilvincent could you please review this PR that allows all symbols by default (fix #78)? I also increased the default minlength since it's quite common to see a minlength of 12 nowadays.

I did not increase the version in the readme. Since it is a breaking change, it should go to version 3.0.0.

I also cleaned and simplified the README.

@Ennoriel Ennoriel mentioned this pull request Dec 2, 2024
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

Jshint (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

dist/index.mjs Outdated
regex: '[0-9]',
message: 'number'
key: "symbol",
regex: restrictSymbolsTo ? `[${restrictSymbolsTo}]` : "[^a-zA-Z0-9]",
Copy link

@jbrower2 jbrower2 Dec 2, 2024

Choose a reason for hiding this comment

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

it's not documented that restrictSymbolsTo needs to be a valid string for inside a character class in a regular expression. i'd recommend using escape-string-regexp here (then cleaning up owaspSymbols to get rid of the extra \s)

Copy link

Choose a reason for hiding this comment

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

for example, passing $][& for restrictSymbolsTo would require that the password match [$][&], so the strings x$x, x&x, and x&$x would not match, but x$&x would.

Copy link

Choose a reason for hiding this comment

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

additionally, ,-. in the owaspSymbols string will technically get interpreted as "any character from , to ." because of the -. in reality, the only character between , and . in the ascii table is -, so it's fine, but this feels like a potential bug if the symbols in that string ever get rearranged. (but escaping the string like i laid out above would solve this problem)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are right. I added the library which is extremely tiny. I added the necessary information in the doc.

Copy link
Owner

@deanilvincent deanilvincent left a comment

Choose a reason for hiding this comment

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

Hi @Ennoriel,
Amazing changes! 🥳 🎆 I also tested it on my local and everything seems fine

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

2 similar comments
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@deanilvincent deanilvincent merged commit 4710110 into master Dec 18, 2024
7 checks passed
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.

What are the affected if input with wrong symbols
3 participants