security-best-practices

Apply security best practices to Chrome extension manifests and code.

1|Updated Dec 4, 2025
One-click install
npx skills add https://github.com/francanete/fran-marketplace --skill security-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: security-best-practices
Source: https://github.com/francanete/fran-marketplace/tree/main/chrome-extension-expert/skills/security-best-practices
Command: npx skills add https://github.com/francanete/fran-marketplace --skill security-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Chrome extensions often suffer from permission bloat, insecure messaging, and vulnerable DOM interactions that expose users to data leakage and attacks. This Skill provides structured guidance to tighten security without sacrificing functionality.

Core Features & Use Cases

  • Principle of least privilege: minimize permissions and host_permissions to the narrowest scope.
  • Content Security Policy (CSP): configure MV3 CSP to block unsafe scripts and inline code.
  • XSS prevention: safe DOM manipulation, proper sanitization, and safe URL handling.
  • Secure messaging: validate message sources and content, and tightly scope externally connectable recipients.
  • Secure storage and data protection: encrypt sensitive data and avoid storing secrets client-side.
  • Debug and auditing workflows: run security checks during CI and perform regular reviews.

Quick Start

Audit the extension manifest to minimize permissions and configure a strict CSP; implement safe DOM handling, and secure messaging.

Frequently Asked Questions about security-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply the principle of least privilege to Chrome extension permissions?

Apply least privilege by minimizing Chrome extension permissions and host_permissions to the narrowest scope necessary for functionality. This reduces the attack surface and prevents data leakage by ensuring the extension only accesses required resources.

What is the best way to prevent XSS in Chrome extension content scripts?

Prevent XSS in content scripts by implementing safe DOM manipulation, proper data sanitization, and safe URL handling. These secure-coding patterns ensure dynamically inserted content cannot execute malicious scripts within the extension's privileged context.

Does this security guidance work with Manifest V3 extensions?

Yes, this guidance explicitly supports MV3 by configuring MV3 CSP rules, managing permission strategies, and securing content scripts. It provides structured configuration guidelines tailored for real-world Manifest V3 extension scenarios.

How do I audit Chrome extension security during CI workflows?

Audit Chrome extension security during CI by running structured security checks and performing regular reviews. This enforces safe-coding patterns and static reviews to catch permission bloat, insecure messaging, and vulnerable DOM interactions early.

Why should I avoid storing secrets client-side in a Chrome extension?

Avoid storing secrets client-side to prevent data leakage and unauthorized access. Secure storage and data protection strategies require encrypting sensitive data, ensuring that extension vulnerabilities do not expose user secrets directly.