mirror of
https://github.com/prompt-security/clawsec.git
synced 2026-06-13 21:48:03 +03:00
0d2e38ddfd
* Add Picoclaw guardian + posture-review skills at v0.0.1 with wiki docs * fix(feed): add picoclaw to core platform taxonomy and filters * fix(picoclaw): resolve eslint errors in new skills * chore(nvd): include picoclaw in CVE polling and cleanup report --------- Co-authored-by: David Abutbul <David.a@prompt.security>
93 lines
2.3 KiB
Bash
93 lines
2.3 KiB
Bash
#!/bin/bash
|
|
# feed-utils.sh
|
|
# Shared advisory feed path and sync helpers for local/maintenance scripts.
|
|
|
|
init_feed_paths() {
|
|
local project_root="$1"
|
|
|
|
: "${FEED_PATH:=$project_root/advisories/feed.json}"
|
|
: "${SKILL_FEED_PATH:=$project_root/skills/clawsec-feed/advisories/feed.json}"
|
|
: "${PUBLIC_FEED_PATH:=$project_root/public/advisories/feed.json}"
|
|
}
|
|
|
|
sync_feed_to_mirrors() {
|
|
local source_feed="$1"
|
|
local mode="${2:-create}"
|
|
|
|
local target
|
|
for target in "$SKILL_FEED_PATH" "$PUBLIC_FEED_PATH"; do
|
|
case "$mode" in
|
|
create)
|
|
mkdir -p "$(dirname "$target")"
|
|
cp "$source_feed" "$target"
|
|
echo "✓ Updated: $target"
|
|
;;
|
|
existing-only)
|
|
if [ -f "$target" ]; then
|
|
cp "$source_feed" "$target"
|
|
echo "✓ Updated: $target"
|
|
fi
|
|
;;
|
|
*)
|
|
echo "Error: unsupported mirror sync mode: $mode" >&2
|
|
return 1
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
nvd_query_specs() {
|
|
cat <<'EOF'
|
|
keyword|OpenClaw
|
|
keyword|clawdbot
|
|
keyword|Moltbot
|
|
keyword|NanoClaw
|
|
keyword|WhatsApp-bot
|
|
keyword|baileys
|
|
keyword|hermes workflow
|
|
keyword|Picoclaw
|
|
virtualMatchString|cpe:2.3:a:software-metadata.pub:hermes
|
|
virtualMatchString|cpe:2.3:a:picoclaw:picoclaw
|
|
EOF
|
|
}
|
|
|
|
nvd_keyword_pattern() {
|
|
echo 'OpenClaw|clawdbot|Moltbot|openclaw|NanoClaw|nanoclaw|WhatsApp-bot|baileys|HERMES workflow|software publication with rich metadata|Picoclaw|picoclaw'
|
|
}
|
|
|
|
nvd_github_ref_pattern() {
|
|
echo 'github\.com/openclaw/openclaw|github\.com/qwibitai/nanoclaw|github\.com/softwarepub/hermes|github\.com/[^/]+/picoclaw'
|
|
}
|
|
|
|
nvd_cpe_pattern() {
|
|
echo 'cpe:2\.3:a:software-metadata\.pub:hermes(?::|$)|cpe:2\.3:[aho]:[^:]*:picoclaw(?::|$)'
|
|
}
|
|
|
|
nvd_query_slug() {
|
|
local kind="$1"
|
|
local value="$2"
|
|
printf '%s__%s' "$kind" "$value" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9._-]/_/g'
|
|
}
|
|
|
|
nvd_build_url() {
|
|
local kind="$1"
|
|
local value="$2"
|
|
local suffix="${3:-}"
|
|
local encoded
|
|
|
|
encoded=$(jq -nr --arg v "$value" '$v|@uri')
|
|
|
|
case "$kind" in
|
|
keyword)
|
|
printf 'https://services.nvd.nist.gov/rest/json/cves/2.0?keywordSearch=%s%s' "$encoded" "$suffix"
|
|
;;
|
|
virtualMatchString)
|
|
printf 'https://services.nvd.nist.gov/rest/json/cves/2.0?virtualMatchString=%s%s' "$encoded" "$suffix"
|
|
;;
|
|
*)
|
|
echo "Error: unsupported NVD query kind: $kind" >&2
|
|
return 1
|
|
;;
|
|
esac
|
|
}
|