-
-
Notifications
You must be signed in to change notification settings - Fork 31
Release proposal: 2.0.0 #10
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
Open
UlisesGascon
wants to merge
8
commits into
expressjs:master
Choose a base branch
from
UlisesGascon:next-major
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
72f925c
feat: add Node@18 as the minimum version
UlisesGascon 3d101c4
feat: adapt CI to run on Node@18 and above
UlisesGascon b89021a
feat: rewrite to ES6
UlisesGascon 20d8b40
docs: improve documentation
UlisesGascon e49b536
feat: refactor Timing Safe Equal comparative using crypto library
UlisesGascon 6a1fe4c
2.0.0
UlisesGascon 8ff3362
docs: fix typos
UlisesGascon d87694a
ci: upgrade to actions/checkout@v4
UlisesGascon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,70 +1,40 @@ | ||
| name: ci | ||
|
|
||
| on: | ||
| - pull_request | ||
| - push | ||
| - pull_request | ||
| - push | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-20.04 | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| name: | ||
| - Node.js 0.10 | ||
| - Node.js 0.12 | ||
| - io.js 1.x | ||
| - io.js 2.x | ||
| - io.js 3.x | ||
| - Node.js 4.x | ||
| - Node.js 6.x | ||
| - Node.js 8.x | ||
| - Node.js 10.x | ||
| - Node.js 11.x | ||
| - Node.js 12.x | ||
| - Node.js 13.x | ||
| - Node.js 14.x | ||
| - Node.js 15.x | ||
| - Node.js 16.x | ||
| - Node.js 17.x | ||
| - Node.js 18.x | ||
| - Node.js 19.x | ||
| - Node.js 20.x | ||
| - Node.js 21.x | ||
| - Node.js 22.x | ||
| node-version: | ||
| - 18.x | ||
| - 19.x | ||
| - 20.x | ||
| - 21.x | ||
| - 22.x | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Node.js ${{ matrix.node-version }} | ||
| shell: bash -eo pipefail -l {0} | ||
| run: | | ||
| nvm install --default ${{ matrix.node-version }} | ||
| if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then | ||
| nvm install --alias=npm 0.10 | ||
| nvm use ${{ matrix.node-version }} | ||
| if [[ "$(npm -v)" == 1.1.* ]]; then | ||
| nvm exec npm npm install -g npm@1.1 | ||
| ln -fs "$(which npm)" "$(dirname "$(nvm which npm)")/npm" | ||
| else | ||
| sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")" | ||
| fi | ||
| npm config set strict-ssl false | ||
| fi | ||
| dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH" | ||
| - name: Set up Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
|
|
||
| - name: Install Node.js dependencies | ||
| run: npm install | ||
| - name: Install Node.js dependencies | ||
| run: npm install | ||
|
|
||
| - name: List environment | ||
| id: list_env | ||
| shell: bash | ||
| run: | | ||
| echo "node@$(node -v)" | ||
| echo "npm@$(npm -v)" | ||
| npm -s ls ||: | ||
| (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT" | ||
| - name: List environment | ||
| id: list_env | ||
| run: | | ||
| echo "node@$(node -v)" | ||
| echo "npm@$(npm -v)" | ||
| npm -s ls ||: | ||
| (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Run tests | ||
| shell: bash | ||
| run: | | ||
| npm test | ||
| - name: Run tests | ||
| run: npm test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lirantal any chance you can review this? 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
timingSafeEqualis indeed the best practice to follow for a timing safe comparison to avoid TOCTOU and side channel attacks that leak information about the username and password being used.However, secure timing comparison is useful when you are comparing hashes which always produce the same length, regardless of the input string length. Here, you are padding it, which could also end up with false positives. Buffer.alloc() will pad with zero length strings (`\x00') and if the input provided to you includes that byte sequence you'd have a false positive. Here's an example based on the above:
You'd expect res to be false but it is actually true.
You could fix it by filling with another byte like
... Buffer.alloc(maxLength - buf.length, 0x01)]));but my recommendation would be to completely drop the padding altogether and keep it simple and rely on thetimingSafeEqualto either throw if the length is different (which is ok and not a timing leak) or perform secure comparison if the length is the same.