Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
rules:
- id: cohere-user-input-in-system-prompt-js
mode: taint
languages: [javascript, typescript]
severity: ERROR
message: >-
User input flows into the Cohere preamble/system prompt. This enables
prompt injection attacks where users can override system instructions.
Validate and sanitize user input, or keep preamble text hardcoded.
metadata:
cwe: "CWE-77: Command Injection"
category: security
confidence: MEDIUM
subcategory: [vuln]
likelihood: MEDIUM
impact: HIGH
technology: [cohere]
references:
- https://docs.cohere.com/docs/safety-modes
pattern-sources:
- pattern: req.body.$F
- pattern: req.query.$F
- pattern: req.params.$F
- pattern: req.body
pattern-sinks:
- patterns:
- pattern: |
$CLIENT.chat({..., preamble: $SINK, ...})
- focus-metavariable: $SINK
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,4 @@ rules:
pattern-sinks:
- patterns:
- pattern: $CLIENT.chat(..., preamble=$SINK, ...)
- focus-metavariable: $SINK

- id: cohere-user-input-in-system-prompt-js
mode: taint
languages: [javascript, typescript]
severity: ERROR
message: >-
User input flows into the Cohere preamble/system prompt. This enables
prompt injection attacks where users can override system instructions.
Validate and sanitize user input, or keep preamble text hardcoded.
metadata:
cwe: "CWE-77: Command Injection"
category: security
confidence: MEDIUM
subcategory: [vuln]
likelihood: MEDIUM
impact: HIGH
technology: [cohere]
references:
- https://docs.cohere.com/docs/safety-modes
pattern-sources:
- pattern: req.body.$F
- pattern: req.query.$F
- pattern: req.params.$F
- pattern: req.body
pattern-sinks:
- patterns:
- pattern: |
$CLIENT.chat({..., preamble: $SINK, ...})
- focus-metavariable: $SINK
- focus-metavariable: $SINK
Loading