-
Notifications
You must be signed in to change notification settings - Fork 20
[GOVCMSCT2-121] CT PORT - Fast fact card #1402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 16 commits
9a257a1
006540b
c9996b7
bb9b364
cf7d57f
af9ecdc
61dc9cc
ac0c3a1
29e985d
76a1c3b
5c7b4f5
6e76c02
c8d8a55
8b56da4
5d08d07
15bd089
07daef1
f966a90
406439c
a022720
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Set HTTP_HOST for PHP using canonical host from CDN headers | ||
| # Priority: HTTP_QUANT_ORIG_HOST > HTTP_X_FORWARDED_HOST > original Host header (preserving port) | ||
|
|
||
| # Default to the incoming Host header so non-standard ports stay intact (e.g. :8080) | ||
| set $final_host $http_host; | ||
|
|
||
| # Use X-Forwarded-Host when provided (reverse proxies) | ||
| if ($http_x_forwarded_host != "") { | ||
| set $final_host $http_x_forwarded_host; | ||
| } | ||
|
|
||
| # Override with Quant-Orig-Host when available | ||
| if ($http_quant_orig_host != "") { | ||
| set $final_host $http_quant_orig_host; | ||
| } | ||
|
|
||
| # Extract first host from comma-separated X-Forwarded-Host values | ||
| if ($final_host ~ "^([^,\s]+)") { | ||
| set $final_host $1; | ||
| } | ||
|
|
||
| # Always pass the calculated host; without override it matches the original Host header | ||
| fastcgi_param HTTP_HOST $final_host; | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,52 @@ | ||||||||||||||||||||||||||
| #!/bin/sh | ||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Fix EFS volume permissions based on lagoon.persistent labels | ||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||
| # Two approaches based on container configuration: | ||||||||||||||||||||||||||
| # 1. VOLUME_USER set: Use secure permissions with UID/GID 1000 (requires container remapping) | ||||||||||||||||||||||||||
| # 2. VOLUME_USER unset: Fall back to world-writable (777/666) for compatibility | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "Fixing file permissions for EFS volumes..." | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Check if containers have been configured with UID/GID remapping | ||||||||||||||||||||||||||
| if [ -n "$VOLUME_USER" ]; then | ||||||||||||||||||||||||||
| echo "🔒 VOLUME_USER detected: Using secure permissions with UID/GID 1000" | ||||||||||||||||||||||||||
| echo " (Assumes containers remap www-data to UID/GID 1000 for EFS compatibility)" | ||||||||||||||||||||||||||
| PERMISSION_MODE="secure" | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| echo "⚠️ VOLUME_USER not set: Using world-writable permissions for compatibility" | ||||||||||||||||||||||||||
| echo " (Consider setting VOLUME_USER and remapping container users to UID/GID 1000)" | ||||||||||||||||||||||||||
| PERMISSION_MODE="compatible" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|
Comment on lines
18
to
21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gate world-writable fallback. Avoid enabling 777/666 unless explicitly approved for the environment. - PERMISSION_MODE="compatible"
+ PERMISSION_MODE="compatible"
+ if [ "${ALLOW_WORLD_WRITABLE:-0}" != "1" ]; then
+ echo " Skipping world-writable fallback (set ALLOW_WORLD_WRITABLE=1 to enable)."
+ exit 0
+ fi📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Persistent volume paths from docker-compose lagoon.persistent labels | ||||||||||||||||||||||||||
| for path in "/app/web/sites/default/files/"; do | ||||||||||||||||||||||||||
| if [ -d "$path" ]; then | ||||||||||||||||||||||||||
| echo "Fixing permissions for: $path" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if [ "$PERMISSION_MODE" = "secure" ]; then | ||||||||||||||||||||||||||
| # Set secure directory permissions (755 = rwxr-xr-x) | ||||||||||||||||||||||||||
| find "$path" -type d -exec chmod 755 {} + 2>/dev/null || true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Set secure file permissions (644 = rw-r--r--) | ||||||||||||||||||||||||||
| find "$path" -type f -exec chmod 644 {} + 2>/dev/null || true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "✓ Secure permissions applied: $path (dirs: 755, files: 644)" | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| # Compatible approach: World-writable fallback | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Make directories world-writable (since we can't chown to unknown web server user) | ||||||||||||||||||||||||||
| find "$path" -type d -exec chmod 777 {} + 2>/dev/null || true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Make files world-readable/writable (since we can't chown to unknown web server user) | ||||||||||||||||||||||||||
| find "$path" -type f -exec chmod 666 {} + 2>/dev/null || true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "✓ Compatible permissions applied: $path (dirs: 777, files: 666)" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| echo "Path not found (may not be mounted yet): $path" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "Permission fixing completed for 1 volumes ($PERMISSION_MODE mode)" | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,7 @@ | ||||||||||||||
| #!/bin/sh | ||||||||||||||
| set -e | ||||||||||||||
|
|
||||||||||||||
| # Post-rollout task: Show DrevOps variables. | ||||||||||||||
| # Generated from .lagoon.yml | ||||||||||||||
|
|
||||||||||||||
| env -0 | sort -z | tr '\0' '\n' | grep ^DREVOPS_ || true | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid GNU-only flags; add portable fallback. env -0 and sort -z aren’t available in BusyBox/Alpine by default; with set -e this may silently noop or fail. -env -0 | sort -z | tr '\0' '\n' | grep ^DREVOPS_ || true
+if env -0 >/dev/null 2>&1; then
+ env -0 | tr '\0' '\n' | sort | grep '^DREVOPS_' || true
+else
+ printenv | sort | grep '^DREVOPS_' || true
+fi📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/sh | ||
| set -e | ||
|
|
||
| # Post-rollout task: Notify about pre-deployment. | ||
| # Generated from .lagoon.yml | ||
|
|
||
| if [ -n "$LAGOON_PR_NUMBER" ]; then export DREVOPS_NOTIFY_REF=$LAGOON_PR_NUMBER;export DREVOPS_NOTIFY_SHA=${LAGOON_PR_HEAD_SHA#origin/};export DREVOPS_NOTIFY_BRANCH=$LAGOON_PR_HEAD_BRANCH;else export DREVOPS_NOTIFY_REF=$LAGOON_GIT_BRANCH;export DREVOPS_NOTIFY_SHA=$LAGOON_GIT_SHA;export DREVOPS_NOTIFY_BRANCH=$LAGOON_GIT_BRANCH;fi | ||
| DREVOPS_NOTIFY_PROJECT=$LAGOON_PROJECT \ | ||
| DREVOPS_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE \ | ||
| DREVOPS_NOTIFY_EVENT=pre_deployment ./scripts/drevops/notify.sh || true | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/bin/sh | ||
| set -e | ||
|
|
||
| # Post-rollout task: Provision site | ||
| # Generated from .lagoon.yml | ||
| # COMMENTED OUT: This script contains rsync commands that won't work in Quant Cloud | ||
|
|
||
| # if [ "$LAGOON_ENVIRONMENT_TYPE" = "production" ] || [ "$LAGOON_GIT_BRANCH" = "${DREVOPS_LAGOON_PRODUCTION_BRANCH:-main}" ]; then | ||
| # echo "==> Running in PRODUCTION environment." | ||
| # # Never unblock admin user in production. | ||
| # export DRUPAL_UNBLOCK_ADMIN=0 | ||
| # # Never sanitize DB in production. | ||
| # export DREVOPS_PROVISION_SANITIZE_DB_SKIP=1 | ||
| # fi | ||
| # | ||
| # # Deployments from UI are not able to bypass the value of | ||
| # # DREVOPS_PROVISION_OVERRIDE_DB set by the deploy-lagoon.sh | ||
| # # during previous deployments (it sets value to '0' to mitigate Lagoon bug | ||
| # # where environment variables cannot be deleted and have to be set to a value). | ||
| # # @see https://github.com/uselagoon/lagoon/issues/1922 | ||
| # # Explicitly set DB overwrite flag to the value from .env file for | ||
| # # deployments from the profile. | ||
| # if [ "${DREVOPS_PROVISION_USE_PROFILE}" = "1" ]; then | ||
| # export DREVOPS_PROVISION_OVERRIDE_DB="$(cat .env | grep ^DREVOPS_PROVISION_OVERRIDE_DB | cut -c31-)" | ||
| # fi | ||
| # ./scripts/drevops/provision.sh | ||
|
|
||
| # NOTE: This provision script has been disabled because: | ||
| # - rsync commands try to connect to Lagoon SSH which is not available in Quant Cloud | ||
| # - Use DREVOPS_PROVISION_SKIP=1 environment variable to skip provision steps | ||
|
|
||
| # Delegate Drupal provisioning to the Quant-aware script. The standard | ||
| # DrevOps provision script is not compatible with Quant Cloud because it relies | ||
| # on Lagoon-specific tooling (e.g., rsync to Lagoon SSH). | ||
| if [ -x "./scripts/quant/provision-quant.sh" ]; then | ||
| ./scripts/quant/provision-quant.sh | ||
| else | ||
| echo "Quant provisioning script missing or not executable." >&2 | ||
| exit 1 | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/bin/sh | ||
| set -e | ||
|
|
||
| # Post-rollout task: Send deployment notifications | ||
| # Generated from .lagoon.yml | ||
|
|
||
| if [ -n "$LAGOON_PR_NUMBER" ]; then export DREVOPS_NOTIFY_REF=$LAGOON_PR_NUMBER; export DREVOPS_NOTIFY_SHA=${LAGOON_PR_HEAD_SHA#origin/}; export DREVOPS_NOTIFY_BRANCH=$LAGOON_PR_HEAD_BRANCH; else export DREVOPS_NOTIFY_REF=$LAGOON_GIT_BRANCH; export DREVOPS_NOTIFY_SHA=$LAGOON_GIT_SHA; export DREVOPS_NOTIFY_BRANCH=$LAGOON_GIT_BRANCH; fi | ||
| DREVOPS_NOTIFY_EVENT=post_deployment \ | ||
| DREVOPS_NOTIFY_PROJECT=$LAGOON_PROJECT \ | ||
| DREVOPS_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE \ | ||
| ./scripts/drevops/notify.sh | ||
|
|
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,52 @@ | ||||||||||||||||||||||||||
| #!/bin/sh | ||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Fix EFS volume permissions based on lagoon.persistent labels | ||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||
| # Two approaches based on container configuration: | ||||||||||||||||||||||||||
| # 1. VOLUME_USER set: Use secure permissions with UID/GID 1000 (requires container remapping) | ||||||||||||||||||||||||||
| # 2. VOLUME_USER unset: Fall back to world-writable (777/666) for compatibility | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "Fixing file permissions for EFS volumes..." | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Check if containers have been configured with UID/GID remapping | ||||||||||||||||||||||||||
| if [ -n "$VOLUME_USER" ]; then | ||||||||||||||||||||||||||
| echo "🔒 VOLUME_USER detected: Using secure permissions with UID/GID 1000" | ||||||||||||||||||||||||||
| echo " (Assumes containers remap www-data to UID/GID 1000 for EFS compatibility)" | ||||||||||||||||||||||||||
| PERMISSION_MODE="secure" | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| echo "⚠️ VOLUME_USER not set: Using world-writable permissions for compatibility" | ||||||||||||||||||||||||||
| echo " (Consider setting VOLUME_USER and remapping container users to UID/GID 1000)" | ||||||||||||||||||||||||||
| PERMISSION_MODE="compatible" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|
Comment on lines
18
to
21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gate world-writable fallback. Same security concern as PHP entrypoint; require explicit ALLOW_WORLD_WRITABLE=1. - PERMISSION_MODE="compatible"
+ PERMISSION_MODE="compatible"
+ if [ "${ALLOW_WORLD_WRITABLE:-0}" != "1" ]; then
+ echo " Skipping world-writable fallback (set ALLOW_WORLD_WRITABLE=1 to enable)."
+ exit 0
+ fi📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Persistent volume paths from docker-compose lagoon.persistent labels | ||||||||||||||||||||||||||
| for path in "/app/web/sites/default/files/"; do | ||||||||||||||||||||||||||
| if [ -d "$path" ]; then | ||||||||||||||||||||||||||
| echo "Fixing permissions for: $path" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if [ "$PERMISSION_MODE" = "secure" ]; then | ||||||||||||||||||||||||||
| # Set secure directory permissions (755 = rwxr-xr-x) | ||||||||||||||||||||||||||
| find "$path" -type d -exec chmod 755 {} + 2>/dev/null || true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Set secure file permissions (644 = rw-r--r--) | ||||||||||||||||||||||||||
| find "$path" -type f -exec chmod 644 {} + 2>/dev/null || true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "✓ Secure permissions applied: $path (dirs: 755, files: 644)" | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| # Compatible approach: World-writable fallback | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Make directories world-writable (since we can't chown to unknown web server user) | ||||||||||||||||||||||||||
| find "$path" -type d -exec chmod 777 {} + 2>/dev/null || true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Make files world-readable/writable (since we can't chown to unknown web server user) | ||||||||||||||||||||||||||
| find "$path" -type f -exec chmod 666 {} + 2>/dev/null || true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "✓ Compatible permissions applied: $path (dirs: 777, files: 666)" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| echo "Path not found (may not be mounted yet): $path" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "Permission fixing completed for 1 volumes ($PERMISSION_MODE mode)" | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,52 @@ | ||||||||||||||||||||||||||
| #!/bin/sh | ||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Fix EFS volume permissions based on lagoon.persistent labels | ||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||
| # Two approaches based on container configuration: | ||||||||||||||||||||||||||
| # 1. VOLUME_USER set: Use secure permissions with UID/GID 1000 (requires container remapping) | ||||||||||||||||||||||||||
| # 2. VOLUME_USER unset: Fall back to world-writable (777/666) for compatibility | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "Fixing file permissions for EFS volumes..." | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Check if containers have been configured with UID/GID remapping | ||||||||||||||||||||||||||
| if [ -n "$VOLUME_USER" ]; then | ||||||||||||||||||||||||||
| echo "🔒 VOLUME_USER detected: Using secure permissions with UID/GID 1000" | ||||||||||||||||||||||||||
| echo " (Assumes containers remap www-data to UID/GID 1000 for EFS compatibility)" | ||||||||||||||||||||||||||
| PERMISSION_MODE="secure" | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| echo "⚠️ VOLUME_USER not set: Using world-writable permissions for compatibility" | ||||||||||||||||||||||||||
| echo " (Consider setting VOLUME_USER and remapping container users to UID/GID 1000)" | ||||||||||||||||||||||||||
| PERMISSION_MODE="compatible" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|
Comment on lines
18
to
21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. World-writable fallback needs an explicit opt-in. 777/666 on web writable dirs is risky in prod. Gate with an env flag. - PERMISSION_MODE="compatible"
+ PERMISSION_MODE="compatible"
+ if [ "${ALLOW_WORLD_WRITABLE:-0}" != "1" ]; then
+ echo " Skipping world-writable fallback (set ALLOW_WORLD_WRITABLE=1 to enable)."
+ exit 0
+ fi📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Persistent volume paths from docker-compose lagoon.persistent labels | ||||||||||||||||||||||||||
| for path in "/app/web/sites/default/files/"; do | ||||||||||||||||||||||||||
| if [ -d "$path" ]; then | ||||||||||||||||||||||||||
| echo "Fixing permissions for: $path" | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if [ "$PERMISSION_MODE" = "secure" ]; then | ||||||||||||||||||||||||||
| # Set secure directory permissions (755 = rwxr-xr-x) | ||||||||||||||||||||||||||
| find "$path" -type d -exec chmod 755 {} + 2>/dev/null || true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Set secure file permissions (644 = rw-r--r--) | ||||||||||||||||||||||||||
| find "$path" -type f -exec chmod 644 {} + 2>/dev/null || true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "✓ Secure permissions applied: $path (dirs: 755, files: 644)" | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| # Compatible approach: World-writable fallback | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Make directories world-writable (since we can't chown to unknown web server user) | ||||||||||||||||||||||||||
| find "$path" -type d -exec chmod 777 {} + 2>/dev/null || true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # Make files world-readable/writable (since we can't chown to unknown web server user) | ||||||||||||||||||||||||||
| find "$path" -type f -exec chmod 666 {} + 2>/dev/null || true | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "✓ Compatible permissions applied: $path (dirs: 777, files: 666)" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||
| echo "Path not found (may not be mounted yet): $path" | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| echo "Permission fixing completed for 1 volumes ($PERMISSION_MODE mode)" | ||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't trust raw
X-Forwarded-Host(host‑header injection risk).Any client can send an
X-Forwarded-Hostheader when hitting the origin directly. With this block we now overwriteHTTP_HOSTfor PHP with that value, effectively reviving classic host-header attacks (poisoned absolute URLs, password-reset links, cache poisoning, etc.). Unless we positively identify and trust the intermediary that injected the header (e.g., by IP allowlisting or a signed header), we must not consume it blindly.Please either remove this fallback or constrain it to a vetted allowlist/sanitised value before passing it to PHP. At minimum, drop the direct assignment shown below until a trust mechanism is implemented.
🤖 Prompt for AI Agents