🔥 Black Friday Sale: Get 65% OFF Any PageForge Pro Plan! Use code BF65 Claim Offer →
Conta Get it free
No unsafe-inline icon
Mantido Testado até 6.9.12 #7 in content security policy

No unsafe-inline

No unsafe-inline helps you to build a Content Security Policy avoiding to use 'unsafe-inline' and 'unsafe-hashes'.

Instalações ativas200+100+ nível
Downloads · 30d332▲ +28.7% vs prev. 30d
Classificação5/55 comentários
Pontuação da saúde42/100Justo
Downloads de todos os tempos12.8KSince Mar 2022
Suporte resolvido0 / 10% nos últimos 2 meses
RequerWP 5.9Php 7.4+
Downloads · 7d111▲ +38.8% week over week
Nosso veredicto

Use com cautela

No unsafe-inline works, but test it on a staging site before relying on it in 2026. It runs on 200+ sites, is rated 5/5 and was last updated 12 months ago, and scores 42/100 on our health check.

  • Pequena base de usuários (mais de 200 instalações ativas)
  • Testado apenas até WordPress 6.9 (mais recente é 7.1)

Como ele se acumula?

Lado a lado em instalações, atualizações, avaliações e suporte

Downloads diários

102030Sep 4Oct 18Dec 2
Ontem40
Média diária (1y)7
Dia de pico1125 de dezembro de 2025
Últimos 12 meses2.7K

Os picos de download geralmente seguem uma nova versão — cada site que atualiza automaticamente é um download.

Rankings

Where No unsafe-inline stands today

WordPress.org Classificações de pesquisa

Posição ao vivo na pesquisa de plugins, top 100
Palavra chavePosiçãoPlugins concorrentesCategoria
content security policy >100 6,956 Best content security policy plugins →
csp #15 296 Best csp plugins →
Multisite >100 7,156 Os melhores plugins de vários sites →
segurança >100 10,000 Melhores plugins de segurança →
unsafe-inline #1 246 Best unsafe-inline plugins →

Adoção da versão

Compartilhamento de sites ativos por lançamento.

  • 1.387.8%
  • 1.212.2%

Divisão de classificação

★★★★★ ★★★★★ 5 de 5 comentários

  • 5★100.0%
  • 4★0.00%
  • 3★0.00%
  • 2★0.00%
  • 1★0.00%

About No unsafe-inline

Do Readme oficial · v1.3.0

Descrição

Content Security Policy (CSP) is a computer security standard introduced to prevent cross-site scripting (XSS), clickjacking and other code injection attacks resulting from execution of malicious content in the trusted web page context.
Cross-site scripting (XSS) is a type of security vulnerability that can be found in some web applications.
XSS attacks enable attackers to inject client-side scripts into web pages viewed by other users.
A cross-site scripting vulnerability may be used by attackers to bypass access controls like the same-origin policy.
Looking at National Vulnerability Database run by US NIST, more than 1100 (November 2025) vulnerabilities are reported as XSS for WordPress’ plugins and themes.

Keeping your site up-to-date with the latest versions of plugins and themes is the first line of defense to ensure your site’s security.

The second thing to do, is to deploy a strict Content Security Policy.

The main problem

The main problem with Content Security Policies implemented in the real world is that they are too weak to really protect your site and that many of them can be trivially bypassed by an attacker.

The proposed solution

Google researchers recommend, instead of whole host whitelisting, to activate individual scripts via a CSP nonces approach.
In addition, in order to facilitate the adoption of nonce-based CSP, they proposed the ’strict-dynamic’ keyword.

