summaryrefslogtreecommitdiffstats
path: root/netlify-update-csp-headers.rb
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-07-24 18:34:13 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-07-24 18:34:27 +0200
commitc4f56a567b3f8a0f8b4cab4c3e8dcdaaf035545a (patch)
treede752f93288b8b645bd597e25c1a6f0eb5fa3758 /netlify-update-csp-headers.rb
parentfd135ee9ddb02996ec4f9d71b16d9b3db235f2c9 (diff)
downloadgohugo-theme-ed-c4f56a567b3f8a0f8b4cab4c3e8dcdaaf035545a.tar.gz
Add script to path netlify.toml file to allow some violation for CSP header
Diffstat (limited to 'netlify-update-csp-headers.rb')
-rwxr-xr-xnetlify-update-csp-headers.rb42
1 files changed, 0 insertions, 42 deletions
diff --git a/netlify-update-csp-headers.rb b/netlify-update-csp-headers.rb
deleted file mode 100755
index 5f89c46..0000000
--- a/netlify-update-csp-headers.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env ruby
-
-NETLIFY_CONFIG = 'netlify.toml'
-
-text = File.read(NETLIFY_CONFIG)
-
-# => default-src 'self';
-# <= default-src 'self' blob:;
-text = text.gsub(
- /(default-src) ('self')(;)/,
- "\\1 \\2 blob:\\3"
-)
-
-# => style-src 'self';
-# <= style-src 'self' 'unsafe-inline';
-text = text.gsub(
- /(style-src) ('self')(;)/,
- "\\1 \\2 'unsafe-inline'\\3"
-)
-
-# => media-src 'self';
-# <= media-src 'self' blob: https://app.netlify.com;
-text = text.gsub(
- /(media-src) ('self')(;)/,
- "\\1 'self' blob: https://app.netlify.com\\3"
-)
-
-# => frame-src 'none';
-# <= frame-src app.netlify.com;
-text = text.gsub(
- /(frame-src) ('none')(;)/,
- "\\1 app.netlify.com\\3"
-)
-
-# => script-src 'self' *.googletagmanager.com;
-# <= script-src 'self' *.googletagmanager.com netlify-cdp-loader.netlify.app;
-text = text.gsub(
- /(script-src) ('self' \*.googletagmanager.com)(;)/,
- "\\1 \\2 netlify-cdp-loader.netlify.app\\3"
-)
-
-File.open(NETLIFY_CONFIG, "w") { |file| file << text }