Repository navigation
fix: remove rejectUnauthorized: false — resolve CodeQL certificate validation alert - #94
Merged
David Sanchez (dsanchezcr) merged 3 commits intoNov 3, 2026
Conversation
Copilot
AI
changed the title
[WIP] Fix code scanning alert(s) flagged in repository
fix: remove rejectUnauthorized: false — resolve CodeQL certificate validation alert
Jul 23, 2026
David Sanchez (dsanchezcr)
marked this pull request as ready for review
November 3, 2026 14:25
❌ Lighthouse Accessibility Score
🔗 View full Lighthouse report (expires in 7 days) |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The security-sensitive missing-emulator-certificate fallback lacks a regression test verifying the actionable warning and absence of a TLS-validation-disabled agent.
1 open issue
What changed in this PR
This PR addresses the CodeQL certificate-validation alert by removing the Cosmos DB emulator’s insecure TLS fallback.
Changes:
- Removes the agent that disabled certificate validation when the emulator CA certificate was missing.
- Adds a descriptive missing-certificate error, logged by the existing catch block with setup guidance.
| File | Description |
|---|---|
api/src/shared/cosmosdb.ts |
Removes the insecure emulator TLS fallback and adds an actionable certificate warning. |
Review effort: Balanced
Comment on lines
+90
to
+93
| throw new Error( | ||
| `Cosmos DB Emulator CA certificate not found at "${emulatorCertPath}". ` + | ||
| `Run the emulator setup script or set COSMOS_EMULATOR_CERT_PATH to a valid cert file.` | ||
| ) |
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.

CodeQL flagged a high-severity
js/disabling-certificate-validationalert (CWE-295/CWE-297): the Cosmos DB emulator setup fell back torejectUnauthorized: falsewhen the emulator CA cert file was missing, fully disabling TLS validation and opening the door to MITM attacks.Change
api/src/shared/cosmosdb.tshttps.Agent({ rejectUnauthorized: false })— including its prod-environment guard, which was insufficient mitigationtry/catch, which logs a clear actionable warningTLS validation is now always enforced; developers get an explicit error instead of a silent insecure connection.