feat: improve security and prevent xss attacks (#30)

* feat: improve security and prevent xss attacks

* chore: fix frontend test file name location

* fix: frontend test case

* ci: add deployment connection
This commit is contained in:
2026-04-16 16:49:51 -03:00
committed by GitHub
parent 3b3857207e
commit c19ef73a5a
21 changed files with 219 additions and 19 deletions
+1
View File
@@ -9,6 +9,7 @@ on:
jobs:
terraform-plan-stg:
name: Plan changs to staging
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
outputs:
no_changes: ${{ steps.check-changes.outputs.no_changes }}
+27
View File
@@ -51,6 +51,7 @@ jobs:
needs: ["run-checks"]
permissions:
contents: read
deployments: write
packages: write
steps:
@@ -100,3 +101,29 @@ jobs:
docker tag ghcr.io/${{ steps.repo.outputs.name }}/api:latest ghcr.io/${{ steps.repo.outputs.name }}/api:pr-${{ github.event.pull_request.number }}
docker push ghcr.io/${{ steps.repo.outputs.name }}/api:candidate
docker push ghcr.io/${{ steps.repo.outputs.name }}/api:pr-${{ github.event.pull_request.number }}
- name: Create GitHub deployment for staging
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v6
with:
script: |
const ref = context.payload.pull_request.head.sha;
const env = 'staging';
const resp = await github.rest.repos.createDeployment({
owner: context.repo.owner,
repo: context.repo.repo,
ref,
required_contexts: [],
environment: env,
description: `PR #${context.payload.pull_request.number} preview deployment`,
transient_environment: true,
auto_merge: false
});
// create a deployment status pointing to the staging URL
await github.rest.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: resp.data.id,
state: 'success',
environment_url: 'https://tasknote-stg.darkroasted.vps-kinghost.net'
});
+27
View File
@@ -60,6 +60,7 @@ jobs:
permissions:
contents: write
packages: write
deployments: write
steps:
- name: Checkout code
@@ -105,3 +106,29 @@ jobs:
cache-to: type=gha,mode=max
build-args: |
VITE_BUILD=${{ steps.version.outputs.tag }}
- name: Create GitHub deployment for staging
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v6
with:
script: |
const ref = context.payload.pull_request.head.sha;
const env = 'staging';
const resp = await github.rest.repos.createDeployment({
owner: context.repo.owner,
repo: context.repo.repo,
ref,
required_contexts: [],
environment: env,
description: `PR #${context.payload.pull_request.number} preview deployment`,
transient_environment: true,
auto_merge: false
});
// create a deployment status pointing to the staging URL
await github.rest.repos.createDeploymentStatus({
owner: context.repo.owner,
repo: context.repo.repo,
deployment_id: resp.data.id,
state: 'success',
environment_url: 'https://tasknote-stg.darkroasted.vps-kinghost.net'
});