fix: address code scanning alerts#305
Conversation
4391d0e to
87ffccb
Compare
There was a problem hiding this comment.
Review mode: initial
Findings
- [Minor] Dead code:
safeFromCodePointinpackages/exporters/src/markdown.ts:319-324is no longer called after switching to the shareddecodeHtmlEntities. Remove this unused function.
Suggested fix: Delete thesafeFromCodePointfunction frommarkdown.ts. - [Minor] Orphaned
build-snapjob inrelease.yml: the job still runs and uploads an artifact, butprovenanceandpublishno longer depend on it, so the artifact is never consumed. Consider either removing the job or adding a comment explaining why it is intentionally kept as an independent build.
Suggested fix: Remove thebuild-snapjob and its upload step, or add a comment clarifying that the Snap artifact is published separately (e.g., via a scheduled workflow or manual trigger).
Summary
The PR successfully addresses CodeQL alerts by:
- Replacing regex-based HTML entity decoding with a shared sequential scanner that avoids ReDoS and correctly preserves literal comparison text (
2 < 3). - Adding regression tests for both Markdown and PPTX exporters.
- Pinning all GitHub Actions to commit SHAs (no more floating
@vNtags). - Setting default workflow permissions to
contents: readwith minimal job-level elevation. - Hardening
pull_request_targetfor fork safety via thesafe-to-reviewlabel. - Clarifying license policy to allow copyleft workflow-only tools (documented in
AGENTS.md,CLAUDE.md, and the review prompt). - Removing stale workaround code from
deploy-website.ymland decoupling Snap build from release gating.
No security regressions, data-loss risks, or new dependencies found. The code changes are well-scoped and forward-compatible.
Testing
- Two new Vitest tests cover the entity-decoding fix for both Markdown and PPTX exporters.
- Existing tests for whitespace collapse, tag stripping, and URL entity decoding remain consistent.
- CI passes with
pnpm lint,pnpm typecheck, andpnpm test.
Open-CoDesign Bot
87ffccb to
c1d3927
Compare
There was a problem hiding this comment.
Review mode: follow-up after new commits
Findings
All findings from the previous review are resolved:
- [Resolved] Dead
safeFromCodePointfunction inpackages/exporters/src/markdown.tswas removed. ✓ - [Resolved] The
build-snapjob inrelease.ymlnow has an inline comment explaining it is an inspection-only best-effort build, and is no longer orphaned or misleading. ✓
No new issues introduced by this diff. The additional workflow pinning, permission narrowing, base.sha hardening in codex-pr-review.yml, and safe-to-review label gate for fork PRs all align with the PR's stated security hardening goals. The license policy clarification in AGENTS/CLAUDE and the review prompt is consistent and correct.
Summary
This follow-up commit completes the security hardening by pinning all remaining workflow actions to commit SHAs, setting default contents: read across all workflows, and refining the pull_request_target fork safety and prompt-fetching logic. The previous minor findings have been addressed. The PR is ready to merge from a code-review perspective.
Testing
Existing CI checks (pnpm lint, pnpm typecheck, pnpm test) pass. The new entity-decoding tests for Markdown and PPTX were already present in the previous commit; no additional tests needed for the workflow/CI changes.
Open-CoDesign Bot
Summary
2 < 3while still stripping real tags.pull_request_targetPR review automation so fork PRs require thesafe-to-reviewlabel before the write-token bot runs.Why
GitHub code scanning currently reports CodeQL high alerts in exporter text cleanup and Scorecard alerts around workflow token permissions, unpinned actions, and
pull_request_targetrisk. The exporter issue came from regex-based tag/entity handling; the workflow issues came from broad defaults and floating action tags.The previous blanket AGPL/GPL rule was too broad for CI-only tooling. This PR keeps the product/distribution boundary strict while allowing isolated release automation that does not ship in the app.
Validation
pnpm --filter @open-codesign/exporters exec vitest run src/pptx.test.ts src/markdown.test.tspnpm typecheckpnpm testpnpm lintgit diff --checkuses: ...@(vN|main|master)references in.github/workflowsNotes
codeqlandactionlintCLIs are not installed here, so final CodeQL/Scorecard closure needs GitHub Actions to rescan this PR.safe-to-reviewlabel in the repository for maintainers to opt external fork PRs into bot review.