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

test: update test to support OpenSSL32 #54968

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

mhdawson
Copy link
Member

@mhdawson mhdawson commented Sep 16, 2024

Refs: #53382

This test fails on OpenSSL32 because it complains the key being
used is too short.

It seems to have been missed when the test suite was udpated to have
a Makefile to generate key material as the keys are hard coded in the
test as opposed to being read in from the fixtures/key directory.

Update the test to use keys/certs from the fixtures directory and
to remove newlines at the end of the key and cert to retain the
inteded test.

Signed-off-by: Michael Dawson midawson@redhat.com

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Sep 16, 2024
@RedYetiDev RedYetiDev added the openssl Issues and PRs related to the OpenSSL dependency. label Sep 16, 2024
@lpinca
Copy link
Member

lpinca commented Sep 16, 2024

Both test/fixtures/keys/rsa_private.pem and test/fixtures/keys/rsa_cert.crt have trailing newlines.

Copy link

codecov bot commented Sep 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.06%. Comparing base (c1afd2c) to head (a2373be).
Report is 32 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #54968      +/-   ##
==========================================
- Coverage   88.06%   88.06%   -0.01%     
==========================================
  Files         652      652              
  Lines      183545   183545              
  Branches    35866    35865       -1     
==========================================
- Hits       161639   161637       -2     
- Misses      15150    15156       +6     
+ Partials     6756     6752       -4     

see 27 files with indirect coverage changes

@mhdawson
Copy link
Member Author

mhdawson commented Sep 16, 2024

@lpinca how do you see that? I'm looking at the files on disk (linux) and I don't see any newlines. I also don't see anything that would indicate that there are newlines in the UI either -> https://github.com/nodejs/node/blob/main/test/fixtures/keys/rsa_private.pem, but maybe I have a setting that would hide that?

@richardlau
Copy link
Member

$ od -h test/fixtures/keys/rsa_private.pem
0000000 2d2d 2d2d 422d 4745 4e49 5220 4153 5020
...
0003200 5649 5441 2045 454b 2d59 2d2d 2d2d 000a
0003217
$

@mhdawson
Copy link
Member Author

ok. my bad I may have been looking for the carriage return instea of the new line. Anyway I'll update to keep the test with larger keys.

Refs: nodejs#53382

This test fails on OpenSSL32 because it complains the key being
used is too short.

It seems to have been missed when the test suite was udpated to have
a Makefile to generate key material as the keys are hard coded in the
test as opposed to being read in from the fixtures/key directory.

Update the test to use keys/certs from the fixtures directory and
to remove newlines at the end of the key and cert to retain the
inteded test.

Signed-off-by: Michael Dawson <midawson@redhat.com>
@mhdawson mhdawson changed the title test: remove test that is no longer needed test: update test to support OpenSSL32 Sep 16, 2024
@mhdawson
Copy link
Member Author

@lpinca , @richardlau fixed. Thanks for catching my mistake :)

@mhdawson
Copy link
Member Author

mhdawson commented Sep 16, 2024

Comment on lines 37 to 39
if (key[key.length - 1] === 0x0A) {
key = key.slice(0, key.length - 1);
}
Copy link
Member

Choose a reason for hiding this comment

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

let i = 0;
while (key[key.length - 1 - i] === 0x0a) i++;
if (i !== 0) key = key.slice(0, key.length - i);

There might be multiple trailing newlines.

Copy link
Member Author

Choose a reason for hiding this comment

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

@lpinca added that for both key and cert.

Signed-off-by: Michael Dawson <midawson@redhat.com>
@mhdawson mhdawson added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 17, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 17, 2024
@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@richardlau richardlau left a comment

Choose a reason for hiding this comment

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

Non-blocking suggestion:
Perhaps assert that there is no newline at the end of the array in case someone modifies the test later?

@mhdawson
Copy link
Member Author

@richardlau since I have a green CI I'd like to go ahead and land, but will add that in a follow on PR.

