Skip to content

feat(scanner): add JS/TS AST env detection - #10

Merged
obmakesomething merged 2 commits into
mainfrom
codex/feat/env-mapper-js-ts-ast-v03
May 15, 2026
Merged

feat(scanner): add JS/TS AST env detection#10
obmakesomething merged 2 commits into
mainfrom
codex/feat/env-mapper-js-ts-ast-v03

Conversation

@obmakesomething

@obmakesomething obmakesomething commented May 15, 2026

Copy link
Copy Markdown
Owner

What changed

  • Added an AST-backed JS/TS detector using @babel/parser when the parser is available.
  • JS/TS files now prefer AST detection and fall back to the existing regex scanner if the parser is unavailable or parsing fails.
  • Added detection for:
    • destructuring from process.env
    • aliases such as const env = process.env
    • helper calls such as env("KEY"), getEnv("KEY"), requiredEnv("KEY"), config("KEY"), readEnv("KEY"), and configured helper names
    • cleanEnv(process.env, { KEY: ... }) schema objects
    • static and dynamic process.env, import.meta.env, Bun.env, and Deno.env.get(...) access
  • Updated README/docs to document the new coverage and source-checkout install flow.

Why

The v0.2 CI foundation made reports and gates trustworthy. This improves scanner credibility for real JS/TS repositories without exposing secret values, while preserving the existing GitHub Action smoke path that runs from a checkout without installing dependencies.

Validation

  • npm test passed, 35/35
  • npm run build passed
  • npm run pack:check passed
  • git diff --check passed
  • No-dependency checkout smoke passed from /tmp: node --test test/*.test.js with the AST-only test skipped, then node src/github-action.js with redaction checks
  • GitHub PR checks passed: node-tests, action-smoke

Non-goals

  • No SARIF output.
  • No provider integrations.
  • No non-JS language scanners.
  • No secret value reads or provider mutation.

Risk notes

  • AST coverage is available when package dependencies are installed. Checkout-only GitHub Action execution safely falls back to the regex scanner instead of failing module load.
  • Helper-call detection is intentionally configurable and may require project-specific tuning for noisy helper names.

@devloai

devloai Bot commented May 15, 2026

Copy link
Copy Markdown

Unable to trigger custom agent "Code Reviewer". You have run out of credits 😔
Please upgrade your plan or buy additional credits from the subscription page.

@obmakesomething
obmakesomething merged commit 0f53cc4 into main May 15, 2026
2 of 4 checks passed
@obmakesomething
obmakesomething deleted the codex/feat/env-mapper-js-ts-ast-v03 branch May 15, 2026 11:00
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.

1 participant