Skip to content

NEW @W-23906075@ SF CLI - Automatic ESLint config import leads to RCE during code analyzer process - #501

Open
nikhil-mittal-165 wants to merge 3 commits into
devfrom
feature/W-eslint-rce-declarative-only
Open

NEW @W-23906075@ SF CLI - Automatic ESLint config import leads to RCE during code analyzer process#501
nikhil-mittal-165 wants to merge 3 commits into
devfrom
feature/W-eslint-rce-declarative-only

Conversation

@nikhil-mittal-165

Copy link
Copy Markdown
Contributor

Summary

Restricts ESLint's auto-discovery mechanism to declarative configuration only, preventing arbitrary executable config files from being automatically discovered and executed, thus eliminating RCE vector during code analyzer process.

GUS Ticket W-23906075 — [Bug Bounty / H1] SF CLI - Automatic ESLint config import leads to RCE during code analyzer process

Changes

  • eslint-engine: Modified auto-discovery logic to skip executable configuration files and only load declarative ESLint configs; added SkippedAutoDiscoveredExecutableConfigFile warning when auto-discovery encounters executable configs
  • eslint8-engine: Applied same fix to ESLint 8.x variant; maintained explicit opt-in behavior for user-specified eslint_config_file (still executes with ExplicitExecutableConfigFileWillExecute warning)
  • Test suite: Fixed 3 TypeScript compile errors in eslint-engine/test/engine.test.ts (conditional spread operator for eslint_config_file type compatibility)

Test Evidence

  • Unit tests: eslint-engine 329/332 pass (3 skipped, 0 fail after fix), eslint8-engine 99/99 pass
  • Integration: dreamhouse baseline scan 615 violations/165 files, eslint 100% coverage, no crash
  • RCE PoC verification: auto-discovered malicious eslint.config.cjs NOT executed (sentinel absent) with SkippedAutoDiscoveredExecutableConfigFile warning; explicit eslint_config_file opt-in still executes (sentinel present) with ExplicitExecutableConfigFileWillExecute warning
  • 'sf code-analyzer rules' lists 262 rules and exits successfully
  • Test Status: PASS
  • Fix Attempts: 1
  • Known external failures (not blocking): apexguru 404 external service; pmd/cpd/sfge require Java; bare npx-jest experimental-vm-modules env artifact

Dependencies

None

…tive config to prevent RCE

Auto-discovering an executable ESLint config (eslint.config.{js,cjs,mjs} or
legacy .eslintrc.{js,cjs}) caused its top-level JavaScript to execute during
analysis, an arbitrary code execution vector reachable from an untrusted
workspace when auto_discover_eslint_config is enabled.

Auto-discovery now applies only declarative config (.json/.yaml/.yml). An
executable config found by auto-discovery is skipped with a Warn. An explicitly
configured eslint_config_file may still be executable (trusted operator opt-in)
but emits a Warn that its top-level code will run.

Additive only: no exported symbols were removed or renamed.
…ative config to prevent RCE

Mirrors the eslint (flat) engine fix for the legacy ESLint v8 engine. Auto-
discovering an executable legacy config (.eslintrc.{js,cjs}) executed its top-
level JavaScript during analysis via ESLint's own .eslintrc tree-walk
(useEslintrc) and via overrideConfigFile.

Auto-discovery now applies only declarative legacy config (.json/.yaml/.yml):
an auto-discovered executable config is skipped, useEslintrc is disabled so
ESLint will not walk to it either, and a Warn is emitted. An explicitly
configured executable eslint_config_file is still applied (trusted operator
opt-in) but emits a Warn that its top-level code will run.

Additive only: no exported symbols were removed or renamed.
@git2gus

git2gus Bot commented Aug 18, 2026

Copy link
Copy Markdown

Git2Gus App is installed but the .git2gus/config.json doesn't have right values. You should add the required configuration.

@nikhil-mittal-165 nikhil-mittal-165 changed the title @W-23906075@ SF CLI - Automatic ESLint config import leads to RCE during code analyzer process NEW @W-23906075@ SF CLI - Automatic ESLint config import leads to RCE during code analyzer process Aug 18, 2026
@nikhil-mittal-165
nikhil-mittal-165 marked this pull request as ready for review August 18, 2026 16:45
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