test: cluster e2e (eval RCE + secret leak) #5

Closed
pragent-bot wants to merge 1 commits from pragent-e2e-9282 into main

Throwaway PR to verify the opencode engine runs in the webhook pod. Safe to delete.

Throwaway PR to verify the opencode engine runs in the webhook pod. Safe to delete.
pragent-bot bot added 1 commit 2026-08-17 23:28:03 +00:00
pragent-bot bot added the AI-REVIEW label 2026-08-17 23:28:03 +00:00
pragent-bot bot reviewed 2026-08-17 23:28:33 +00:00
pragent-bot bot left a comment

🤖 AI Review · pragent pilot · glm-5.2:cloud · 985061c0

New file test-cluster/bug.ts introduces two critical security defects: arbitrary code execution via eval() on untrusted input, and a hardcoded live API key committed to source. tsc --strict passes (no type errors) and no eslint config exists, so linting is a no-op. Both issues must be fixed before merge; the PR description notes it is a throwaway test, but the code should never land regardless.

2 inline comment(s) posted below.

🤖 **AI Review** · pragent pilot · glm-5.2:cloud · `985061c0` New file test-cluster/bug.ts introduces two critical security defects: arbitrary code execution via eval() on untrusted input, and a hardcoded live API key committed to source. tsc --strict passes (no type errors) and no eslint config exists, so linting is a no-op. Both issues must be fixed before merge; the PR description notes it is a throwaway test, but the code should never land regardless. _2 inline comment(s) posted below._ <!-- pragent:sha=985061c011e1557818eff86bbcc4baf400abb169 -->

[CRITICAL] eval(input) executes arbitrary user-supplied code (RCE); any caller-controlled string runs as code in this process.

Fix: Parse the input explicitly instead of evaluating it, e.g. Number(input) or a structured parser, and validate the result.

export function parseAmount(input: string): number {
  const n = Number(input);
  if (!Number.isFinite(n)) {
    throw new Error(`invalid amount: ${input}`);
  }
  return n;
}

📎 ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#never_use_eval

**[CRITICAL]** eval(input) executes arbitrary user-supplied code (RCE); any caller-controlled string runs as code in this process. Fix: Parse the input explicitly instead of evaluating it, e.g. Number(input) or a structured parser, and validate the result. ```suggestion export function parseAmount(input: string): number { const n = Number(input); if (!Number.isFinite(n)) { throw new Error(`invalid amount: ${input}`); } return n; } ``` 📎 ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#never_use_eval

[CRITICAL] A live API key (sk-live-...) is hardcoded in source and will be leaked via git history; getToken() exposes it to any importer.

Fix: Remove the key, rotate it immediately, and read secrets from environment variables or a secrets manager instead.

const API_KEY = process.env.API_KEY ?? "";
export function getToken(): string { return API_KEY; }

📎 ref: https://owasp.org/www-community/vulnerabilities/Use_of_hard-coded_password

**[CRITICAL]** A live API key (sk-live-...) is hardcoded in source and will be leaked via git history; getToken() exposes it to any importer. Fix: Remove the key, rotate it immediately, and read secrets from environment variables or a secrets manager instead. ```suggestion const API_KEY = process.env.API_KEY ?? ""; export function getToken(): string { return API_KEY; } ``` 📎 ref: https://owasp.org/www-community/vulnerabilities/Use_of_hard-coded_password
masi closed this pull request 2026-08-18 04:16:04 +00:00
masi deleted branch pragent-e2e-9282 2026-08-18 04:16:13 +00:00

x

x

Pull request closed

Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gitea_admin/pragent#5