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
7 changes: 7 additions & 0 deletions .github/workflows/license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ on:
# changes there must re-trigger this workflow to scan it.
- "napi/Cargo.toml"
- "napi/Cargo.lock"
- "pyo3/Cargo.toml"
- "pyo3/Cargo.lock"
- ".github/workflows/license-check.yml"
pull_request:
branches: [main]
Expand All @@ -49,6 +51,8 @@ on:
- "deny.toml"
- "napi/Cargo.toml"
- "napi/Cargo.lock"
- "pyo3/Cargo.toml"
- "pyo3/Cargo.lock"
- ".github/workflows/license-check.yml"

concurrency:
Expand Down Expand Up @@ -116,3 +120,6 @@ jobs:
# (a relative `--config` would otherwise resolve against the
# manifest dir and look for napi/deny.toml).
run: cargo deny --manifest-path "$GITHUB_WORKSPACE/napi/Cargo.toml" --config "$GITHUB_WORKSPACE/deny.toml" check

- name: Check licenses, advisories, bans, sources (PyO3 workspace)
run: cargo deny --manifest-path "$GITHUB_WORKSPACE/pyo3/Cargo.toml" --config "$GITHUB_WORKSPACE/deny.toml" check
121 changes: 1 addition & 120 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,10 @@ tokio = { version = "1", features = ["rt-multi-thread", "macros", "net", "io-uti
wiremock = "0.6"
tempfile = "3"
log = "0.4"
# Test-only private-key generation for the JWT auth tests. Keys are
# generated in-process (RSA + P-256, plus a PBES2-encrypted PKCS#8
# variant) rather than committed as PEM fixtures, so the repo's secret
# scanner has nothing to flag and the tests need no `openssl` CLI (which
# the repo deliberately avoids — not present on Windows). These are the
# RustCrypto siblings of the `pkcs8` runtime dep. dev-only: never linked
# into the shipped crate.
# Generate JWT test keys in-process to avoid PEM fixtures and an external
# `openssl` dependency. `ring` already backs runtime JWT signing.
rsa = { version = "0.9", features = ["pem"] }
p256 = { version = "0.13", features = ["pkcs8", "pem"] }
ring = "0.17"
# Hermetic mTLS C-ABI tests generate a private CA and client/server identities
# at runtime, then serve HTTPS with mandatory client-certificate verification.
# This avoids committed credentials, external processes, and live workspaces.
Expand Down
2 changes: 2 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ ignore = [
# entry requires PR-description justification.
allow = [
"Apache-2.0",
# target-lexicon, used by PyO3's build configuration.
"Apache-2.0 WITH LLVM-exception",
"BSD-2-Clause",
"BSD-3-Clause",
# CC0-1.0 is a public-domain dedication (no attribution or
Expand Down
14 changes: 10 additions & 4 deletions src/auth/oauth/test_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

//! Test-only private-key generation for the JWT auth tests.
//!
//! Keys are generated **in-process** (via the RustCrypto `rsa` / `p256`
//! Keys are generated **in-process** (via the `rsa` / `ring`
//! dev-dependencies) rather than committed as PEM fixtures. Two reasons:
//!
//! 1. The repo's secret scanner blocks committed `BEGIN PRIVATE KEY`
Expand All @@ -33,7 +33,7 @@ use std::sync::OnceLock;

use pkcs8::{EncodePrivateKey, EncodePublicKey, LineEnding};
// Use the `rand_core` re-exported by `rsa` (v0.6) so keygen matches the
// RNG trait version the RustCrypto keygen APIs expect — and so we don't
// RNG trait version the RSA keygen API expects — and so we don't
// pull in a second top-level `rand` that would clash with the kernel's
// runtime `rand` (v0.10) in test builds.
use rsa::rand_core::OsRng;
Expand Down Expand Up @@ -84,8 +84,14 @@ pub(crate) fn rsa_encrypted_pkcs8_pem() -> String {

/// A fresh P-256 EC private key as PKCS#8 PEM (for `ES256`).
pub(crate) fn ec_p256_pkcs8_pem() -> String {
let key = p256::SecretKey::random(&mut OsRng);
key.to_pkcs8_pem(LineEnding::LF)
let key = ring::signature::EcdsaKeyPair::generate_pkcs8(
&ring::signature::ECDSA_P256_SHA256_ASN1_SIGNING,
&ring::rand::SystemRandom::new(),
)
.expect("generate test EC key");
pkcs8::SecretDocument::try_from(key.as_ref())
.expect("parse EC PKCS#8")
.to_pem("PRIVATE KEY", LineEnding::LF)
.expect("encode EC PKCS#8 PEM")
.to_string()
}
Loading