Open-source document signature platform. Not affiliated with DocuSign.
TypeScript
Add CodeQL, dependency review, npm audit, Scorecard, and SBOM with provenance on releases
Claudea530cbac9bcf
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.ymlnew file mode 100644index 0000000..7a07b95--- /dev/null+++ b/.github/workflows/codeql.yml@@ -0,0 +1,39 @@+# Static analysis of the app's TypeScript and of these workflows with+# GitHub CodeQL. Findings go to the repository's Security tab.+#+# Only in the SignuDoc repository itself: a copy made by the Vercel Deploy+# button skips it (its owner can turn on CodeQL in their own settings).++name: CodeQL++on:+ pull_request:+ push:+ branches: [main]+ schedule:+ - cron: "23 5 * * 2"++permissions:+ contents: read++jobs:+ analyze:+ name: Analyze (${{ matrix.language }})+ if: github.repository == 'NYLLON-SOFTWARE/SignuDoc'+ runs-on: ubuntu-latest+ permissions:+ contents: read+ security-events: write+ strategy:+ fail-fast: false+ matrix:+ language: [javascript-typescript, actions]+ steps:+ - uses: actions/checkout@v6+ - uses: github/codeql-action/init@v4+ with:+ languages: ${{ matrix.language }}+ queries: security-extended+ - uses: github/codeql-action/analyze@v4+ with:+ category: /language:${{ matrix.language }}diff --git a/.github/workflows/dependency-audit.yml b/.github/workflows/dependency-audit.ymlnew file mode 100644index 0000000..a007cbf--- /dev/null+++ b/.github/workflows/dependency-audit.yml@@ -0,0 +1,55 @@+# Watches the app's dependencies for known vulnerabilities.+#+# - On every pull request, GitHub's dependency review fails the check when+# the change adds a dependency with a known high or critical+# vulnerability, or one under a license that is not allowed here.+# - Every week, and on pushes to main, npm audit checks what the app ships+# (dev dependencies left out) and fails on a high or critical advisory.+#+# Version-update pull requests (Dependabot version updates) are left out on+# purpose: a copy made by the Vercel Deploy button would get them too, and+# they would clash with the releases that update-signudoc.yml brings in.+# Dependabot alerts and security updates are turned on in the repository's+# settings instead, which a copy does not inherit.+#+# Only in the SignuDoc repository itself; a copy skips it.++name: Dependency audit++on:+ pull_request:+ push:+ branches: [main]+ schedule:+ - cron: "11 6 * * 1"++permissions:+ contents: read++jobs:+ review:+ name: Dependency review+ if: github.repository == 'NYLLON-SOFTWARE/SignuDoc' && github.event_name == 'pull_request'+ runs-on: ubuntu-latest+ permissions:+ contents: read+ pull-requests: write+ steps:+ - uses: actions/dependency-review-action@v4+ with:+ fail-on-severity: high+ comment-summary-in-pr: on-failure+ deny-licenses: AGPL-1.0-only, AGPL-1.0-or-later, AGPL-3.0-only, AGPL-3.0-or-later, GPL-2.0-only, GPL-2.0-or-later, GPL-3.0-only, GPL-3.0-or-later, SSPL-1.0++ audit:+ name: npm audit+ if: github.repository == 'NYLLON-SOFTWARE/SignuDoc' && github.event_name != 'pull_request'+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v6+ - uses: actions/setup-node@v6+ with:+ node-version-file: .nvmrc+ cache: npm+ - run: npm ci --ignore-scripts+ - run: npm audit --omit=dev --audit-level=highdiff --git a/.github/workflows/release-artifacts.yml b/.github/workflows/release-artifacts.ymlnew file mode 100644index 0000000..9022c25--- /dev/null+++ b/.github/workflows/release-artifacts.yml@@ -0,0 +1,66 @@+# For each published release: a software bill of materials (SBOM) and+# signed build provenance, attached to the release.+#+# - signudoc-<version>.cdx.json: every npm package the app ships, with+# versions and licenses, in CycloneDX format (npm sbom).+# - signudoc-<version>.tar.gz: the source of the tagged commit.+# - GitHub artifact attestations for both, signed through Sigstore, so+# anyone can check they were made by this workflow from this repository:+# gh attestation verify signudoc-<version>.tar.gz -R NYLLON-SOFTWARE/SignuDoc+#+# Only in the SignuDoc repository itself; a copy skips it.++name: Release artifacts++on:+ release:+ types: [published]+ workflow_dispatch:+ inputs:+ tag:+ description: "Release tag to make the artifacts for, such as v0.3.0."+ required: true++permissions:+ contents: read++jobs:+ artifacts:+ name: SBOM and provenance+ if: github.repository == 'NYLLON-SOFTWARE/SignuDoc'+ runs-on: ubuntu-latest+ permissions:+ attestations: write+ contents: write+ id-token: write+ env:+ TAG: ${{ github.event.release.tag_name || inputs.tag }}+ steps:+ - uses: actions/checkout@v6+ with:+ ref: ${{ env.TAG }}+ persist-credentials: false+ - uses: actions/setup-node@v6+ with:+ node-version-file: .nvmrc+ cache: npm+ - run: npm ci --ignore-scripts+ - name: Make the SBOM and the source archive+ run: |+ version="${TAG#v}"+ echo "VERSION=${version}" >> "$GITHUB_ENV"+ mkdir -p dist+ npm sbom --omit=dev --sbom-format=cyclonedx --sbom-type=application > "dist/signudoc-${version}.cdx.json"+ git archive --format=tar.gz --prefix="signudoc-${version}/" -o "dist/signudoc-${version}.tar.gz" HEAD+ (cd dist && sha256sum * > SHA256SUMS)+ - uses: actions/attest-build-provenance@v2+ with:+ subject-path: dist/*+ - uses: actions/attest-sbom@v2+ with:+ subject-path: dist/signudoc-${{ env.VERSION }}.tar.gz+ sbom-path: dist/signudoc-${{ env.VERSION }}.cdx.json+ - name: Attach to the release+ env:+ GH_TOKEN: ${{ github.token }}+ run: gh release upload "$TAG" dist/* --clobber --repo "$GITHUB_REPOSITORY"diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.ymlnew file mode 100644index 0000000..c452307--- /dev/null+++ b/.github/workflows/scorecard.yml@@ -0,0 +1,39 @@+# OpenSSF Scorecard: checks this repository's own security practices+# (branch protection, pinned and reviewed changes, token permissions,+# dependency updates and more) and publishes the score at+# https://scorecard.dev/viewer/?uri=github.com/NYLLON-SOFTWARE/SignuDoc.+#+# Only in the SignuDoc repository itself; a copy skips it.++name: Scorecard++on:+ branch_protection_rule:+ push:+ branches: [main]+ schedule:+ - cron: "41 6 * * 3"++permissions: read-all++jobs:+ analysis:+ name: Scorecard analysis+ if: github.repository == 'NYLLON-SOFTWARE/SignuDoc'+ runs-on: ubuntu-latest+ permissions:+ contents: read+ id-token: write+ security-events: write+ steps:+ - uses: actions/checkout@v6+ with:+ persist-credentials: false+ - uses: ossf/[email protected]+ with:+ results_file: results.sarif+ results_format: sarif+ publish_results: true+ - uses: github/codeql-action/upload-sarif@v4+ with:+ sarif_file: results.sarifdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex e353298..2de5b3b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -43,6 +43,13 @@ release says when it does.`docs/backup-and-restore.md`. `vercel.json` has a second daily cron job,which does nothing until the token is set.+### Project security++- CodeQL, dependency review, a weekly `npm audit` and OpenSSF Scorecard run+ on the SignuDoc repository (skipped in a copy made by the Deploy button).+- Each release gets a CycloneDX SBOM, a source archive and signed build+ provenance attached. `SECURITY.md` says how to verify them.+This release changes the database (`20261117090000_sign_in_security.sql`,`20261117100000_session_controls.sql`), which the production build applies.diff --git a/SECURITY.md b/SECURITY.mdindex 1228e5a..979f25c 100644--- a/SECURITY.md+++ b/SECURITY.md@@ -36,6 +36,27 @@ This policy covers the SignuDoc application code in this repository, including:Security fixes are applied to the latest release only.+## How the code is checked++- **Static analysis.** GitHub CodeQL (the `security-extended` queries) runs on every pull request, on `main` and weekly, over the TypeScript and over the GitHub Actions workflows. See `.github/workflows/codeql.yml`.+- **Dependencies.** Every pull request runs GitHub's dependency review, which fails on a new dependency with a known high or critical vulnerability, or under a license this project does not take (GPL, AGPL, SSPL). `npm audit` checks what the app ships every week and on `main`. See `.github/workflows/dependency-audit.yml`.+- **Repository practices.** OpenSSF Scorecard scores the repository weekly; the result is at [scorecard.dev](https://scorecard.dev/viewer/?uri=github.com/NYLLON-SOFTWARE/SignuDoc).+- **Tests.** Typecheck, lint, unit tests, tests against a real Postgres and an end-to-end browser test run on every pull request (`.github/workflows/ci.yml`).++## Verifying a release++Each release from v0.3.0 on has these files attached, made by `.github/workflows/release-artifacts.yml`:++- `signudoc-<version>.tar.gz`: the source of the tagged commit.+- `signudoc-<version>.cdx.json`: a software bill of materials in CycloneDX format, listing every npm package the app ships with its version and license.+- `SHA256SUMS`: their checksums.++Each file has a GitHub artifact attestation, signed through Sigstore, saying which workflow run in this repository made it from which commit. To check one with the GitHub CLI:++```sh+gh attestation verify signudoc-<version>.tar.gz -R NYLLON-SOFTWARE/SignuDoc+```+## RecognitionWe appreciate responsible disclosure. If you report a valid vulnerability, we are happy to credit you in the fix commit or release notes unless you prefer to remain anonymous.