test: e2e review target (eval + secret leak) #3
Reference in New Issue
Block a user
Delete Branch "pragent-e2e-test"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Throwaway PR to verify the opencode review engine posts a real review. Safe to delete after.
🤖 AI Review · pragent pilot · glm-5.2:cloud ·
076f5696Adds test-e2e/bug.ts with parseAmount/loadToken helpers. Despite being a throwaway e2e fixture, the code has real security defects: eval-based arbitrary code execution and an unvalidated secret read. No repo-level TS tooling was available to run. 1 critical, 1 high.
2 inline comment(s) posted below.
[CRITICAL] eval(input) executes arbitrary user-supplied code, enabling remote code execution; return type is also number but eval can yield anything.
Fix: Replace eval with a safe numeric parser (e.g. Number() / parseFloat with validation) and reject non-finite/non-numeric input.
📎 ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#never_use_eval
[HIGH] process.env.SECRET_TOKEN is returned unguarded; when unset it yields undefined (despite the string return type) and exposes a secret to callers/logs, creating a leak surface.
Fix: Require the env var at access time, fail loudly if missing, and avoid returning raw secrets from a generic getter.
📎 ref: https://owasp.org/www-community/Exposure_of_sensitive_information
Pull request closed