feat(pqc): add post quantum cryptography safe showcase integration tests#8875
feat(pqc): add post quantum cryptography safe showcase integration tests#8875danieljbruce wants to merge 2 commits into
Conversation
Adds gRPC and HTTP/REST Fallback post quantum cryptography safe integration tests to the test-application package. Configures ShowcaseServer to support TLS, specific ports, and CA certificate output files. Asserts that X25519MLKEM768 is correctly negotiated. Co-authored-by: danieljbruce <8935272+danieljbruce@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Code Review
This pull request introduces support for TLS, custom ports, and CA certificate output files in the ShowcaseServer, and adds integration tests for Post Quantum Cryptography (PQC) over both gRPC and HTTP/REST Fallback. The review feedback highlights potential TypeScript compilation errors under strictNullChecks when using this.originalCwd directly, a directory restoration failure if start() throws an error before this.server is initialized, and a potential runtime TypeError in the overridden fetch method if opts is not provided.
| async start(opts?: { tls?: boolean; port?: string; caCertOutputFile?: string }) { | ||
| this.originalCwd = process.cwd(); | ||
| const testDir = path.join(this.originalCwd, '.showcase-server-dir'); |
There was a problem hiding this comment.
There are two issues here:
- TypeScript Strict Null Checks: Since
this.originalCwdis typed asstring | undefined, passing it directly topath.joinandpath.resolvewill cause compilation errors understrictNullChecks. Using a localcwdvariable avoids this. - Error Masking & Directory Restoration Failure: If
start()fails (e.g., due to download or port issues) beforethis.serveris assigned,this.serverremainsundefined. Whenstop()is called in thefinallyblock, it will throw an error becausethis.serveris missing, which masks the original failure and preventsprocess.chdirfrom restoring the directory. Initializingthis.serverwith a dummy object ensuresstop()can safely restore the directory and won't mask the real error.
| async start(opts?: { tls?: boolean; port?: string; caCertOutputFile?: string }) { | |
| this.originalCwd = process.cwd(); | |
| const testDir = path.join(this.originalCwd, '.showcase-server-dir'); | |
| async start(opts?: { tls?: boolean; port?: string; caCertOutputFile?: string }) { | |
| const cwd = process.cwd(); | |
| this.originalCwd = cwd; | |
| this.server = { kill: () => {} } as any; | |
| const testDir = path.join(cwd, '.showcase-server-dir'); |
| let resolvedCaCertPath = ''; | ||
| if (opts?.caCertOutputFile) { | ||
| resolvedCaCertPath = path.resolve(this.originalCwd, opts.caCertOutputFile); | ||
| } |
There was a problem hiding this comment.
Use the local cwd variable instead of this.originalCwd to avoid TypeScript compilation errors under strictNullChecks.
| let resolvedCaCertPath = ''; | |
| if (opts?.caCertOutputFile) { | |
| resolvedCaCertPath = path.resolve(this.originalCwd, opts.caCertOutputFile); | |
| } | |
| let resolvedCaCertPath = ''; | |
| if (opts?.caCertOutputFile) { | |
| resolvedCaCertPath = path.resolve(cwd, opts.caCertOutputFile); | |
| } |
| (auth as any).fetch = async (url: string, opts: any) => { | ||
| if (url.startsWith('https:')) { |
There was a problem hiding this comment.
To prevent potential runtime TypeError crashes if opts is not provided (since opts is optional in the fetch signature), initialize opts to an empty object if it is falsy before accessing or setting its properties.
(auth as any).fetch = async (url: string, opts: any) => {
opts = opts || {};
if (url.startsWith('https:')) {Adds gRPC and HTTP/REST Fallback post quantum cryptography safe integration tests to the test-application package. Configures ShowcaseServer to support TLS, specific ports, and CA certificate output files. Asserts that X25519MLKEM768 is correctly negotiated. Co-authored-by: danieljbruce <8935272+danieljbruce@users.noreply.github.com>
This submission implements post-quantumsafe integration tests for both gRPC and HTTP/REST Fallback connections to a TLS-enabled gapic-showcase server (running v0.41.1). The tests assert that the X25519MLKEM768 hybrid key exchange group is successfully negotiated.
PR created automatically by Jules for task 11540590886686220413 started by @danieljbruce