fix: strip comments from bundle to avoid install-time env-harvesting false positive#400
Merged
Conversation
…false positive
The OpenClaw security scanner flags `process.env` combined with
`/\bfetch\b/i` as credential harvesting. The word 'Fetch' in a JSDoc
comment ('Fetch all context items') was triggering the network-send half
of the heuristic, blocking installation for users.
Adding --minify-whitespace to the esbuild command strips all comments
(including JSDoc) while keeping identifiers readable. Bundle shrinks
from 712KB to 552KB.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
OpenClaw's install-time security scanner has an
env-harvestingrule that fires when bothprocess.envand/\bfetch\b/iappear in the same source file. The pre-bundleddist/index.jscontainsprocess.envreads (for config likeLCM_SUMMARY_MODEL,OPENCLAW_STATE_DIR) and the word "Fetch" in a JSDoc comment (* 1. Fetch all context items for the conversation). The case-insensitive regex matches the comment, triggering a critical finding that blocks installation.Users see: "Environment variable access combined with network send — possible credential harvesting"
Reported by @DBCrypt0.
Fix
Add
--minify-whitespaceto the esbuild command. This strips all comments (including JSDoc) while keeping variable names and stack traces readable.Verification