Skip to content

Commit b43faf0

Browse files
tniessenBethGriggs
authored andcommitted
crypto: remove checkIP options argument
None of the supported options have any effect on X509_check_ip_asc. Refs: openssl/openssl#17536 PR-URL: #41571 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent e726931 commit b43faf0

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

doc/api/crypto.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -2542,24 +2542,26 @@ does not contain any DNS names. This behavior is consistent with [RFC 2818][]
25422542
If the `'subject'` option is set to `'never'`, the certificate subject is never
25432543
considered, even if the certificate contains no subject alternative names.
25442544

2545-
### `x509.checkIP(ip[, options])`
2545+
### `x509.checkIP(ip)`
25462546

25472547
<!-- YAML
25482548
added: v15.6.0
2549+
changes:
2550+
- version: REPLACEME
2551+
pr-url: https://github.com/nodejs/node/pull/41571
2552+
description: The `options` argument has been removed since it had no effect.
25492553
-->
25502554

25512555
* `ip` {string}
2552-
* `options` {Object}
2553-
* `subject` {string} `'always'` or `'never'`. **Default:** `'always'`.
2554-
* `wildcards` {boolean} **Default:** `true`.
2555-
* `partialWildcards` {boolean} **Default:** `true`.
2556-
* `multiLabelWildcards` {boolean} **Default:** `false`.
2557-
* `singleLabelSubdomains` {boolean} **Default:** `false`.
25582556
* Returns: {string|undefined} Returns `ip` if the certificate matches,
25592557
`undefined` if it does not.
25602558

25612559
Checks whether the certificate matches the given IP address (IPv4 or IPv6).
25622560

2561+
Only [RFC 5280][] `iPAddress` subject alternative names are considered, and they
2562+
must match the given `ip` address exactly. Other subject alternative names as
2563+
well as the subject field of the certificate are ignored.
2564+
25632565
### `x509.checkIssued(otherCert)`
25642566

25652567
<!-- YAML
@@ -5972,6 +5974,7 @@ See the [list of SSL OP Flags][] for details.
59725974
[RFC 4055]: https://www.rfc-editor.org/rfc/rfc4055.txt
59735975
[RFC 4122]: https://www.rfc-editor.org/rfc/rfc4122.txt
59745976
[RFC 5208]: https://www.rfc-editor.org/rfc/rfc5208.txt
5977+
[RFC 5280]: https://www.rfc-editor.org/rfc/rfc5280.txt
59755978
[Web Crypto API documentation]: webcrypto.md
59765979
[`BN_is_prime_ex`]: https://www.openssl.org/docs/man1.1.1/man3/BN_is_prime_ex.html
59775980
[`Buffer`]: buffer.md

lib/internal/crypto/x509.js

+5
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,11 @@ class X509Certificate extends JSTransferable {
315315

316316
checkIP(ip, options) {
317317
validateString(ip, 'ip');
318+
// The options argument is currently undocumented since none of the options
319+
// have any effect on the behavior of this function. However, we still parse
320+
// the options argument in case OpenSSL adds flags in the future that do
321+
// affect the behavior of X509_check_ip. This ensures that no invalid values
322+
// are passed as the second argument in the meantime.
318323
return this[kHandle].checkIP(ip, getFlags(options));
319324
}
320325

0 commit comments

Comments
 (0)