Skip to content

Detect Python ENV.KEY and os.environ.get() reads in varlock audit - #1269

Merged
theoephraim merged 1 commit into
mainfrom
fix-audit-python-env-attr
Nov 2, 2026
Merged

theoephraim merged 1 commit into
mainfrom
fix-audit-python-env-attr

Conversation

@theoephraim

Copy link
Copy Markdown
Member

Fixes #1266.

varlock audit didn't recognize ENV.KEY attribute access in Python (the accessor @generatePythonEnv emits), so every item read that way was reported as unused.

  • Python scanner now matches ENV.KEY and os.environ.get("KEY")
  • Generated env.py docstring uses ENV.<KEY> instead of ENV.MY_KEY, so the scan of the generated file doesn't report a phantom MY_KEY
  • __VARLOCK_* / _VARLOCK_* are treated as well-known keys, so the generated file's os.environ.get("__VARLOCK_ENV") isn't reported as missing from the schema

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

bumpy-frog

The changes in this PR will be included in the next version bump.

patch Patch releases

  • @varlock/native-helper-darwin 1.24.0 → 1.24.1
  • @varlock/native-helper-linux-arm64 1.24.0 → 1.24.1
  • @varlock/native-helper-linux-x64 1.24.0 → 1.24.1
  • @varlock/native-helper-win32-x64 1.24.0 → 1.24.1
  • varlock 1.24.0 → 1.24.1

Bump files in this PR

Click here if you want to add another bump file to this PR


This comment is maintained by bumpy.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes across the Python audit scanner, generated module, reserved-key filtering, and accompanying documentation.

  • Python reads: Detects ENV.KEY attribute access and os.environ.get() calls.
  • Generated module: Replaces the example attribute with ENV.<KEY> to avoid a phantom audit reference.
  • Internal keys: Excludes _VARLOCK_* and __VARLOCK_* from missing-schema reporting and schema inference.
  • Documentation: Updates supported Python syntax and records the patch release behavior.

Validation: 168 tests passed across scanner, well-known-key, type-generation, Python-emitter, and scan-command coverage. The full suite and website build were not run.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle size

⚠️ grows the bundle by 0.5 KB (+0.0%)

Metric main This PR Δ
Total dist 5176.1 KB 5176.6 KB +0.5 KB (+0.0%)
JS 1976.4 KB 1976.6 KB +0.1 KB (+0.0%)
Sourcemaps 3062.5 KB 3062.9 KB +0.4 KB (+0.0%)
Type defs 137.1 KB 137.1 KB —
Other 0.0 KB 0.0 KB —

dist/ only; native binaries are versioned separately and not counted here.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
varlock-website 6423894 Commit Preview URL

Branch Preview URL
Nov 02 2026, 05:26 PM

@pkg-pr-new

pkg-pr-new Bot commented Nov 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

varlock

npm i https://pkg.pr.new/varlock@1269

@varlock/astro-integration

npm i https://pkg.pr.new/@varlock/astro-integration@1269

@varlock/cloudflare-integration

npm i https://pkg.pr.new/@varlock/cloudflare-integration@1269

@varlock/nuxt-integration

npm i https://pkg.pr.new/@varlock/nuxt-integration@1269

@varlock/vite-integration

npm i https://pkg.pr.new/@varlock/vite-integration@1269

@varlock/native-helper-darwin

npm i https://pkg.pr.new/@varlock/native-helper-darwin@1269

@varlock/native-helper-linux-arm64

npm i https://pkg.pr.new/@varlock/native-helper-linux-arm64@1269

@varlock/native-helper-linux-x64

npm i https://pkg.pr.new/@varlock/native-helper-linux-x64@1269

@varlock/native-helper-win32-x64

npm i https://pkg.pr.new/@varlock/native-helper-win32-x64@1269

commit: 6423894

@theoephraim
theoephraim merged commit 9866050 into main Nov 2, 2026
29 of 30 checks passed
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.

[BUG]: varlock audit does not detect ENV.<KEY> attribute access in Python

1 participant