From 8b8f1a8aae2f2dbfdc88bb4b526edabbe53547c5 Mon Sep 17 00:00:00 2001 From: Alec Muffett Date: Tue, 8 Dec 2020 00:04:31 +0000 Subject: [PATCH] kludge_disable_sri --- lib.d/do-configure.pl | 1 + lib.d/lint.pl | 1 + templates.d/nginx.conf.txt | 11 +++++++++++ 3 files changed, 13 insertions(+) diff --git a/lib.d/do-configure.pl b/lib.d/do-configure.pl index 1193d70..32936ef 100755 --- a/lib.d/do-configure.pl +++ b/lib.d/do-configure.pl @@ -593,6 +593,7 @@ my @set_blank = qw( host_whitelist_re inject_origin inject_referer + kludge_disable_sri log_separate nginx_modules_dirs no_cache_content_type diff --git a/lib.d/lint.pl b/lib.d/lint.pl index 5d9eb27..70a243b 100755 --- a/lib.d/lint.pl +++ b/lib.d/lint.pl @@ -55,6 +55,7 @@ my %known = 'INJECT_ORIGIN' => 1, 'INJECT_REFERER' => 1, 'IS_SOFTMAP' => 1, + 'KLUDGE_DISABLE_SRI' => 1, 'LEFT_TLD_RE' => 1, 'LOG_DIR' => 1, # where logs for the current project live 'LOG_SEPARATE' => 1, diff --git a/templates.d/nginx.conf.txt b/templates.d/nginx.conf.txt index dde2f9c..b83d23f 100644 --- a/templates.d/nginx.conf.txt +++ b/templates.d/nginx.conf.txt @@ -221,6 +221,17 @@ http { # no preserve subs (restore-phase) %%ENDIF + %%IF %KLUDGE_DISABLE_SRI% + # disabling sri with a kludge + subs_filter + "i(ntegrity=\"?sha(?:256|384|512)-)" + "_$1" + gir + ; + %%ELSE + # not disabling sri with a kludge + %%ENDIF + # o2d_re_helper -> if cannot remap, return input. NB: old versions # of lua-plugin cannot cope with code like o2d_mappings[o[1]] # because of `long bracket syntax`; the `[o[` freaks it out.