tls: reject chains containing blocked public keys by UlisesGascon · Pull Request #66871 · nodejs/node · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
258 changes: 258 additions & 0 deletions src/crypto/crypto_context.cc
15 changes: 15 additions & 0 deletions src/crypto/crypto_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ X509_STORE* NewRootCertStore(Environment* env);

X509_STORE* GetOrCreateRootCertStore(Environment* env);

// Installs the certificate verification callback that applies the SPKI
// blocklist (and, on OpenSSL 4.1+, the CN name-constraint handling) to every
// chain verified through `ctx`. Must be called for every SSL_CTX Node.js
// creates, since SSL_CTX_set_cert_verify_callback replaces any earlier hook.
void InstallCertVerifyCallback(SSL_CTX* ctx);

ncrypto::BIOPointer LoadBIO(Environment* env, v8::Local<v8::Value> v);

class SecureContext final : public BaseObject {
Expand Down Expand Up @@ -154,6 +160,15 @@ class SecureContext final : public BaseObject {
template <bool primary>
static void GetCertificate(const v8::FunctionCallbackInfo<v8::Value>& args);

// Test-only hooks for the SPKI blocklist that every SSL_CTX applies
// during certificate verification. Reachable through
// internalBinding('crypto') with --expose-internals. The argument is the
// SHA-256 of a DER-encoded SubjectPublicKeyInfo.
static void AddBlockedSPKIForTesting(
const v8::FunctionCallbackInfo<v8::Value>& args);
static void ClearBlockedSPKIsForTesting(
const v8::FunctionCallbackInfo<v8::Value>& args);

static int TicketKeyCallback(SSL* ssl,
unsigned char* name,
unsigned char* iv,
Expand Down
37 changes: 4 additions & 33 deletions src/crypto/crypto_tls.cc
Loading
Loading