Repository navigation
Conversation
Signed-off-by: lazerg <lazerg2@gmail.com> Assisted-by: Claude Code
|
Review requested:
|
|
Caution AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #66694 +/- ##
==========================================
- Coverage 90.47% 90.47% -0.01%
==========================================
Files 791 791
Lines 277088 277246 +158
Branches 53286 53315 +29
==========================================
+ Hits 250703 250833 +130
- Misses 16805 16813 +8
- Partials 9580 9600 +20
🚀 New features to boost your workflow:
|
|
CI: https://ci.nodejs.org/job/node-test-pull-request/78352/ |
pimterry
left a comment
There was a problem hiding this comment.
Test needs a mechanical fix to get FIPS passing, but otherwise all LGTM
Signed-off-by: lazerg <lazerg2@gmail.com> Assisted-by: Claude Code
| const assert = require('assert'); | ||
| const fixtures = require('../common/fixtures'); | ||
| const { hasOpenSSL, isBoringSSL } = require('../common/crypto'); | ||
| const { hasFIPS, hasOpenSSL, isBoringSSL } = require('../common/crypto'); |
There was a problem hiding this comment.
The suggestion below makes this import unnecessary.
| const { hasFIPS, hasOpenSSL, isBoringSSL } = require('../common/crypto'); | |
| const { hasOpenSSL, isBoringSSL } = require('../common/crypto'); |
| { | ||
| // EC certificate on a curve without a NIST name (brainpoolP256r1). | ||
| const certPem = `-----BEGIN CERTIFICATE----- | ||
| MIIBfzCCASagAwIBAgIUcZKohGvML9PeBwQtylddAdUU3nkwCgYIKoZIzj0EAwIw | ||
| FDESMBAGA1UEAwwJYnJhaW5wb29sMCAXDTI2MTAxMjE0NDczMVoYDzIxMjYwOTE4 | ||
| MTQ0NzMxWjAUMRIwEAYDVQQDDAlicmFpbnBvb2wwWjAUBgcqhkjOPQIBBgkrJAMD | ||
| AggBAQcDQgAEKnP14jKQEUyWxWhXrs+ql7OlMy0EW3mnYTvwkF8VyYsPB9dBUJOW | ||
| 8IHqIik0kjQVSVhtLH0j+hveyZvGd0aQq6NTMFEwHQYDVR0OBBYEFNx4uQEsAiNZ | ||
| zcrKuAZ9/9d1eIeDMB8GA1UdIwQYMBaAFNx4uQEsAiNZzcrKuAZ9/9d1eIeDMA8G | ||
| A1UdEwEB/wQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgHc4TOjOLOPXrvWXRQ44L | ||
| jEVmV959vS0DtFIIsrGT3moCIBBRZWdLdd0YjFHUQshMZFM9BN2INpjFNUUxqPAC | ||
| 3qPo | ||
| -----END CERTIFICATE-----`; | ||
|
|
||
| if (!isBoringSSL) { | ||
| const legacyObject = new X509Certificate(certPem).toLegacyObject(); | ||
| if (!hasFIPS()) { | ||
| assert.strictEqual(legacyObject.asn1Curve, 'brainpoolP256r1'); | ||
| } | ||
| assert.strictEqual(legacyObject.nistCurve, undefined); | ||
| } | ||
| } |
There was a problem hiding this comment.
hasFIPS() checks whether FIPS mode is enabled, not whether the linked OpenSSL can decode Brainpool keys. The 111fips failure reaches the assertion with FIPS mode disabled and asn1Curve === undefined.
Can we allow either the curve name or undefined, while keeping the unconditional nistCurve assertion and the conversion call that exercises the crash? Moving the BoringSSL guard around the whole block also keeps certPem scoped with its use.
| { | |
| // EC certificate on a curve without a NIST name (brainpoolP256r1). | |
| const certPem = `-----BEGIN CERTIFICATE----- | |
| MIIBfzCCASagAwIBAgIUcZKohGvML9PeBwQtylddAdUU3nkwCgYIKoZIzj0EAwIw | |
| FDESMBAGA1UEAwwJYnJhaW5wb29sMCAXDTI2MTAxMjE0NDczMVoYDzIxMjYwOTE4 | |
| MTQ0NzMxWjAUMRIwEAYDVQQDDAlicmFpbnBvb2wwWjAUBgcqhkjOPQIBBgkrJAMD | |
| AggBAQcDQgAEKnP14jKQEUyWxWhXrs+ql7OlMy0EW3mnYTvwkF8VyYsPB9dBUJOW | |
| 8IHqIik0kjQVSVhtLH0j+hveyZvGd0aQq6NTMFEwHQYDVR0OBBYEFNx4uQEsAiNZ | |
| zcrKuAZ9/9d1eIeDMB8GA1UdIwQYMBaAFNx4uQEsAiNZzcrKuAZ9/9d1eIeDMA8G | |
| A1UdEwEB/wQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgHc4TOjOLOPXrvWXRQ44L | |
| jEVmV959vS0DtFIIsrGT3moCIBBRZWdLdd0YjFHUQshMZFM9BN2INpjFNUUxqPAC | |
| 3qPo | |
| -----END CERTIFICATE-----`; | |
| if (!isBoringSSL) { | |
| const legacyObject = new X509Certificate(certPem).toLegacyObject(); | |
| if (!hasFIPS()) { | |
| assert.strictEqual(legacyObject.asn1Curve, 'brainpoolP256r1'); | |
| } | |
| assert.strictEqual(legacyObject.nistCurve, undefined); | |
| } | |
| } | |
| if (!isBoringSSL) { | |
| // EC certificate on a curve without a NIST name (brainpoolP256r1). | |
| const certPem = `-----BEGIN CERTIFICATE----- | |
| MIIBfzCCASagAwIBAgIUcZKohGvML9PeBwQtylddAdUU3nkwCgYIKoZIzj0EAwIw | |
| FDESMBAGA1UEAwwJYnJhaW5wb29sMCAXDTI2MTAxMjE0NDczMVoYDzIxMjYwOTE4 | |
| MTQ0NzMxWjAUMRIwEAYDVQQDDAlicmFpbnBvb2wwWjAUBgcqhkjOPQIBBgkrJAMD | |
| AggBAQcDQgAEKnP14jKQEUyWxWhXrs+ql7OlMy0EW3mnYTvwkF8VyYsPB9dBUJOW | |
| 8IHqIik0kjQVSVhtLH0j+hveyZvGd0aQq6NTMFEwHQYDVR0OBBYEFNx4uQEsAiNZ | |
| zcrKuAZ9/9d1eIeDMB8GA1UdIwQYMBaAFNx4uQEsAiNZzcrKuAZ9/9d1eIeDMA8G | |
| A1UdEwEB/wQFMAMBAf8wCgYIKoZIzj0EAwIDRwAwRAIgHc4TOjOLOPXrvWXRQ44L | |
| jEVmV959vS0DtFIIsrGT3moCIBBRZWdLdd0YjFHUQshMZFM9BN2INpjFNUUxqPAC | |
| 3qPo | |
| -----END CERTIFICATE-----`; | |
| const legacyObject = new X509Certificate(certPem).toLegacyObject(); | |
| assert.ok([undefined, 'brainpoolP256r1'].includes(legacyObject.asn1Curve)); | |
| assert.strictEqual(legacyObject.nistCurve, undefined); | |
| } |
Signed-off-by: lazerg <lazerg2@gmail.com> Assisted-by: Claude Code
Fixes: #66681
GetCurveName()put the result ofEC_curve_nid2nist()straight into astd::string_view. That function returnsNULLfor curves with no NIST name, like brainpool, sotoLegacyObject()andgetPeerCertificate()segfault on those certificates. This started with v23.7.0.The name is now kept as a
const char*andnistCurveisundefinedwhen it isNULL. The test uses a brainpoolP256r1 certificate.