=== Gmcfuerte Security Headers ===
Contributors: gmcfuerte
Tags: security headers, hsts, x-frame-options, referrer-policy, permissions-policy
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Recommended security headers with safe presets, never sent twice, plus a read-only self-check that explains what your site really sends.

== Description ==

Gmcfuerte Security Headers adds the security headers that scanners and hosting audits expect, without editing the
web server configuration, and tells you in plain words what each header does.

What it sends (each one can be switched off):

* X-Content-Type-Options: nosniff
* X-Frame-Options: SAMEORIGIN (or DENY)
* Referrer-Policy: strict-origin-when-cross-origin (or strict-origin, same-origin, no-referrer)
* Permissions-Policy: Basic preset (camera, microphone and location off, also in embedded maps and video) or Strict preset
* Strict-Transport-Security (HSTS): off by default, opt-in with a clear warning, max-age from 5 minutes to 1 year, optional includeSubDomains; sent on HTTPS requests only
* Removes the X-Powered-By header that reveals your PHP version

Values come from short lists of safe choices, so a typing mistake cannot break your site.

Never twice: a header that WordPress, another plugin or your .htaccess file already sets keeps its value. The plugin
only adds what is missing, and the settings page names the headers it leaves to your .htaccess file.

Self-check: one click reads the headers your home page really sends (including those set by the server, the
.htaccess file or other plugins) and shows, for each one, its status (OK, missing, sent twice, weak, reveals
information), the value received and what it means.

The plugin stores one option with your choices. It sets no cookies and does not collect personal data.

A Pro edition adds a Content-Security-Policy with a Report-Only rollout and script nonces, free-form policy values,
HSTS preload with reverse-proxy checks and 404 responses for version-revealing files. This free plugin works on its
own and does not need it. If both are active, this plugin sends nothing and says so on its settings page. The Pro
sends headers only with a valid licence, so run the self-check to see what your site really sends. Settings do
not carry over.

== External services ==

This plugin does not connect to any external service. The self-check, only when an administrator clicks
"Run the self-check", makes one HTTP request from your server to your own home page (plus at most three redirects
on the same site) to read its response headers. No data is sent to third parties.

== Installation ==

1. Upload the `gmcfuerte-security-headers` folder to `/wp-content/plugins/`, or install the ZIP from Plugins -> Add New -> Upload Plugin.
2. Activate the plugin through the Plugins screen.
3. Open Settings -> Gmcfuerte Security Headers, check the choices and click Save Changes.
4. Click "Run the self-check" to see what your home page sends.

== Frequently Asked Questions ==

= Will it break my site? =

The defaults suit most sites, with two points to check:

* The Basic Permissions-Policy, on by default, turns off camera, microphone and location for your pages and for
  everything embedded in them. Maps that locate the visitor (including the "my location" button of an embedded map),
  video calls, voice input and QR scanners stop working. If your site uses any of them, set Permissions-Policy to Off.
* X-Frame-Options stops other sites from showing your pages in a frame: switch it off if another site of yours
  embeds these pages.

The Strict Permissions-Policy preset also blocks browser payment buttons (Apple Pay, Google Pay): do not use Strict on
shops that use them.

= Why does the self-check still show a header as missing? =

Headers are added by PHP. A page cache that serves stored pages without running PHP, or a CDN, may drop them. Some
headers may also be left to your .htaccess file (the settings page lists them): if your server ignores the
.htaccess file or lacks mod_headers, they are not sent. While the Pro edition is active this plugin sends nothing,
and the Pro sends headers only with a valid licence.

= Why is a header "sent twice"? =

Two layers set it, for example the server configuration and a plugin. This plugin never adds a header that is
already present in PHP or declared in your .htaccess file, but it cannot see headers that the server or a proxy
adds on its own. Keep one source.

= Should I turn on HSTS? =

Only when every page and file of your site works over HTTPS. Browsers that receive HSTS refuse plain HTTP for your
domain for the whole max-age, and turning the setting off does not undo that. Start with 5 minutes, then raise it.

= Does it add a Content-Security-Policy? =

No. A Content-Security-Policy has to be tuned to the scripts and services each site uses. The self-check tells you
whether your site sends one.

== Screenshots ==

== Changelog ==

= 1.0.1 =
* Use WordPress.org language packs and automatic translation loading. Translation source files are maintained separately for translate.wordpress.org; they are no longer bundled in the plugin ZIP.
* Security header behaviour and saved settings are unchanged. English is used when a language pack is not installed.

= 1.0.0 =
* First release: nosniff, X-Frame-Options, Referrer-Policy and Permissions-Policy presets, opt-in HSTS, X-Powered-By removal, gap-filling rule (never sent twice), read-only self-check, translations in Italian, Spanish and French.

== Upgrade Notice ==

= 1.0.1 =
Uses automatic translation loading and WordPress.org language packs. Security headers and saved settings are unchanged.

= 1.0.0 =
First release.
