Close the security gaps found by the application audit
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 20m8s
Validate and deploy Sokko G / deploy (push) Successful in 10s

Imported toolboxes could run scripts on the site origin through image data
URLs, so only bitmap images are now accepted at import, display and opening.
The Cards game and its fake admin login no longer turn on when NODE_ENV is
missing, and the Node server now sends a CSP and the other security headers.

The deployment script no longer runs files owned by the service account as
root, the services cannot gain privileges through sudo, and the deployment
key stays in a single workflow step with actions pinned by commit. The script
and systemd units must still be reinstalled on the server after delivery.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-06 10:55:35 +01:00
parent 1adccb4e04
commit 7046515d20
20 changed files with 233 additions and 36 deletions

View file

@ -23,14 +23,14 @@ jobs:
run: printf '%s' "$REQUESTED_COMMIT" | grep -Eq '^[0-9a-f]{40}$'
- name: Check out the requested commit
uses: https://data.forgejo.org/actions/checkout@v4
uses: https://data.forgejo.org/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
ref: ${{ inputs.commit }}
fetch-depth: 0
persist-credentials: false
- name: Set up the pinned Node version
uses: https://data.forgejo.org/actions/setup-node@v4
uses: https://data.forgejo.org/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24.11.1
cache: npm
@ -59,8 +59,6 @@ jobs:
runs-on: docker
env:
DEPLOY_COMMIT: ${{ needs.validate.outputs.commit }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_SSH_KNOWN_HOSTS: ${{ secrets.DEPLOY_SSH_KNOWN_HOSTS }}
steps:
- name: Install the deployment clients
@ -71,6 +69,9 @@ jobs:
fi
- name: Configure the pinned production host key
env:
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_SSH_KNOWN_HOSTS: ${{ secrets.DEPLOY_SSH_KNOWN_HOSTS }}
run: |
test -n "$DEPLOY_SSH_KEY"
test -n "$DEPLOY_SSH_KNOWN_HOSTS"

View file

@ -15,13 +15,13 @@ jobs:
steps:
- name: Check out the pushed commit
uses: https://data.forgejo.org/actions/checkout@v4
uses: https://data.forgejo.org/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
ref: ${{ gitea.sha }}
persist-credentials: false
- name: Set up the pinned Node version
uses: https://data.forgejo.org/actions/setup-node@v4
uses: https://data.forgejo.org/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24.11.1
cache: npm
@ -49,12 +49,10 @@ jobs:
runs-on: docker
env:
DEPLOY_COMMIT: ${{ needs.validate.outputs.commit }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_SSH_KNOWN_HOSTS: ${{ secrets.DEPLOY_SSH_KNOWN_HOSTS }}
steps:
- name: Check out the current main head
uses: https://data.forgejo.org/actions/checkout@v4
uses: https://data.forgejo.org/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
ref: main
persist-credentials: false
@ -81,6 +79,9 @@ jobs:
- name: Configure the pinned production host key
if: steps.freshness.outputs.deploy == 'true'
env:
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_SSH_KNOWN_HOSTS: ${{ secrets.DEPLOY_SSH_KNOWN_HOSTS }}
run: |
test -n "$DEPLOY_SSH_KEY"
test -n "$DEPLOY_SSH_KNOWN_HOSTS"