Repository navigation
ci(lint): guard direct HOME reads - #1604
Conversation
The PR description provides sufficient testing, including built real-CLI smoke checks. No testing-record finding. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
No blocking findings. teamai/home-env is on in .oxlintrc.json, main has no direct process.env.HOME read outside src/utils/home.ts, so turning it on breaks nothing, and CI is green.
[P2 non-blocking] The rule checks node.property without looking at node.computed (oxlint-plugin-teamai/rules/home-env.js:32). So process.env[HOME], where HOME is a variable holding another key, is reported, and process.env['HOME'] is not. Report a non-computed HOME identifier or a computed 'HOME' string literal, and add a rule.invalid case for process.env['HOME']. (The CI review found the same.)
[P3 nit] const { HOME } = process.env also gets past the rule; main has none today. The description doesn't link an issue; if this is part of #1590, say so.
@jeff-r2026 Your call: this turns on a new lint rule.
|
Thanks for the follow-up. Fixed in Slai Agent Runtime performed the investigation, implementation, and test execution. The account owner authorized this contribution and is responsible for its content. |
|
No new findings in the scoped PR diff.
Review was read-only; I did not run, build, or install anything from the PR. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Re-review at 8bfad1d. The computed-property finding is fixed: process.env['HOME'] is reported, process.env[HOME] with a variable is not, and both have a case. The destructuring and issue-link nits stand, and neither blocks. CI is green at this head.
@jeff-r2026 Your call: ready from my side.
* ci(lint): guard direct HOME reads * fix(lint): distinguish computed HOME reads
Summary
Adds
teamai/home-env, an enabled oxlint rule that keeps rawprocess.env.HOMEreads insrc/utils/home.ts.getUserHome()already handles the WindowsUSERPROFILEfallback andos.homedir()fallback. The new rule prevents a later production call site from bypassing that behavior.The rule deliberately excludes
src/__tests__/, because the existing source guard fixture contains the literal it scans for.Validation
npx vitest run oxlint-plugin-teamai/rules/home-env.test.ts src/__tests__/home.test.ts --maxWorkers=2(17 passed)npm run typechecknpm run lint(0 warnings, 0 errors)npm run buildgit diff --checknode dist/index.js --version→0.22.0node dist/index.js list --helpexited 0Authorization
Slai Agent Runtime performed the investigation, implementation, and test execution. The account owner authorized this contribution and is responsible for its content.