The problem(s) with CSP in WordPress

  1. Manual creation of a policy

    Usually, a WordPress project is a mix of code written by different authors who contributed to the Core and or wrote plugins and themes.
    If it is possible to whitelist every external script loaded from a <script src="">, the real truth is that in a WordPress project you can have dozens of those scripts included with your plugins and calculate a cryptographic hash for each of them to be included in your CSP header can be a frustrating job. However, there are many browser extensions and WordPress’ plugins that can help you in this job.

  2. Inline scripts

    WordPress core, and plugins, use inline scripts. For these scripts, you can compute hashes to be inserted manually into your policy, only if these scripts do not change at any page load. Unfortunately, this is not very common, as it is frequent to include variable values calculated server side in inline scripts. And it means that your inline scripts change too frequently to manually add their hashes to your policy.
    This commonly happens when scripts are “localized”.

  3. WordPress has no API to implement nonces for CSP

    Even if it is easy to generate a nonce for each page view, this nonce has to be inserted in every script tag used to embed inline scripts in your page as

    <script nonce="rAnd0m">
        doWhatever();
    </script>
    

    and in your script-src directive:

    script-src 'nonce-rAnd0m';
    

    And, of course, a nonce must be unique for each HTTP response.

  4. Unsafe hashes / Inline styles

    Sometimes, HTML elements as images or buttons use HTML Event Attributes (onclick, onsubmit…) to let events trigger actions in a browser.
    You cannot use hashes or nonces for script included in event attributes and, adopting a strict CSP, requires refactoring those patterns into safer alternatives or to use ‘unsafe-hashes’.
    You got a similar problem when inline styles are used in HTML tags:

    <h1 style="color:blue;text-align:center;">This is a heading</h1>
    <p style="color:red;">This is a paragraph.</p>
    

    CSP Level 2 browsers may be ok with just putting the hash in your style-src directive. However, to allow hashes in the style attribute on inline CSS on browsers that support CSP Level 3, you may get an error like this

        Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' 'sha256-nMxMqdZhkHxz5vAuW/PAoLvECzzsmeAxD/BNwG15HuA='". Either the 'unsafe-inline' keyword, a hash ('sha256-nMxMqdZhkHxz5vAuW/PAoLvECzzsmeAxD/BNwG15HuA='), or a nonce ('nonce-...') is required to enable inline execution.
    

    To allow inline styles you need to use ‘unsafe-hashes’ in your style-src directive (that is, in facts, unsafe).
    ^

This plugin approach

This plugin affords those problems in this way:

  1. During a capture phase, it detects the scripts, styles and other embedded content present in the pages of your site and stores them in the database.
  2. Then you have to whitelist these contents from plugin admin.
  3. The plugin uses machine learning to cluster inline scripts trying to aggregate scripts generated by the same server side (PHP) code. So, you can authorize one script example to authorize all scripts that the classifier predicts to label as whitelisted clusters.
  4. You can choose to use hashes to authorize external scripts (and the plugin will allow you to include Subresource Integrity in your <script> and <link>)
  5. You can use hashes or nonces to authorize inline scripts.
  6. You can ask the plugin to refactor your page to not use event attributes (converted in a inline script) and inline styles (converted in an internal CSS).
  7. You can set one or more violations’ report endpoints.

The plugin supports multisite installations and has (too) many options documented in inline help.

Creating a Content Security Policy

After plugin activation, go to Settings menu and search for CSP Settings submenu.
The steps you are supposed to do are the following.

  1. From the Tools tab, activate the capture of the tags and use your site by visiting all the pages or having your users visit them for a long time long period based on the use of your site (hours or days).
  2. From the Tools tab, perform the data clustering in the database (it can use many server resources).
  3. Go to the Base rules tab and include in the CSP directives the desired values ​​(help you with the table at the bottom of the page).
  4. Go to the external scripts tab, inline scripts tab and scripts invoked by event handlers tab and authorize the execution of all the legitimate scripts present on the pages of your site.
  5. Leaving the tag capture active, activate the policy test (at this stage the plugin will generate some violations of the temporary policy used to record additional values to be included in the directives of your “content security policy”).
  6. After visiting again your site pages, disable the capture of the tags and repeat the previous steps 2, 3 and 4.
  7. Enable site protection.

N.B. When you update plugins or themes, if something doesn’t work properly on your site pages, temporarily deactivate the protection and repeat steps 1 to 7.

Plugin hooks

Filtros

  • nunil_output_csp_headers_header_csp
    nunil_output_csp_headers_header_csp is available since version 1.2.3 and can be used to modify the Content-Security-Policy header before it is sent to browser
  • no_unsafe_inline_not_sri_sources
    no_unsafe_inline_not_sri_sources can be used to modify the list of external resources that do not support SRI (Subresource Integrity)

  • no_unsafe_inline_final_output
    no_unsafe_inline_final_output is an internal filter used to manipulate the output of the WordPress process just before the output is sent to the browser.

  • no_unsafe_inline_meta_injector
    no_unsafe_inline_meta_injector is an internal filter hook used to inject meta http-equiv=”Content-Security-Policy” if variable is set

