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

sign: throw on unsupported padding scheme #66

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

btj
Copy link
Contributor

@btj btj commented Feb 23, 2021

Do not silently apply the wrong padding scheme. Would have saved me hours of head-scratching and screen-staring.

@ljharb ljharb marked this pull request as draft September 18, 2023 18:14
Do not silently apply the wrong padding scheme.
@btj btj force-pushed the check-padding-scheme branch from 8a55c7a to 350ef83 Compare September 18, 2023 20:03
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

awesome, thanks! i'm happy to make the changes i suggested as part of the rebase i'll do once i land another PR that's queued up, and then this can be landed too :-)

@ljharb ljharb marked this pull request as ready for review September 18, 2023 20:10
@ljharb ljharb force-pushed the check-padding-scheme branch from 350ef83 to b6578f2 Compare September 18, 2023 20:55
@ljharb
Copy link
Member

ljharb commented Sep 18, 2023

yay, the tests are doing their job :-)

there's some failures, where older node isn't throwing an exception where the tests expect it i think?

@ljharb ljharb marked this pull request as draft September 18, 2023 21:21
@btj btj force-pushed the check-padding-scheme branch from b6578f2 to 3ef6cc0 Compare September 18, 2023 21:34
@btj
Copy link
Contributor Author

btj commented Sep 18, 2023

Actually, it seems that the check of the error message was too strict; I replaced it by a regex.

@ljharb ljharb marked this pull request as ready for review September 18, 2023 21:38
@ljharb
Copy link
Member

ljharb commented Sep 19, 2023

the 3 remaining failures seem legitimate

@ljharb ljharb marked this pull request as draft September 19, 2023 02:58
@btj btj force-pushed the check-padding-scheme branch from 3ef6cc0 to fb871f0 Compare September 19, 2023 08:39
@btj
Copy link
Contributor Author

btj commented Sep 19, 2023

First of all, the test messages were wrong: I had swapped 'browser' and 'node'. Old versions of Node.js do not support the padding option and therefore ignore it and never throw. Programs written against old Node versions will not include the padding option and therefore are not affected by the new throw statement in browserify. So I let the test run only for recent Node versions.

@btj btj force-pushed the check-padding-scheme branch from fb871f0 to e02aab6 Compare September 19, 2023 08:58
@btj
Copy link
Contributor Author

btj commented Sep 19, 2023

OK, it turned out the isNode10() function in the test suite is broken: it looks at the minor version instead of the major version. I fixed it so that the test suite now considers the major version.

Interestingly, this means the passphrase tests did run on many of the old Node versions tested, just not on 4.9 and 7.10. And they succeeded! Still, I now disabled these tests for major versions <= 10, as seemed to be intended.

@btj btj force-pushed the check-padding-scheme branch from e02aab6 to dcd81c6 Compare September 19, 2023 09:07
@btj
Copy link
Contributor Author

btj commented Sep 19, 2023

I now ran the passphrase tests on 4.9 on my machine, and they run just fine, so it seems better to simply enable them always. People might be depending on them working on old node versions.

@ljharb
Copy link
Member

ljharb commented Sep 19, 2023

Good catch! Let's switch those checks to use semver (v6), rather than string munging.

@ljharb ljharb force-pushed the check-padding-scheme branch from dcd81c6 to ce4e773 Compare September 20, 2023 06:23
@ljharb ljharb marked this pull request as ready for review September 20, 2023 06:23
@btj
Copy link
Contributor Author

btj commented Sep 20, 2023

Weird; I'm unable to reproduce the failure on node 8.0. On my machine, the test suite runs fine on node 8.0.

@ljharb
Copy link
Member

ljharb commented Sep 20, 2023

It works on node 8 latest, but fails for me on node 8.2, for example.

Support for the padding option was indeed added in 8.0, though, so maybe it was broken until v8.6? i'll update the skip logic.

@ljharb ljharb force-pushed the check-padding-scheme branch from ce4e773 to 8767739 Compare September 20, 2023 15:42
@ljharb ljharb merged commit 8767739 into browserify:master Sep 20, 2023
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