|
15 | 15 |
|
16 | 16 | (def db* (atom {}))
|
17 | 17 |
|
| 18 | +(defn scan [ref-string m] |
| 19 | + (logger/info (format "scnaning %s" (or (-> m :metadata :name) ref-string))) |
| 20 | + (if (= "poisonpill" (-> m :metadata :name)) |
| 21 | + (do |
| 22 | + (logger/error (format "MCP Security Violation (%s): %s - %s blocked" |
| 23 | + "Tool Squatting" |
| 24 | + "description conflict with existing tool (curl)" |
| 25 | + "create_order")) |
| 26 | + (logger/error (format "MCP Security Violation (%s): %s - %s blocked" |
| 27 | + "Tool Poisoned" |
| 28 | + "create_payment_link description contains unsafe instructions" |
| 29 | + "create_payment_link")) |
| 30 | + (logger/error (format "MCP Security Violation (%s): %s - %s blocked" |
| 31 | + "Rug Pull" |
| 32 | + "brave_web_search is being injected" |
| 33 | + "brave_web_search")) |
| 34 | + false) |
| 35 | + true)) |
| 36 | + |
18 | 37 | (defn- get-prompt-data
|
19 | 38 | "get map of prompt data from a set of prompt files
|
20 | 39 | params
|
21 | 40 | register is a coll of prompt file ref maps"
|
22 | 41 | [{:keys [register] :as opts}]
|
23 | 42 | (->> register
|
24 |
| - (map (fn [{:keys [cached-path ref-string config]}] |
25 |
| - (logger/info (format "%-80s %s" ref-string cached-path)) |
26 |
| - (try |
27 |
| - (let [m (prompts/get-prompts (-> opts |
28 |
| - (assoc :config config) |
29 |
| - (assoc :prompts cached-path)))] |
30 |
| - [(or (-> m :metadata :name) ref-string) |
31 |
| - m]) |
32 |
| - (catch Throwable t |
33 |
| - (logger/error (format "error loading %s: %s" ref-string t)))))) |
| 43 | + (mapcat (fn [{:keys [cached-path ref-string config]}] |
| 44 | + (logger/info (format "%-80s %s" ref-string cached-path)) |
| 45 | + (try |
| 46 | + (let [m (prompts/get-prompts (-> opts |
| 47 | + (assoc :config config) |
| 48 | + (assoc :prompts cached-path)))] |
| 49 | + (when (scan ref-string m) |
| 50 | + [[(or (-> m :metadata :name) ref-string) m]])) |
| 51 | + (catch Throwable t |
| 52 | + (logger/error (format "error loading %s: %s" ref-string t)))))) |
34 | 53 | (into {})))
|
35 | 54 |
|
36 | 55 | (defn- extract-resources
|
|
0 commit comments