From 4fd7a797c5dc710bfc83469910a99a457fe863d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20MARQUET?= <72651575+BreizhHardware@users.noreply.github.com> Date: Wed, 17 Dec 2025 08:53:44 +0000 Subject: [PATCH] feat(action): Add regular github action for audit security vulnerability --- .devcontainer/devcontainer.json | 12 ++++++++++ .github/workflows/audit.yml | 42 +++++++++++++++++++++++++++++++++ package-lock.json | 13 ---------- 3 files changed, 54 insertions(+), 13 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/workflows/audit.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..7e289f8 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,12 @@ +{ + "name": "Node.js 24", + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "features": { + "ghcr.io/devcontainers/features/node:1": { + "nodeGypDependencies": true, + "version": "lts", + "nvmVersion": "latest" + }, + "ghcr.io/devcontainers/features/git-lfs:1": {} + } +} \ No newline at end of file diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 0000000..56515bb --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,42 @@ +name: Security Audit + +on: + push: + branches: [main, dev] + pull_request: + branches: + - '**' + schedule: + - cron: '0 8 * * *' + workflow_dispatch: + +jobs: + audit: + runs-on: ubuntu-latest + permissions: + contents: read + issues: write + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install dependencies + run: npm install + + - name: Run security audit + id: audit + run: npm audit --audit-level moderate + continue-on-error: true + + - name: Create issue on failure + if: steps.audit.outcome == 'failure' + uses: actions/github-script@v8 + with: + script: | + github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: 'Security Audit Failed', + body: 'The daily security audit has failed. Please check the workflow run for details: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}', + labels: ['security', 'audit'] + }); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 9646781..33b2a30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1819,19 +1819,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/@eslint/js": { - "version": "9.39.1", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.1.tgz", - "integrity": "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - } - }, "node_modules/espree": { "version": "10.4.0", "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",