mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
update csp using variables and testing
This commit is contained in:
@@ -141,6 +141,8 @@ navigation = {
|
||||
def _csp(config):
|
||||
asset_domain = config["ASSET_DOMAIN"]
|
||||
logo_domain = config["LOGO_CDN_DOMAIN"]
|
||||
api_public_url = config["API_PUBLIC_URL"]
|
||||
api_public_ws_url = config["API_PUBLIC_WS_URL"]
|
||||
|
||||
return {
|
||||
"default-src": ["'self'", asset_domain],
|
||||
@@ -166,14 +168,8 @@ def _csp(config):
|
||||
"'self'",
|
||||
"https://gov-bam.nr-data.net",
|
||||
"https://www.google-analytics.com",
|
||||
"http://localhost:6011",
|
||||
"ws://localhost:6011",
|
||||
"https://notify-api-staging.app.cloud.gov",
|
||||
"wss://notify-api-staging.app.cloud.gov",
|
||||
"https://notify-api-demo.app.cloud.gov",
|
||||
"wss://notify-api-demo.app.cloud.gov",
|
||||
"https://notify-api-production.app.cloud.gov",
|
||||
"wss://notify-api-production.app.cloud.gov",
|
||||
f"{api_public_url}",
|
||||
f"{api_public_ws_url}",
|
||||
],
|
||||
"style-src": ["'self'", asset_domain],
|
||||
"img-src": ["'self'", asset_domain, logo_domain],
|
||||
|
||||
@@ -20,6 +20,14 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
if (featureEnabled) {
|
||||
const socket = io(apiHost);
|
||||
|
||||
socket.on('connect_error', (err) => {
|
||||
console.error('Socket connect_error:', err);
|
||||
});
|
||||
|
||||
socket.on('error', (err) => {
|
||||
console.error('Socket error:', err);
|
||||
});
|
||||
|
||||
socket.on('connect', () => {
|
||||
socket.emit('join', { room: `job-${jobId}` });
|
||||
});
|
||||
|
||||
@@ -13,6 +13,7 @@ class Config(object):
|
||||
NOTIFY_ENVIRONMENT = getenv("NOTIFY_ENVIRONMENT", "development")
|
||||
API_HOST_NAME = getenv("API_HOST_NAME", "localhost")
|
||||
API_PUBLIC_URL = getenv("API_PUBLIC_URL", "localhost")
|
||||
API_PUBLIC_WS_URL = getenv("API_PUBLIC_WS_URL", "localhost")
|
||||
|
||||
ADMIN_BASE_URL = getenv("ADMIN_BASE_URL", "http://localhost:6012")
|
||||
HEADER_COLOUR = (
|
||||
@@ -132,9 +133,9 @@ class Test(Development):
|
||||
WTF_CSRF_ENABLED = False
|
||||
ASSET_DOMAIN = "static.example.com"
|
||||
ASSET_PATH = "https://static.example.com/"
|
||||
|
||||
API_HOST_NAME = "http://you-forgot-to-mock-an-api-call-to"
|
||||
|
||||
API_PUBLIC_URL = "http://you-forgot-to-mock-an-api-call-to"
|
||||
API_PUBLIC_WS_URL = "ws://you-forgot-to-mock-an-api-call-to"
|
||||
REDIS_URL = "redis://you-forgot-to-mock-a-redis-call-to"
|
||||
LOGO_CDN_DOMAIN = "static-logos.test.com"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user