Skip to content

Commit 8a652c1

Browse files
authored
Backport the frame ancestors self switch to this plugin (#26)
* backport the frame ancestors self switch * add translations thanks @jeckodevelopment @Sandra97 and @pe7er
1 parent 21594dc commit 8a652c1

7 files changed

Lines changed: 23 additions & 1 deletion

httpheader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ private function setCspHeader()
328328
}
329329

330330
// Add the xframeoptions directive to the CSP too when enabled
331-
if ($this->params->get('xframeoptions'))
331+
if ($this->params->get('xframeoptions', 1) || $this->params->get('frame_ancestors_self_enabled', 1))
332332
{
333333
$newCspValues[] = "frame-ancestors 'self'";
334334
}

httpheader.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,18 @@
200200
<option value="0">JDISABLED</option>
201201
<option value="1">JENABLED</option>
202202
</field>
203+
<field
204+
name="frame_ancestors_self_enabled"
205+
type="radio"
206+
label="PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_FRAME_ANCESTORS_SELF_ENABLED"
207+
description="PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_FRAME_ANCESTORS_SELF_ENABLED_DESC"
208+
class="btn-group btn-group-yesno"
209+
default="1"
210+
showon="contentsecuritypolicy:1"
211+
>
212+
<option value="0">JDISABLED</option>
213+
<option value="1">JENABLED</option>
214+
</field>
203215
<field
204216
name="contentsecuritypolicy_values"
205217
type="subform"

language/de-DE/de-DE.plg_system_httpheader.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ PLG_SYSTEM_HTTPHEADER_ADDITIONAL_HEADER_KEY="HTTP Header"
1010
PLG_SYSTEM_HTTPHEADER_ADDITIONAL_HEADER_VALUE="HTTP Header Wert"
1111
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY="<a href='https://scotthelme.co.uk/content-security-policy-an-introduction' target='_blank' rel='noopener noreferrer'>Content Security Policy (CSP)</a>"
1212
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_DESC="Mit dieser Option können alle Werte für die 'Content-Security-Policy' individuell eingestellt werden."
13+
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_FRAME_ANCESTORS_SELF_ENABLED="frame-ancestors 'self'"
14+
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_FRAME_ANCESTORS_SELF_ENABLED_DESC="Aktivieren Sie den Content-Security-Policy Clickjacking-Schutz und lassen Sie nur den Origin 'self' zu. Bitte verwenden Sie das unten stehende Formular, um andere Origins als 'self' zu erlauben."
1315
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_REPORT_ONLY="Report-Only"
1416
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_REPORT_ONLY_DESC="Diese Option verwendet den Header 'Content-Security-Policy-Report-Only' anstelle von 'Content-Security-Policy'."
1517
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_SCRIPT_HASHES_ENABLED="<a href='https://scotthelme.co.uk/content-security-policy-an-introduction/#hash' target='_blank' rel='noopener noreferrer'>Script hashes</a>"

language/en-GB/en-GB.plg_system_httpheader.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ PLG_SYSTEM_HTTPHEADER_ADDITIONAL_HEADER_KEY="HTTP Header"
1010
PLG_SYSTEM_HTTPHEADER_ADDITIONAL_HEADER_VALUE="HTTP Header Value"
1111
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY="<a href='https://scotthelme.co.uk/content-security-policy-an-introduction' target='_blank' rel='noopener noreferrer'>Content Security Policy (CSP)</a>"
1212
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_DESC="With this option all values for the 'Content-Security-Policy' can be set individually."
13+
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_FRAME_ANCESTORS_SELF_ENABLED="frame-ancestors 'self'"
14+
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_FRAME_ANCESTORS_SELF_ENABLED_DESC="Enable the CSP clickjacking protection frame-ancestors and only allow the origin 'self'. Please use the form below to allow origins other than 'self'."
1315
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_REPORT_ONLY="Report-Only"
1416
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_REPORT_ONLY_DESC="This option uses the header 'Content-Security-Policy-Report-Only' instead of 'Content-Security-Policy'."
1517
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_SCRIPT_HASHES_ENABLED="<a href='https://scotthelme.co.uk/content-security-policy-an-introduction/#hash' target='_blank' rel='noopener noreferrer'>Script hashes</a>"

