diff --git a/Makefile b/Makefile index 8fa5364a0..30eed146d 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ APP_VERSION_FILE = app/version.py GIT_BRANCH ?= $(shell git symbolic-ref --short HEAD 2> /dev/null || echo "detached") GIT_COMMIT ?= $(shell git rev-parse HEAD 2> /dev/null || echo "") +GIT_HOOKS_PATH ?= $(shell git config --global core.hooksPath || echo "") VIRTUALENV_ROOT := $(shell [ -z $$VIRTUAL_ENV ] && echo $$(pwd)/venv || echo $$VIRTUAL_ENV) @@ -14,7 +15,8 @@ NVMSH := $(shell [ -f "$(HOME)/.nvm/nvm.sh" ] && echo "$(HOME)/.nvm/nvm.sh" || e ## DEVELOPMENT .PHONY: bootstrap -bootstrap: generate-version-file ## Set up everything to run the app +bootstrap: ## Set up everything to run the app + make generate-version-file poetry self add poetry-dotenv-plugin poetry lock --no-update poetry install --sync --no-root @@ -24,6 +26,20 @@ bootstrap: generate-version-file ## Set up everything to run the app source $(NVMSH) && npm ci --no-audit source $(NVMSH) && npm run build +.PHONY: bootstrap-with-git-hooks +bootstrap-with-git-hooks: ## Sets everything up and accounts for pre-existing git hooks + make generate-version-file + poetry self add poetry-dotenv-plugin + poetry lock --no-update + poetry install --sync --no-root + poetry run playwright install --with-deps + git config --global --unset-all core.hooksPath + poetry run pre-commit install + git config --global core.hookspath "${GIT_HOOKS_PATH}" + source $(NVMSH) --no-use && nvm install && npm install + source $(NVMSH) && npm ci --no-audit + source $(NVMSH) && npm run build + .PHONY: watch-frontend watch-frontend: ## Build frontend and watch for changes source $(NVMSH) && npm run watch diff --git a/app/__init__.py b/app/__init__.py index 2ae627f10..f1c1d5fe4 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -145,6 +145,7 @@ def _csp(config): "frame-src": [ "https://www.youtube.com", "https://www.youtube-nocookie.com", + "https://www.googletagmanager.com", ], "frame-ancestors": "'none'", "form-action": "'self'", @@ -169,6 +170,11 @@ def _csp(config): def create_app(application): + @application.after_request + def add_csp_header(response): + existing_csp = response.headers.get("Content-Security-Policy", "") + response.headers["Content-Security-Policy"] = existing_csp + "; form-action 'self';" + return response # @application.context_processor # def inject_feature_flags(): # this is where feature flags can be easily added as a dictionary within context diff --git a/app/assets/javascripts/validation.js b/app/assets/javascripts/validation.js index 0f60fc299..ade16c0e3 100644 --- a/app/assets/javascripts/validation.js +++ b/app/assets/javascripts/validation.js @@ -38,6 +38,7 @@ function attachValidation() { const validatedRadioNames = new Set(); inputs.forEach((input) => { + if (input.type === "hidden") return; const errorId = input.type === "radio" ? `${input.name}-error` : `${input.id}-error`; let errorElement = document.getElementById(errorId); @@ -85,6 +86,7 @@ function attachValidation() { }); inputs.forEach((input) => { + if (input.type === "hidden") return; input.addEventListener("input", function () { const errorId = input.type === "radio" ? `${input.name}-error` : `${input.id}-error`; const errorElement = document.getElementById(errorId); diff --git a/app/assets/sass/uswds/_legacy-styles.scss b/app/assets/sass/uswds/_legacy-styles.scss index 4af2cc6f6..71fc58e4f 100644 --- a/app/assets/sass/uswds/_legacy-styles.scss +++ b/app/assets/sass/uswds/_legacy-styles.scss @@ -49,12 +49,12 @@ } .sms-message-sender, .sms-message-file-name, .sms-message-scheduler, .sms-message-template, .sms-message-sender { - margin:0.25rem 0 0; + margin: units(0.5) 0 0; } .sms-message-recipient { color: color('gray-cool-90'); - margin: units(1) 0 units(1); + margin: units(0.5) 0 units(2); } .sms-message-status { diff --git a/app/templates/base.html b/app/templates/base.html index c37937cdb..f482d8f37 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -14,7 +14,7 @@ {% block bodyStart %} {% block extra_javascripts_before_body %} - {% endblock %} {% endblock %} diff --git a/app/templates/components/file-upload.html b/app/templates/components/file-upload.html index 27989ee8f..933fb8715 100644 --- a/app/templates/components/file-upload.html +++ b/app/templates/components/file-upload.html @@ -29,7 +29,7 @@ 'class': 'file-upload-field', 'accept': allowed_file_extensions|format_list_items('.{item}')|join(',')|e }) }} -