ci(codeql): exclude emulator TLS test files from cert-validation alert#3158
Merged
Conversation
The e2e emulator setup (test/e2e/setup/emulator.ts) and seed script (scripts/import-seed.mjs) use a scoped https.Agent with rejectUnauthorized: false to reach the Cosmos DB emulator's self-signed certificate. CodeQL flags this as js/disabling-certificate-validation, but the emulator exposes no reliable certificate to trust and these files never run in production, so exclude them via excludePathPatterns rather than weakening the check for shipped code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
🔨 Build (Compile, Lint, Prettier, l10n, Package)🔗 Source
🧱 Step Results
📦 Package Information
📥 Artifacts (run)✅ Build StatusCompile, analyzers and packaging passed. See sibling comments for unit/integration and E2E results. |
Contributor
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/vitestThe overall coverage remains at 81%, unchanged from the branch. Code Coverage is in Public Preview. Learn more and provide us with your feedback. |
Contributor
🧪 Tests (Unit + Integration)Commit: 6562c7d 🧪 Results
|
sevoku
approved these changes
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CodeQL (
js/disabling-certificate-validation) flags therejectUnauthorized: falsescopedhttps.Agentused to reach the Cosmos DB emulator's self-signed certificate in two test-only files:test/e2e/setup/emulator.ts(e2e emulator readiness probe)scripts/import-seed.mjs(local seed/dev script)Why exclude rather than fix
There is no SDK option to trust the emulator's self-signed certificate, and the linux/vnext-preview emulator exposes no reliable certificate to import (its
/_explorer/emulator.pemendpoint returns HTTP 400 — already documented inemulator.ts). The agent is already correctly scoped (not a globalNODE_TLS_REJECT_UNAUTHORIZED=0), so the relaxation doesn't leak to other HTTPS calls.Since these files never run in production, they are added to
sdl.codeql.excludePathPatternsin.azure-pipelines/build.ymlrather than weakening the check for shipped code. The production path (src/cosmosdb/getCosmosClient.ts) is intentionally not excluded — it gatesrejectUnauthorizedonisEmulator.Changes
.azure-pipelines/build.yml: add the two test files toexcludePathPatternswith an explanatory comment.