Skip to content

Commit 8321372

Browse files
authored
feat: add custom-csp-rules variable on site deploy script (#15)
1 parent 9c49657 commit 8321372

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

sites/deploy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ CLEAN_URLs="${clean_urls:-false}"
7474
DEPLOY_BUCKET_NAME="${CUBOS_DEV_SITE_DEPLOY_BUCKET:-cubos-dev-sites}"
7575
DEPLOY_CLUSTER="${CUBOS_DEV_SITE_DEPLOY_CLUSTER:-CUBOS_DEV}"
7676
CUSTOM_NGINX_RULES="${custom_nginx_rules}"
77+
CUSTOM_CSP_RULES="${custom_csp_rules:-frame-ancestors 'self';}"
7778

7879
if [ "${force_firebase_deploy}" = "true" ] || ([ "${trunk_based}" != "true" ] && ([ "${CI_COMMIT_REF_NAME}" = "master" ] || [ "${CI_COMMIT_REF_NAME}" = "main" ])); then
7980
echo -e "\033[95mDEPLOYING TO:"
@@ -98,6 +99,10 @@ if [ "${force_firebase_deploy}" = "true" ] || ([ "${trunk_based}" != "true" ] &&
9899
{
99100
"key": "Cache-Control",
100101
"value": "max-age=900, stale-while-revalidate=180"
102+
},
103+
{
104+
"key": "Content-Security-Policy",
105+
"value": "${CUSTOM_CSP_RULES}"
101106
}
102107
]
103108
},
@@ -255,6 +260,7 @@ metadata:
255260
proxy_hide_header vary;
256261
proxy_hide_header cache-control;
257262
add_header cache-control "no-cache, no-store, must-revalidate";
263+
add_header content-security-policy "${CUSTOM_CSP_RULES}";
258264
$(echo "$CUSTOM_NGINX_RULES" | sed 's/^/ /')
259265
${NGINX_RULE_ERROR_PAGE}
260266
spec:

0 commit comments

Comments
 (0)