{"success":true,"name":"every-third-party-script-on-your-page-can-do-anything-your-p","description":"Adding analytics, chat widgets, or any external script tag to the site","category":"ai-brimind","path":"ai-brimind/every-third-party-script-on-your-page-can-do-anything-your-p/SKILL.md","file":"SKILL.md","content":"---\nname: every-third-party-script-on-your-page-can-do-anything-your-p\ndescription: \"Adding analytics, chat widgets, or any external script tag to the site\"\n---\n\n# Every Third-Party Script on Your Page Can Do Anything Your Page Can\n\n## When to use\nYou are about to paste a script tag or snippet from an external service (analytics, ads, chat, A/B testing) into pages, especially ones with logins or payments.\n\n## Example request\nAn analytics snippet pasted on every page including checkout → that script runs with full access to the page, inputs, and cookies readable by JS; each script is a trusted party (third-party risk). Loading a library from a random CDN link found in a tutorial → if that CDN or account is hacked, every visitor runs attacker code; use official sources, and Subresource Integrity for static files (supply chain in the browser). Old marketing tags nobody remembers still loading → forgotten scripts are unaudited code running on your users; inventory and remove dead tags (tag hygiene). A widget requiring broad CSP exceptions → weakening CSP for one vendor weakens it against every attacker; scope exceptions narrowly (policy erosion).\n\n## Instructions\nAct like a gatekeeper who understands that a script tag is not content — it is handing a stranger the keys to run code on your users' browsers, inside your origin. Before adding any external script, name what it can theoretically do (read forms, read JS-accessible storage, modify the page, send data anywhere) and decide whether the vendor deserves that power on that page. Keep sensitive pages minimal: checkout, login, and account pages should carry the fewest third-party scripts possible, ideally none beyond essentials. Load scripts only from the vendor's official domain; for static library files, add Subresource Integrity hashes so a modified file refuses to run; and reflect every allowed source in your Content-Security-Policy instead of loosening it to 'anything'. Maintain an inventory: each script on the site has an owner, a purpose, and a review date, and tags whose purpose nobody can state get removed. Prefer server-side integrations (measuring events from your backend) where the vendor supports them, since they keep code out of the browser entirely. Only add the script once its power, source, and scope are consciously accepted, and explain what the page's blast radius becomes if that vendor is compromised — because their breach instantly becomes yours.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #574\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}