@@ -13,8 +13,9 @@ if [[ ! -s "$FILES_LIST" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TMP_DIR="$(mktemp -d)"
|
||||
trap 'rm -rf "$TMP_DIR"' EXIT
|
||||
TMP_DIR=".workflow/scan"
|
||||
[ -d $TMP_DIR ] && rm -rf $TMP_DIR
|
||||
mkdir -p $TMP_DIR
|
||||
|
||||
SYS_PROMPT=$'You are a precise secure code scanning assistant. Analyze the provided file content and return findings as STRICT JSON only with this schema:\n{\n "findings": [\n {\n "severity": "LOW|MEDIUM|HIGH|CRITICAL",\n "rule_id": "string-identifier",\n "line": number|null,\n "description": "short human-readable description",\n "recommendation": "concise fix guidance",\n "references": ["optional references URLs or identifiers"]\n }\n ]\n}\nRules:\n- Output ONLY JSON. No markdown, no code fences, no commentary.\n- If no issues, output {\"findings\":[]}.\n- Prefer concrete, reproducible findings over theoretical. Highlight secrets, insecure configs, vulnerable patterns, risky dependencies (if visible), command injection, path traversal, deserialization, SSRF, XSS, SQLi, hardcoded credentials, bad crypto, weak TLS, etc.\n- Provide line numbers when confidently known; otherwise null.\n'
|
||||
|
||||
@@ -82,6 +83,10 @@ $code + "
|
||||
echo "[INFO] [$idx] Scanning $file (${bytes} bytes) with model=$OLLAMA_MODEL ..."
|
||||
resp_json="$TMP_DIR/resp_$idx.json"
|
||||
set +e
|
||||
# HERE BE DRAGONS
|
||||
echo "[DEBUG] endpoint=[${OLLAMA_API_URI%/}/chat/completions]"
|
||||
echo "[DEBUG] Authorization: Bearer ${OLLAMA_API_KEY}"
|
||||
|
||||
http_code=$(curl -sS -w "%{http_code}" -o "$resp_json" \
|
||||
--max-time "$REQUEST_TIMEOUT_SEC" --connect-timeout 10 \
|
||||
-H "Authorization: Bearer ${OLLAMA_API_KEY}" \
|
||||
|
||||
Reference in New Issue
Block a user