Actions

  • nunil_upgrade Functions hooked on nunil_upgrade will run when the plugin is upgraded

  • nunil_output_csp_headers Functions hooked to nunil_output_csp_headers will run when the plugin output the CSP HTTP response header

Code and libraries

This version of the plugin uses:
* to parse HTML:
* ivopetkov/HTML5DOMDocument on PHP<8.4 and libxml<=2.13.09
* Masterminds\HTML5 on PHP<8.4 and libxml>2.13.09
* \Dom\HTMLDocument: The new ext-dom features with HTML5 support on PHP>8.4
* RubixML for machine learning from version 1.1.0 – PHP-ML was used in versions 1.0.x;
* opctim/php-nilsimsa to calculate and compare Nilsimsa digests.

The log functions have been taken from
* perfectyorg/perfecty-push-wp, something you should really try if you want to implement web Push notifications in your site.

The complete list of dependencies used in this plugin can be seen in dependency graph on GitHub.

Contributions, Issues, Bugs

Plugin code is hosted on a public repository on GitHub.
Reach me over there to help and suggest.

Instalação

Instalação automática

  1. Plugin admin panel and add new option.
  2. Search in the text box No unsafe-inline.
  3. Position yourself on the description of this plugin and select install.
  4. Activate the plugin from the WordPress admin panel.

Manual installation of ZIP file

  1. Download the .ZIP file from this screen.
  2. Select add plugin option from the admin panel.
  3. Select upload option at the top and select the file you downloaded.
  4. Confirm installation and activation of the plugin from the administration panel.

Manual FTP installation

  1. Download the .ZIP file from this screen and unzip it.
  2. FTP access to your folder on the web server.
  3. Copy the whole no-unsafe-inline folder to the /wp-content/plugins/ directory
  4. Activate the plugin from the WordPress admin panel.

Log de Changes

Compatible with PHP 8.0 Added option to use nonces for external scripts and styles. This is the default setting on new install. If you are upgrading from previous versions and you were using hashes, you need to set the new options to 'nonce' in settings tab. Improved compatibility for third-party plugin javascript

1.3.0

  • Add management of trusted-types’ API directives
  • Bug fix for PHP 8.4
  • Avoid using replace on TrustedHTML
  • Improve js to fix-style and prefilter override

1.2.5

  • Bug fix for PHP 8.4

1.2.4

  • Added a support box in tools’ panel
  • Updated the HTML5 parser to work with libxml>2.13.09 and with the new \Dom\ namespaced class on PHP>=8.4
  • Added rel=”noopener noreferrer” in external links with _blank target

1.2.3

  • Added a filter on no_unsafe_inline_not_sri_sources (thanks @jkirrane)
  • Added a filter for $header_csp (nunil_output_csp_headers_header_csp) (thanks @tripflex)
  • Fixed a fatal error if training estimator fails (thanks @tripflex)
  • Fixed processing multiple reports while capturing by violations
  • Improved the user interface for settings
  • Added an option to manage Reporting API v.1 and the Reporting-Endpoints HTTP response header field
  • Added options to exclude protection and script capture on administration pages
  • Correções de bugs

1.2.2

  • Update mu-plugin to run callbacks attached to lower buffer levels and to the shutdown hook
  • Extend overriding of native js functions
  • Adding jqueryui v. 1.13.3 theme
  • Remove legacy dependencies from distribution package
  • Correções de bugs

1.2.1

Correções de bugs

Registro de change completo em WordPress.org →

Capturas de tela

Plugin's tools tab in a multisite enviroment.
Plugin's tools tab in a multisite enviroment.
External scripts tab.
External scripts tab.
Inline scripts/styles tab.
Inline scripts/styles tab.
List of CSP directives managed in Settings tab.
List of CSP directives managed in Settings tab.
A database summary table at the bottom of tools tab.
A database summary table at the bottom of tools tab.

Para desenvolvedores

Este é o seu plugin? Mostre os números.

Adicione um crachá ao vivo ao seu site, Documentos ou Readme do GitHub. Ele é atualizado por conta própria - nenhuma conta necessária.

Selo de Instalações Ativas Selo de classificação Distintivo de pontuação de saúde

Best No unsafe-inline alternatives

