From 03ffbdaa4461ab7cf305370255acf5998c8eb6b2 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 26 Apr 2026 21:52:42 -0500 Subject: [PATCH] Add nostr-security skill and trim AGENTS.md section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The skill consolidates three attack surfaces for Nostr event data: author filtering on trust-sensitive queries, URL sanitization before rendering event-sourced links/images, and CSS injection prevention when interpolating event data into styles. The latter two were previously undocumented in mkstack — imported and adapted from the Ditto project's guidance, generalized to reference sanitizeUrl and sanitizeCssString helpers as patterns to implement (mkstack doesn't ship them yet) rather than existing imports. AGENTS.md's Nostr Security Model now fits in a bulleted rule list plus a single spoof-vs-authors example, with a pointer to the skill for the full NIP-72 moderation walkthrough and sanitization details. --- .agents/skills/nostr-security/SKILL.md | 259 +++++++++++++++++++++++++ AGENTS.md | 42 +--- 2 files changed, 269 insertions(+), 32 deletions(-) create mode 100644 .agents/skills/nostr-security/SKILL.md diff --git a/.agents/skills/nostr-security/SKILL.md b/.agents/skills/nostr-security/SKILL.md new file mode 100644 index 0000000..9b65185 --- /dev/null +++ b/.agents/skills/nostr-security/SKILL.md @@ -0,0 +1,259 @@ +--- +name: nostr-security +description: Secure handling of untrusted Nostr event data — author filtering for trust-sensitive queries (admin actions, moderators, addressable events, NIP-72 communities), URL sanitization before rendering event-sourced links/images, and CSS injection prevention when interpolating event data into styles. Load when building trust-boundary features, rendering user-controlled URLs, or interpolating event data into CSS. +--- + +# Nostr Security + +Nostr is permissionless: **anyone can publish any event claiming to be anything**. Events carry a cryptographic signature, but the signature only proves *the signer produced this content* — it says nothing about *whether you should trust that signer*. Every security decision in a Nostr client reduces to: **which pubkeys do we trust, and have we filtered our queries accordingly?** + +This skill covers three attack surfaces: + +1. **Trust-boundary queries** — how to use the `authors` filter so attackers can't forge admin/moderator/owner events. +2. **URL sanitization** — how to handle URLs extracted from event tags, content, or metadata. +3. **CSS injection** — how to safely interpolate event data into `