-
-
Notifications
You must be signed in to change notification settings - Fork 1
Cross-language parity: unified case-insensitive pattern superset, TS harmful-content check, strict parse (#30) #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
073a845
f0e99cd
abf7930
77e2d6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,7 +110,10 @@ export class ResponseVerifier { | |
| } | ||
|
|
||
| private parseResponse(response: any): ParsedResponse { | ||
| if (typeof response === 'object' && response !== null) { | ||
| // Parse strictness mirrors Python _parse_response (#30): Python | ||
| // raises ValueError for non-dict/scalar inputs — npm must reject | ||
| // them too, not wrap them as {type:'unknown'} and verify them. | ||
| if (response !== null && typeof response === 'object' && !Array.isArray(response)) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- npm/src/verifier.ts ---'
sed -n '1,155p' npm/src/verifier.ts
printf '%s\n' '--- npm/src/guards.ts relevant symbols ---'
rg -n -A45 -B10 'extractContent|class SafetyGuard|api_key|secret|harmful' npm/src/guards.ts npm/src
printf '%s\n' '--- TypeScript verifier tests and package scripts ---'
rg -n -A12 -B8 'ResponseVerifier|parseResponse|JSON.parse|strictMode' npm test* npm 2>/dev/null | head -240Repository: QWED-AI/qwed-open-responses Length of output: 39033 Sensitive Data Exposure (CWE-200): Exposure of Sensitive Information to an Unauthorized Actor Reachability: External · Exploitability: Trivial Validate the result of When 🤖 Prompt for AI Agents |
||
| return response; | ||
| } | ||
|
|
||
|
|
@@ -122,6 +125,9 @@ export class ResponseVerifier { | |
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: A JSON string representing an array can bypass verification checks in Suggested FixAfter calling Prompt for AI Agent |
||
| } | ||
|
|
||
| return { type: 'unknown', raw: String(response) }; | ||
| const typeName = response === null ? 'null' : Array.isArray(response) ? 'list' : typeof response; | ||
| throw new Error( | ||
| `Cannot parse response of type ${typeName}. Expected object, string, or JSON.` | ||
| ); | ||
|
Comment on lines
+128
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The Suggested FixWrap the call to Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.