Skip to content

fix(security): close all open dependabot + codeql alerts#111

Merged
dubscode merged 2 commits into
mainfrom
fix-security-alerts
May 25, 2026
Merged

fix(security): close all open dependabot + codeql alerts#111
dubscode merged 2 commits into
mainfrom
fix-security-alerts

Conversation

@dubscode

Copy link
Copy Markdown
Contributor

Summary

  • Closes all 8 open security alerts (5 Dependabot undici, 3 CodeQL: 2 missing workflow permissions + 1 ReDoS) ahead of broader Dubstack adoption.
  • Linear issue: DUB-0

Changes

  • pnpm-workspace.yaml: broaden undici override from >=6.0.0 <6.24.0 to <6.24.0, evicting transitive undici@5.29.0 pulled in by @actions/core@1.11.1 → @actions/http-client@2.2.3 in packages/retarget-action. Lockfile regenerated; pnpm why undici now shows only 6.24.0 + 7.24.0.
  • packages/cli/src/lib/terminal-render.ts: fix js/redos (CodeQL feat(sync): add graphite parity navigation and sync workflows #3) in the GFM table separator filter — replace /^\|\s*[: -]+(\|\s*[: -]+)+\|$/ with /^\|[ \t:-]+(\|[ \t:-]+)+\|$/ to remove the \s* / [: -] overlap that allowed exponential backtracking. Regression test added.
  • .github/workflows/ci.yml: add top-level permissions: { contents: read } (CodeQL docs(agents): add patterns and ai-sdk skill docs #6).
  • .github/workflows/token-check.yml: add top-level permissions: { contents: read, issues: write } — the workflow opens a rotation issue near expiry (CodeQL docs: add AGENTS guidance file #2).
  • packages/retarget-action/dist/index.js: rebuilt by ncc after the undici resolution change.

Closes Dependabot #11 #16 #18 #20 #90, CodeQL #2 #3 #6.

Behavior Impact

  • User-visible changes: none. CLI commands unchanged. The retarget GitHub Action behaves the same — only its bundled undici is newer.
  • Error message/output changes: none.
  • Stack state or git safety considerations: none.

Testing

  • pnpm test — 1688/1688 passing (incl. new ReDoS regression test)
  • pnpm typecheck
  • pnpm checks
  • Added/updated tests for changed behavior (terminal-render.test.ts)
  • pnpm --filter dubstack-retarget-action build — ncc bundle rebuilds cleanly

Coding Agent Checklist (if used)

  • Agent was given AGENTS.md and relevant .agents/* docs
  • No git worktrees were used
  • Changes are scoped and source-first (src/)

Docs

  • README/QUICKSTART updated (if needed) — n/a
  • .agents docs updated (if needed) — n/a

Risks / Follow-Ups

  • Risk level: low. Override forces undici@6.24.0 onto @actions/http-client@2.2.3; that consumer uses only the stable request() surface, and the retarget-action bundle still builds + the action's vitest suite still passes. Fallback if any regression appears: bump @actions/core from ^1.11.1 to ^3.0.0 in packages/retarget-action/package.json (v3 is already in the tree via semantic-release and uses @actions/http-client@4 → undici@6.24.0 natively).
  • Follow-up tasks: after merge, verify gh api repos/wiseiodev/dubstack/dependabot/alerts --jq '[.[]|select(.state=="open")]|length' and same for code-scanning both return 0.

Copilot AI review requested due to automatic review settings May 25, 2026 22:49
@vercel

vercel Bot commented May 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dubstack Ready Ready Preview, Comment May 25, 2026 11:06pm

Copilot AI left a comment

Copy link
Copy Markdown

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 is a security hardening sweep intended to close outstanding Dependabot and CodeQL alerts by (1) forcing patched undici resolutions across the workspace, (2) fixing a CodeQL ReDoS finding in CLI terminal markdown rendering, and (3) tightening GitHub Actions GITHUB_TOKEN permissions to least privilege.

Changes:

  • Broadened the pnpm override selector to ensure undici versions <6.24.0 resolve to 6.24.0, and regenerated the lockfile to evict undici@5.x.
  • Updated the markdown table-separator regex in the CLI terminal renderer to avoid catastrophic backtracking; added a regression test.
  • Added explicit workflow-level permissions to CI and token-check workflows to address CodeQL permission findings.

Reviewed changes

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

Show a summary per file
File Description
pnpm-workspace.yaml Broadens the undici override selector to cover all <6.24.0 versions.
pnpm-lock.yaml Regenerates lockfile to reflect new undici resolution and remove undici@5.29.0 and its transitives.
packages/cli/src/lib/terminal-render.ts Replaces the table-separator detection regex with a non-ReDoS pattern.
packages/cli/src/lib/terminal-render.test.ts Adds a test for separator-row stripping + attempted pathological input guard.
.github/workflows/token-check.yml Declares workflow permissions (contents: read, issues: write) for issue creation behavior.
.github/workflows/ci.yml Declares workflow permission (contents: read) to satisfy least-privilege guidance.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment thread packages/cli/src/lib/terminal-render.test.ts Outdated
Comment thread packages/cli/src/lib/terminal-render.test.ts Outdated
dubscode added a commit that referenced this pull request May 25, 2026
Per Copilot review on #111: prior pathological input did not end with `|`,
so isTableLine() rejected it and formatTable() never ran. New input is a
valid table-shaped line that reaches the separator-filter regex, and uses
performance.now() for monotonic timing.

Refs DUB-0
@dubscode dubscode enabled auto-merge (squash) May 25, 2026 22:57
dubscode added 2 commits May 25, 2026 16:05
- broaden undici override to <6.24.0 to evict transitive undici@5.29.0
- fix ReDoS in markdown table separator regex (terminal-render)
- add explicit permissions blocks to ci.yml and token-check.yml

Refs DUB-0
Per Copilot review on #111: prior pathological input did not end with `|`,
so isTableLine() rejected it and formatTable() never ran. New input is a
valid table-shaped line that reaches the separator-filter regex, and uses
performance.now() for monotonic timing.

Refs DUB-0
@dubscode dubscode force-pushed the fix-security-alerts branch from b9a33f3 to cddee7c Compare May 25, 2026 23:05
@dubscode dubscode merged commit aa78839 into main May 25, 2026
13 checks passed
@dubscode dubscode deleted the fix-security-alerts branch May 25, 2026 23:08
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants