Skip to content

Removed unused API Gateway and apiHandler lambda#38

Merged
bermannoah merged 4 commits intomasterfrom
nb/fix-keygen
May 1, 2026
Merged

Removed unused API Gateway and apiHandler lambda#38
bermannoah merged 4 commits intomasterfrom
nb/fix-keygen

Conversation

@bermannoah
Copy link
Copy Markdown
Contributor

@bermannoah bermannoah commented May 1, 2026

This pull request removes the API handler Lambda function and all related API Gateway and HTTP API code from the project. This includes the removal of the API Lambda build process, the infrastructure code for deploying the API and its Lambda, all API handler source files, and associated tests. Additionally, several dependencies related to the HTTP API stack (such as Gin and AWS Lambda API proxy) are removed from the Go module file.

Key removals and cleanups:

Infrastructure and Lambda Removal

  • The API handler Lambda (apiHandler) and its build steps are removed from the Makefile, so it is no longer built or deployed. [1] [2]
  • All API Gateway infrastructure, including the Lambda function wiring, API key management, and endpoint definitions, are deleted from cdk/deepalert-stack.ts. [1] [2] [3] [4] [5] [6] [7]

API Source Code and Tests

  • All HTTP API handler source files are deleted: internal/api/api.go, internal/api/alert.go, and internal/api/report.go. [1] [2]
  • All associated API tests are deleted: internal/api/api_test.go.

Dependency Cleanup

  • Removes HTTP API-related dependencies from go.mod, including gin-gonic/gin, awslabs/aws-lambda-go-api-proxy, and related indirect packages.

These changes fully remove the HTTP API surface and infrastructure from the codebase, simplifying the deployment and dependency footprint.

  github.com/deepalert/deepalert to github.com/cookpad/deepalert

  Updated module declaration in go.mod, all Go imports across 47 files,
  and GitHub URLs in package.json.

  Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
  Math.random() uses V8's xorshift128+ PRNG which is not cryptographically
  secure. Switched to crypto.randomBytes(32).toString('base64url') for 256
  bits of OS-level cryptographic randomness. Existing deployed keys stored
  in apikey.json are unaffected.

  Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR strengthens API key generation for the CDK stack and updates the Go module dependency set (notably adding AWS CDK-related Go modules and associated indirect dependencies).

Changes:

  • Switched CDK-side API key generation to crypto.randomBytes(...) and URL-safe encoding.
  • Added AWS CDK Go / constructs / jsii runtime dependencies plus additional indirect Go dependencies.
  • Updated go.sum to reflect the expanded dependency graph.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.

File Description
cdk/deepalert-stack.ts Uses Node crypto to generate an API key when apikey.json is absent.
go.mod Adds AWS CDK Go-related direct dependencies and several new indirect modules.
go.sum Records checksums for the newly introduced/updated Go modules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cdk/deepalert-stack.ts Outdated
Comment thread cdk/deepalert-stack.ts Outdated
Comment thread cdk/deepalert-stack.ts Outdated
Comment thread go.mod
Comment thread cdk/deepalert-stack.ts Outdated
  The enableAPI feature flag was never set in the deploy repo, so the
  API Gateway, API key generation, and apiHandler lambda were dead code.
  Removes both security findings (weak PRNG key generation and plaintext
  key in CloudFormation template) by deleting the code entirely.

  Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@bermannoah bermannoah changed the title Migrate Go module path and enhance API key generation security Removed unused API Gateway and apiHandler lambda May 1, 2026
@bermannoah bermannoah requested a review from Copilot May 1, 2026 14:57
  The enableAPI feature flag was never set in the deploy repo, making the
  API Gateway, API key generation, apiHandler lambda, and internal/api
  package all dead code. Removes both security findings (weak PRNG key
  generation and plaintext key in CloudFormation template) by deleting the
  code entirely.

  Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 12 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go.mod
Comment thread cdk/deepalert-stack.ts
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 12 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bermannoah bermannoah merged commit d73a5bf into master May 1, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants