Skip to content

Prevent tsconfig exclusions from bypassing TypeScript security scans - #134

Merged
alxxjohn merged 2 commits into
mainfrom
alexj/fix-tsconfig-exclusions-bypassing-security-checks
Aug 19, 2026
Merged

Prevent tsconfig exclusions from bypassing TypeScript security scans#134
alxxjohn merged 2 commits into
mainfrom
alexj/fix-tsconfig-exclusions-bypassing-security-checks

Conversation

@alxxjohn

Copy link
Copy Markdown
Contributor

Motivation

  • Fix a false negative where a repository-controlled tsconfig.json/jsconfig.json could narrow the compiler roots and cause semantic security rules to be skipped for otherwise-in-scope files.
  • Ensure the scanner continues to use CodeGuard's already-filtered corpus as the TypeScript program roots while still applying project compiler options.

Description

  • Change internal/codeguard/checks/support/typescript_semantic_runner_core.js to use the runner-provided corpus (input.source_files) as compiler rootNames when available and retain parsed compiler options from the config, preventing project config from removing corpus files from semantic scanning.
  • Remove the configuredRootNames helper and its intersection behavior so corpus roots are not restricted by parsed.fileNames.
  • Update internal/codeguard/checks/support/typescript_semantic_test.go by renaming the regression test to TestTypeScriptSemanticRunnerUsesCorpusDespiteConfiguredFiles and adjusting assertions to require that each corpus SourceFiles entry appears in the compiler roots reported by the fake TypeScript runtime.

Testing

  • Ran go test ./internal/codeguard/checks/support and the package tests passed.
  • Ran go test ./... across the repository and all tests passed.
  • Ran git diff --check to validate there are no whitespace or diff issues and it reported no problems.

Codex Task

@alxxjohn
alxxjohn merged commit 978c4db into main Aug 19, 2026
16 checks passed
@alxxjohn
alxxjohn deleted the alexj/fix-tsconfig-exclusions-bypassing-security-checks branch August 19, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant