Skip to content

ci: add CodeQL and built-package CommonJS checks - #207

Open
TheRealAgentK wants to merge 4 commits into
mainfrom
security/codeql-commonjs-ci
Open

TheRealAgentK wants to merge 4 commits into
mainfrom
security/codeql-commonjs-ci

Conversation

@TheRealAgentK

@TheRealAgentK TheRealAgentK commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add advanced CodeQL scanning for JavaScript/TypeScript and GitHub Actions with build-mode: none, read-only repository access, and security-events: write scoped to the analysis job. Scan PRs targeting main, pushes to main, and weekly on Tuesdays at 18:23 UTC. main is the repository's current default branch; no develop branch exists remotely.
  • Audit root development dependencies explicitly with npm audit --include=dev, without suppressions or lowered thresholds. Keep the existing example audit and signature checks.
  • After compilation, require the package entry point from CommonJS with --no-experimental-require-module and assert that its public awsHandler export is a function on Node 20/22/24. This checks the built entry point rather than the TypeScript-source tests or the underlying Raygun client's Client export.

No SDK behavior, module format, or supported Node matrix changes. Dependency remediation owns the manifest/lockfile changes temporarily included below.

Merge prerequisite and combined hosted verification

Merge dependency PR #208 first, then this PR.

To verify these security workflows against the exact remediated dependencies on GitHub, this branch temporarily includes #208's dependency commits through a normal merge of e33d6fe into the existing CI branch. Integration head: 0b71293. Both published histories are preserved; no rebase or force push was used. After #208 merges, its dependency changes will no longer be a separate diff against main here.

The combined diff from the original main baseline (09e272797ebd79d5537004ec1ff83cae09024a3b) contains only two workflow files and root package.json/package-lock.json. Relative to #208's exact head, only the two workflow files differ. The original baseline had 57 affected audit entries; the verified combined state now reports zero, without weakening the audit.

Exact dependency SHA-256 values retained after integration:

  • package.json: f5dbd04b754001ba7c5fcdd78aa29703b80a1505bf5dd96fc8f032b6b00505da
  • package-lock.json: c8c5e74f249285d72cc87b66c89b2a651cc4a5e2f721acd9cbbca8bb9951b01a

Dependency-remediation coordination: https://ampcode.com/threads/T-01a20bfc-87bd-70dd-acb8-36988da00f5a

Validation

  • actionlint 1.7.12: both changed workflows pass.
  • Clean installs on Node 20.20.2, 22.23.5, and 24.22.3: build, the exact workflow CommonJS check, all 51 unit assertions, both linters, formatting, the known-malicious-version guard, dependency-tree checks, example installation, and all 10 example assertions pass.
  • Negative controls on all three Node versions: the exact workflow check rejects a missing awsHandler export (ERR_ASSERTION) and an ESM-only entry point (ERR_REQUIRE_ESM).
  • Full root and example audits including development dependencies: zero vulnerabilities, exit 0.
  • Root/example signature checks pass locally on Node 24: 448 registry signatures and 113 attestations. The dependency owner independently verified consumer compatibility probes and signatures on all three Node versions.
  • npm ls --all, git diff --check, and post-merge byte comparison against preserved verified dependency files pass.

Hosted results

All reported checks passed for integration head 0b71293, including the exact dependency baseline above:

  • Node.js CI: all six jobs passed. npm audit --include=dev explicitly reports found 0 vulnerabilities; registry signatures and attestations pass (448/113). Node 20/22/24 each passed the built-package CommonJS check, all 51 unit assertions and both linters. Formatting and all 10 example-integration assertions passed; example audit and signatures passed.
  • CodeQL: both JavaScript/TypeScript and Actions analyses passed, and both result uploads completed successfully.
  • PR-title validation and the CodeQL result check passed.

Scheduled scanning starts only after the workflow reaches the default branch. No release, deployment, or settings changes were performed.

Include root development dependencies in security audits. Preserve the Node 20/22/24 matrix and verify awsHandler without require(esm).

Amp-Thread-ID: https://ampcode.com/threads/T-01a20bfc-c2be-7434-a564-573321d42b27
Co-authored-by: Amp <[email protected]>
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Refresh dependencies within existing manifest ranges, incorporating the updates proposed by Dependabot PRs #203 through #206.

Hold glob/minimatch major overrides pending compatibility approval; the full development audit still reports 22 moderate entries.

Amp-Thread-ID: https://ampcode.com/threads/T-01a20bfc-87bd-70dd-acb8-36988da00f5a
Co-authored-by: Amp <[email protected]>
TheRealAgentK and others added 2 commits November 24, 2026 06:56
Pin glob 14.0.6 and minimatch 11.0.9 across development consumers and remove redundant vulnerable nested copies.

Verified clean full audits and consumer compatibility on Node 20, 22 and 24. Runtime dependencies and CommonJS output are unchanged. Minimatch drops Node 18 tooling support and changes documented matching edge cases.

Amp-Thread-ID: https://ampcode.com/threads/T-01a20bfc-87bd-70dd-acb8-36988da00f5a
Co-authored-by: Amp <[email protected]>
Integrate PR #208 dependency commits for hosted full-development audit, CommonJS matrix and CodeQL validation. Keep both PRs draft and merge dependency remediation first.

Amp-Thread-ID: T-01a20bfc-c2be-7434-a564-573321d42b27
@TheRealAgentK
TheRealAgentK marked this pull request as ready for review November 24, 2026 07:04
@TheRealAgentK
TheRealAgentK requested review from a team, Olwiba, QuantumNightmare, sumitramanga and velocitysystems and removed request for a team November 24, 2026 07:04
Comment thread package.json
"raygun": "^2.2.10"
},
"overrides": {
"glob": "14.0.6",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 P2 — Use caret ranges for the glob and minimatch overrides

The exact pins on glob and minimatch block patch releases, so a new advisory against either version fails npm audit --include=dev on every PR until a person edits this file.

Details

I compared the lockfile on main with the lockfile at the head commit. All consumers of glob and minimatch are dev dependencies. The lockfile already makes installs reproducible, so the exact pin adds nothing to reproducibility. Its only effect is to stop patch releases. I inferred this from npm overrides behaviour and did not reproduce it.

This PR also changes the supply-chain job to npm audit --include=dev with no --audit-level. Suppose an advisory is published against [email protected], with the fix in 11.0.10. npm audit fix and Dependabot security updates cannot move past the pin. The job then fails on every PR and every push to main.

Change the two values to caret ranges. The overrides still force all six off-range consumers onto the patched majors, and patch fixes can come through:

"overrides": {
  "glob": "^14.0.6",
  "minimatch": "^11.0.9"
}

This line comes from commit e33d6fe in #208.

Comment added by AI model Claude

NODE
- run: npm ci --ignore-scripts
- run: npm audit --omit=dev
- run: npm audit --include=dev

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

❓ Q — Decide whether a low-severity dev-tool advisory should block every merge

This step now makes CI fail on any advisory in the full dev tree, at any severity, on every PR and every push to main.

Details

Before this change, the gate covered only the two runtime dependencies. Now it also covers tap, eslint, typescript-eslint, and all their dependencies. The PR description says the baseline had 57 affected entries. That count shows how often new advisories can appear in this tree. Each new one makes CI fail on unrelated PRs, and no code change is needed to cause it.

The strict gate is a valid choice if the team wants it, but it is a policy decision for the maintainers. The options are:

  • Keep the strict gate.
  • Add --audit-level=high for the dev tree only.
  • Run the full dev audit on a schedule, and keep --omit=dev on each PR.

Comment added by AI model Claude

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.

3 participants