From bc0206c911d959a2544a33b14d7119ea97d7d667 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 26 Apr 2026 21:56:17 -0500 Subject: [PATCH] Drop 'Encourage NIP-07/NIP-46' framing from nostr-security skill MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous subsection ranked login methods by safety, which misstates the threat: NIP-07 extensions have their own attack surface (malicious or compromised extensions can silently sign arbitrary events) and NIP-46 relies on a separate signer's security posture. Either way, an XSS on the app's origin can ask an active signer to sign anything, drain funds via zap requests, or scrape DMs as they're decrypted. Replace with a single sentence noting that remote-signer flows don't change the XSS mitigation story — same defenses apply regardless of login method. --- .agents/skills/nostr-security/SKILL.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.agents/skills/nostr-security/SKILL.md b/.agents/skills/nostr-security/SKILL.md index b0687d0..febf889 100644 --- a/.agents/skills/nostr-security/SKILL.md +++ b/.agents/skills/nostr-security/SKILL.md @@ -17,13 +17,7 @@ A successful XSS on any page of the app = instant, silent, irreversible key thef **Every security practice in this skill exists to make XSS harder to achieve.** The stakes for a Nostr client are substantially higher than for a typical web app — treat every bit of untrusted data (event tags, `content`, metadata fields, URL parameters, relay responses) as a potential script injection vector. -### Why localStorage at all? - -NIP-07 browser extensions and NIP-46 remote signers keep keys out of the web app's origin and are strongly preferred. But the app still has to support users who log in via `nsec` or who generate a new keypair in-browser, and those end up in `localStorage`. The mitigation story is therefore: - -1. **Encourage NIP-07 / NIP-46** in the login UI (already done by `LoginArea`). -2. **Make XSS as hard as possible** via CSP + sanitization + avoiding `dangerouslySetInnerHTML`. -3. **Filter trust-sensitive queries by author** so an attacker can't trick the UI into acting on forged "admin" events (still a form of impersonation, even if no key is stolen). +NIP-07 browser extensions and NIP-46 remote signers keep the key material outside the web app's origin, but they don't change this threat model: a successful XSS can still ask an active signer to sign arbitrary events, drain funds via zap requests, publish malicious content under the user's identity, or scrape plaintext DMs as they're decrypted. The mitigation story is the same regardless of login method — make XSS hard, and filter trust-sensitive queries by author. ## Defense-in-depth layers