security: harden mock webhook Lambda permissions and API key comparison#169
Draft
security: harden mock webhook Lambda permissions and API key comparison#169
Conversation
…fe API key comparison, move esbuild to devDependencies Agent-Logs-Url: https://github.com/NHSDigital/nhs-notify-client-callbacks/sessions/da7486ea-77e8-4923-a92a-13e662923c0a Co-authored-by: RossBugginsNHS <78215796+RossBugginsNHS@users.noreply.github.com>
…or constant-time comparison regardless of key length Agent-Logs-Url: https://github.com/NHSDigital/nhs-notify-client-callbacks/sessions/da7486ea-77e8-4923-a92a-13e662923c0a Co-authored-by: RossBugginsNHS <78215796+RossBugginsNHS@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Conduct thorough security review of repository
security: harden mock webhook Lambda permissions and API key comparison
Apr 29, 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.
Comprehensive security review surfaced three actionable findings. All other areas (supply chain, IAM, encryption, CI/CD, secrets management) passed review.
Fixes
Remove wildcard
lambda:InvokeFunctionpermission on mock webhook —aws_lambda_permission.mock_webhook_function_invokegrantedprincipal = "*"for direct SDK invocation, bypassing function URL auth. TheInvokeFunctionUrlpermission is sufficient.Timing-safe API key comparison — Replaced direct
!==string comparison withtimingSafeEqualover SHA-256 digests to eliminate timing side-channel on key validation:esbuildtodevDependenciesin both lambdapackage.jsonfiles — build tool incorrectly listed as runtime dependency.CodeQL notes
Two
js/insufficient-password-hashalerts are false positives — SHA-256 is used for length normalization in constant-time comparison, not password storage.Original prompt
Created from VS Code.