All content security policy plugins →
Alternativas
Classificação Plugin Instalações ativas Classificação Atualizada Saúde
1 Cookies and Content Security Policy Cookies and Content Security Policy Be fully GDPR and CCPA compliant through Content Security Policy. Blocks cookies and… by Johan Jonk Stenström 10K+ ★★★★★★★★★★ 4.9 (67) 4 semanas atrás 79
2 Content Security Policy Manager Content Security Policy Manager Plugin for configuring Content Security Policy headers for your site. Allows different CSP… by Patrick Sletvold 2K+ ★★★★★★★★★★ 4.3 (6) 4 anos atras 37
3 HTTP Security Header HTTP Security Header Add and manage essential HTTP security headers with ease. Protect your WordPress site from… by MOHIT GOYAL 1K+ ★★★★★★★★★★ 5 (3) 11 meses atrás 49
4 GD Security Headers GD Security Headers Configure various security-related HTTP headers, including CSP, XSS, Referrer Policy and… by Milan Petrovic 1K+ ★★★★★★★★★★ 4 (8) 7 meses atrás 57
5 Security Header Generator Security Header Generator This plugin generates the proper security HTTP response headers to keep your site secured. by Kevin Pirnie 400+ ★★★★★★★★★★ 4.9 (7) 2 dias atrás 86
6 CSP Friendly Security CSP Friendly Security Adds a CSP header compatible with most WP plugins without breaking styles. by Pascal CESCATO 200+ ★★★★★★★★★★ 3.5 (4) 3 meses atrás 62
8 CSP Violation Reporter CSP Violation Reporter Collect and inspect Content Security Policy (CSP) reports with filtering, grouping, rate… by Guilherme Dumas Peres 40+ ★★★★★★★★★★ 5 (1) 2 meses atrás 59
9 Hiperlink Security Hiperlink Security Lightweight WordPress security plugin: two-factor login (2FA), hardening, security headers… by Hiperlink Digital 30+ ★★★★★★★★★★ Sem comentários 1 hora atrás 67
10 SeaSP Community Edition SeaSP Community Edition SeaSP Community Edition is an automated Content Security Policy Manager. SeaSP allows you… by bluetriangle 10+ ★★★★★★★★★★ 4.7 (3) 5 anos atrás 29
11 Abdal Security Headers Abdal Security Headers Enhance WordPress security with HTTP security headers and a Smart CSP Assistant that… by Ebrahim Shafiei (EbraSha) 10+ ★★★★★★★★★★ 5 (2) 3 meses atrás 63

FAQ

No unsafe-inline: quick answers

Respostas diretas, extraídas de dados ao vivo WordPress.org.

Fonte: WordPress.org

Is No unsafe-inline free?

Yes. No unsafe-inline is free to download and use from the official WordPress.org plugin directory.

Is No unsafe-inline safe to use in 2026?

No unsafe-inline works, but test it on a staging site before relying on it in 2026. It runs on 200+ sites, is rated 5/5 and was last updated 12 months ago, and scores 42/100 on our health check.

How many websites use No unsafe-inline?

No unsafe-inline is active on 200+ WordPress websites and has been downloaded 12,842 times since it launched in March 2022. It was downloaded 332 times in the last 30 days.

Does No unsafe-inline work with WordPress 7.1?

No unsafe-inline is officially tested up to WordPress 6.9.12, while the latest release is 7.1.5. It may still work, but try it on a staging site first.

What PHP version does No unsafe-inline need?

No unsafe-inline requires PHP 7.4 or higher. Most hosts run PHP 8.x today, so it works on any modern WordPress hosting.

When was No unsafe-inline last updated?

The latest version, 1.3.0, was released on December 4, 2025 (12 months ago).

Who makes No unsafe-inline?

No unsafe-inline is developed and maintained by Giuseppe.

What are the best alternatives to No unsafe-inline?

The most popular alternatives to No unsafe-inline are Cookies and Content Securit… (10K+ installs), Content Security Policy Man… (2K+ installs) and HTTP Security Header (1K+ installs).

Alimentado por PageForge

Um modelo e uma planilha. Uma página real para cada pesquisa.

PageForge Transforma cada linha de um CSV em uma página WordPress com seu próprio título, URL, SEO campos e esquema, construído no layout que você já desenhou. Gratuito em WordPress.org.

  • CSV e XLSX, mais Google Sheets em Profissional e Empresarial
  • Seu próprio título, URL, SEO campos e esquema para cada página
  • Funciona com o editor de blocos, Elementor, Divi e Avada
  • Gratuito em WordPress.org, sem cartão de crédito

↑↓ mover↵ abrir