language/fr-FR/fr-FR.plg_system_httpheader.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ PLG_SYSTEM_HTTPHEADER_ADDITIONAL_HEADER_KEY="En-tête HTTP"
1212
PLG_SYSTEM_HTTPHEADER_ADDITIONAL_HEADER_VALUE="Valeur de l'en-tête HTTP"
1313
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY="<a href='https://scotthelme.co.uk/content-security-policy-an-introduction' target='_blank' rel='noopener noreferrer'>Politique de sécurité du contenu (CSP)</a>"
1414
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_DESC="Avec cette option, toutes les valeurs de la 'Content-Security-Policy' peuvent être réglées individuellement."
15+
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_FRAME_ANCESTORS_SELF_ENABLED="frame-ancestors 'self'"
16+
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_FRAME_ANCESTORS_SELF_ENABLED_DESC="Activer la protection CSP frame-ancestors contre le détournement de clic et n'autoriser que l'origine 'self'. Veuillez utiliser le formulaire ci-dessous pour autoriser les origines autres que 'self'."
1517
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_REPORT_ONLY_DESC="Cette option utilise l'en-tête 'Content-Security-Policy-Report-Only' au lieu de 'Content-Security-Policy'."
1618
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_REPORT_ONLY="Rapport-uniquement"
1719
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_REPORT_ONLY_DESC="Cette option utilise l'en-tête 'Content-Security-Policy-Report-Only' au lieu de 'Content-Security-Policy'."

language/it-IT/it-IT.plg_system_httpheader.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ PLG_SYSTEM_HTTPHEADER_ADDITIONAL_HEADER_KEY="Header HTTP"
1111
PLG_SYSTEM_HTTPHEADER_ADDITIONAL_HEADER_VALUE="Valore Header HTTP"
1212
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY="<a href='https://scotthelme.co.uk/content-security-policy-an-introduction' target='_blank' rel='noopener noreferrer'>Content Security Policy (CSP)</a>"
1313
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_DESC="Con quest'opzione tutti i valori per la 'Content-Security-Policy' possono essere impostati individualmente."
14+
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_FRAME_ANCESTORS_SELF_ENABLED="frame-ancestors 'self'"
15+
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_FRAME_ANCESTORS_SELF_ENABLED_DESC="Abilita la protezione CSP da clickjacking frame-ancestors e consenti solo l'origine 'self'. Utilizza il modulo sottostante per abilitare altre origini diverse da 'self'."
1416
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_REPORT_ONLY_DESC="Quest'opzione utilizza l'header 'Content-Security-Policy-Report-Only' invece di 'Content-Security-Policy."
1517
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_REPORT_ONLY="Report-Only"
1618
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_VALUES="Aggiungi valore"

language/nl-NL/nl-NL.plg_system_httpheader.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ PLG_SYSTEM_HTTPHEADER_ADDITIONAL_HEADER_KEY="HTTP Header"
1111
PLG_SYSTEM_HTTPHEADER_ADDITIONAL_HEADER_VALUE="HTTP Header waarde"
1212
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY="<a href='https://scotthelme.co.uk/content-security-policy-an-introduction' target='_blank' rel='noopener noreferrer'>Content Security Policy (CSP)</a>"
1313
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_DESC="Met deze optie kunnen alle waarden voor het 'Content-Security-Policy' individueel worden ingesteld"
14+
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_FRAME_ANCESTORS_SELF_ENABLED="frame-ancestors 'self'"
15+
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_FRAME_ANCESTORS_SELF_ENABLED_DESC="Schakel de CSP clickjacking bescherming voor frame-ancestors in en sta alleen 'self' als bron toe. Gebruik het onderstaande formulier om andere bronnen dan 'self' toe te staan."
1416
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_REPORT_ONLY_DESC="Deze optie gebruikt de Header 'Content-Security-Policy-Report-Only' in plaats van 'Content-Security-Policy'"
1517
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_REPORT_ONLY="Report-Only"
1618
PLG_SYSTEM_HTTPHEADER_CONTENTSECURITYPOLICY_VALUES="Waarde toevoegen"

0 commit comments

Comments
 (0)