Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 15 additions & 19 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v7
uses: actions/checkout@v4

- name: Set up QEMU (Multi-Arch)
uses: docker/setup-qemu-action@v4
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
uses: docker/setup-buildx-action@v3

- name: Install Cosign (Sigstore)
uses: sigstore/cosign-installer@v4.1.2
uses: sigstore/cosign-installer@v3.8.0

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
Expand All @@ -44,34 +44,30 @@ jobs:

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v6
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=sha,format=short

- name: Build and Push Multi-Arch Image
id: build-and-push
uses: docker/build-push-action@v7
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Sign Container Image with Cosign (Keyless Sigstore)
env:
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
run: |
echo "Signing image digest: ${DIGEST}"
cosign sign --yes "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${DIGEST}"

- name: Verify Cosign Signature
- name: Sign the Published Image with Cosign Keyless OIDC
if: ${{ steps.build-and-push.outputs.imageid != '' }}
run: |
cosign verify "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}" \
--certificate-identity-regexp="https://github.com/RitualDev-Lab/" \
--certificate-oidc-issuer="https://token.actions.githubusercontent.com"
cosign sign --yes "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}"
env:
COSIGN_EXPERIMENTAL: "1"
8 changes: 5 additions & 3 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v6
uses: actions/configure-pages@v5
with:
enablement: true
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
uses: actions/upload-pages-artifact@v3
with:
path: 'docs'
- name: Deploy to GitHub Pages
Expand Down
27 changes: 14 additions & 13 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
contents: read
packages: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.0.0
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: "https://npm.pkg.github.com"
Expand All @@ -35,12 +35,12 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run Tests
run: pnpm test

- name: Build DBShield
run: pnpm run build

- name: Run Tests
run: pnpm test

- name: Publish to GitHub Packages
continue-on-error: true
run: |
Expand All @@ -60,34 +60,35 @@ jobs:
id-token: write # Required for OIDC token minting & Sigstore Rekor ledger signing
attestations: write # Required for GitHub build provenance attestations
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.0.0
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run Test Suite
run: pnpm test

- name: Build DBShield
run: pnpm run build

- name: Run Test Suite
run: pnpm test

- name: Generate SLSA Build Provenance Attestation
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.0.0
uses: actions/attest-build-provenance@v2
with:
subject-path: 'dist/**'

- name: Publish to npm with Sigstore Provenance
continue-on-error: true
run: pnpm publish --no-git-checks --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
63 changes: 20 additions & 43 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
attestations: write
steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node.js 22
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.0.0
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
Expand All @@ -35,60 +35,37 @@ jobs:
- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Build TypeScript
run: pnpm run build

- name: Check Code Quality
run: pnpm run check

- name: Run Test Suite
run: pnpm test

- name: Build TypeScript
run: pnpm run build

- name: Generate SLSA Build Provenance Attestation
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.0.0
uses: actions/attest-build-provenance@v2
with:
subject-path: 'dist/**'

- name: Generate CycloneDX SBOM
uses: anchore/sbom-action@66cbf4bc1f1c0d2edc94016e65bc221b6bb0ad6c # v0.24.3
with:
path: ./
format: 'cyclonedx-json'
output-file: 'dist/dbshield-cyclonedx.sbom.json'
artifact-name: 'dbshield-cyclonedx.sbom.json'
upload-artifact: true
upload-release-assets: false
- name: Pack Tarball
run: pnpm pack

- name: Generate SPDX SBOM
uses: anchore/sbom-action@66cbf4bc1f1c0d2edc94016e65bc221b6bb0ad6c # v0.24.3
- name: Create GitHub Release
uses: softprops/action-gh-release@c95fe1489396fe8a9ec87454c605fbb0b60764ab # v2.2.1
with:
path: ./
format: 'spdx-json'
output-file: 'dist/dbshield-spdx.sbom.json'
artifact-name: 'dbshield-spdx.sbom.json'
upload-artifact: true
upload-release-assets: false
files: |
*.tgz
dist/**
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to npm with Provenance
continue-on-error: true
run: pnpm publish --no-git-checks --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Reconfigure for GitHub Packages
continue-on-error: true
run: |
echo "@ritualdev-lab:registry=https://npm.pkg.github.com" > .npmrc
echo "//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}" >> .npmrc
pnpm publish --no-git-checks --provenance=false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create GitHub Release with SBOM Artifacts
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
with:
generate_release_notes: true
files: |
dist/dbshield-cyclonedx.sbom.json
dist/dbshield-spdx.sbom.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Run OpenSSF Scorecard
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
uses: ossf/scorecard-action@v2.4.1
with:
results_file: results.sarif
results_format: sarif
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM node:22-slim AS builder

WORKDIR /build

RUN corepack enable && corepack prepare pnpm@latest --activate
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY tsconfig.json biome.json ./
Expand Down
2 changes: 1 addition & 1 deletion server.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
"name": "io.github.ritualdev-lab/dbshield",
"title": "DBShield Database Guardrail & Sandboxing MCP Server",
"description": "Safety-first Database Guardrail, AST SQL Validator, PII Masker, and Copy-on-Write Sandbox for AI Coding Agents (Cursor, Claude Desktop, Antigravity, Windsurf)",
"description": "Safety-first Database Guardrail & Sandboxing MCP Server for AI Coding Agents",
"version": "0.2.1",
"status": "active",
"repository": {
Expand Down
1 change: 1 addition & 0 deletions tests/postgres-proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ test("PostgresWireProxy - End-to-end TCP interceptor workflow", async () => {
assert.equal(statsAfterSafe.queriesAllowed, 1);

// Test D: Intercept Destructive DDL (DROP TABLE)
await new Promise((r) => setTimeout(r, 100));
receivedClientPackets.length = 0;
receivedUpstreamQueries = [];
client.write(buildQueryPacket("DROP TABLE users;"));
Expand Down
Loading