@richardlau richardlau added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Sep 18, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 18, 2024
@nodejs-github-bot nodejs-github-bot merged commit f8b7a17 into nodejs:main Sep 18, 2024
59 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in f8b7a17

mhdawson added a commit to mhdawson/io.js that referenced this pull request Sep 18, 2024
Refs: nodejs#54968
Refs: nodejs#53382

Add additional asserts as suggestd by Richard in:
nodejs#54968

Signed-off-by: Michael Dawson <midawson@redhat.com>
mhdawson added a commit that referenced this pull request Sep 20, 2024
Refs: #54968
Refs: #53382

Add additional asserts as suggestd by Richard in:
#54968

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: #54997
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Sep 24, 2024
Refs: nodejs#53382

This test fails on OpenSSL32 because it complains the key being
used is too short.

It seems to have been missed when the test suite was udpated to have
a Makefile to generate key material as the keys are hard coded in the
test as opposed to being read in from the fixtures/key directory.

Update the test to use keys/certs from the fixtures directory and
to remove newlines at the end of the key and cert to retain the
inteded test.

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: nodejs#54968
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Sep 24, 2024
Refs: nodejs#54968
Refs: nodejs#53382

Add additional asserts as suggestd by Richard in:
nodejs#54968

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: nodejs#54997
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Sep 25, 2024
Refs: nodejs#53382

This test fails on OpenSSL32 because it complains the key being
used is too short.

It seems to have been missed when the test suite was udpated to have
a Makefile to generate key material as the keys are hard coded in the
test as opposed to being read in from the fixtures/key directory.

Update the test to use keys/certs from the fixtures directory and
to remove newlines at the end of the key and cert to retain the
inteded test.

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: nodejs#54968
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Sep 25, 2024
Refs: nodejs#54968
Refs: nodejs#53382

Add additional asserts as suggestd by Richard in:
nodejs#54968

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: nodejs#54997
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
richardlau pushed a commit to aduh95/node that referenced this pull request Sep 27, 2024
Refs: nodejs#53382

This test fails on OpenSSL32 because it complains the key being
used is too short.

It seems to have been missed when the test suite was udpated to have
a Makefile to generate key material as the keys are hard coded in the
test as opposed to being read in from the fixtures/key directory.

Update the test to use keys/certs from the fixtures directory and
to remove newlines at the end of the key and cert to retain the
inteded test.

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: nodejs#54968
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
richardlau pushed a commit to aduh95/node that referenced this pull request Sep 27, 2024
Refs: nodejs#54968
Refs: nodejs#53382

Add additional asserts as suggestd by Richard in:
nodejs#54968

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: nodejs#54997
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit that referenced this pull request Oct 4, 2024
Refs: #53382

This test fails on OpenSSL32 because it complains the key being
used is too short.

It seems to have been missed when the test suite was udpated to have
a Makefile to generate key material as the keys are hard coded in the
test as opposed to being read in from the fixtures/key directory.

Update the test to use keys/certs from the fixtures directory and
to remove newlines at the end of the key and cert to retain the
inteded test.

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: #54968
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
targos pushed a commit that referenced this pull request Oct 4, 2024
Refs: #54968
Refs: #53382

Add additional asserts as suggestd by Richard in:
#54968

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: #54997
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@aduh95 aduh95 mentioned this pull request Oct 9, 2024
louwers pushed a commit to louwers/node that referenced this pull request Nov 2, 2024
Refs: nodejs#53382

This test fails on OpenSSL32 because it complains the key being
used is too short.

It seems to have been missed when the test suite was udpated to have
a Makefile to generate key material as the keys are hard coded in the
test as opposed to being read in from the fixtures/key directory.

Update the test to use keys/certs from the fixtures directory and
to remove newlines at the end of the key and cert to retain the
inteded test.

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: nodejs#54968
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
louwers pushed a commit to louwers/node that referenced this pull request Nov 2, 2024
Refs: nodejs#54968
Refs: nodejs#53382

Add additional asserts as suggestd by Richard in:
nodejs#54968

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: nodejs#54997
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. openssl Issues and PRs related to the OpenSSL dependency. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants