Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

pr only

Pedro Ladeirae2748e92837c
diff --git a/.deepsec/package.json b/.deepsec/package.json
index cbbaae8ba4..aca864fd62 100644
--- a/.deepsec/package.json
+++ b/.deepsec/package.json
@@ -4,8 +4,7 @@
"type": "module",
"packageManager": "[email protected]",
"scripts": {
- "deepsec": "deepsec",
- "notify-slack": "node scripts/notify-slack.mjs"
+ "deepsec": "deepsec"
},
"dependencies": {
"deepsec": "^2.3.8"
diff --git a/.deepsec/scripts/notify-slack.mjs b/.deepsec/scripts/notify-slack.mjs
deleted file mode 100644
index bcc3f91c50..0000000000
--- a/.deepsec/scripts/notify-slack.mjs
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/usr/bin/env node
-/**
- * Posts revalidated HIGH/CRITICAL DeepSec findings to Slack.
- * Usage: node scripts/notify-slack.mjs [findings.json]
- */
-
-import { readFile } from "node:fs/promises";
-import { resolve } from "node:path";
-
-const WEBHOOK = process.env.DEEPSEC_SLACK_HOOK;
-const BLOB_BASE = "https://github.com/dubinc/dub/blob/main/apps/web";
-const HIGH = new Set(["HIGH", "CRITICAL"]);
-
-const findingsPath = resolve(
- process.argv[2] ?? new URL("../findings.json", import.meta.url).pathname,
-);
-
-function fileUrl(finding) {
- const meta = finding.metadata ?? {};
- const filePath = meta.filePath;
- const lines = meta.lineNumbers ?? [];
- const first = lines[0];
- const last = lines[lines.length - 1];
- const anchor =
- first == null ? "" : first === last ? `#L${first}` : `#L${first}-L${last}`;
- if (
- typeof meta.githubUrl === "string" &&
- meta.githubUrl.includes("/apps/web/")
- ) {
- return meta.githubUrl;
- }
- if (!filePath) return BLOB_BASE;
- return `${BLOB_BASE}/${filePath}${anchor}`;
-}
-
-function keep(finding) {
- const severity = finding.metadata?.severity ?? finding.severity;
- if (!HIGH.has(severity)) return false;
- const verdict = finding.metadata?.revalidation?.verdict;
- return verdict === "true-positive";
-}
-
-function titleText(finding) {
- return String(finding.title ?? "Untitled finding").replace(
- /^\[[A-Z_]+\]\s*/,
- "",
- );
-}
-
-if (!WEBHOOK) {
- console.log("DEEPSEC_SLACK_HOOK is not set; skipping Slack notify.");
- process.exit(0);
-}
-
-let raw;
-try {
- raw = await readFile(findingsPath, "utf8");
-} catch (error) {
- console.error(`Could not read ${findingsPath}: ${error.message}`);
- process.exit(1);
-}
-
-const parsed = JSON.parse(raw);
-const findings = (
- Array.isArray(parsed) ? parsed : parsed.findings ?? []
-).filter(keep);
-
-const header =
- findings.length === 0
- ? "DeepSec full scan: no HIGH+ after revalidation"
- : `:alert: DeepSec full scan: ${findings.length} HIGH+ finding(s) after revalidation`;
-
-const lines = findings.slice(0, 20).map((finding) => {
- const severity = finding.metadata?.severity ?? finding.severity;
- const filePath = finding.metadata?.filePath ?? "(unknown file)";
- return `• *${severity}* <${fileUrl(finding)}|${filePath}> — ${titleText(finding)}`;
-});
-
-if (findings.length > 20) {
- lines.push(
- `_…and ${findings.length - 20} more (see the workflow artifact)._`,
- );
-}
-
-const text = [header, ...lines].join("\n").slice(0, 2900);
-
-const response = await fetch(WEBHOOK, {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({
- blocks: [
- {
- type: "section",
- text: { type: "mrkdwn", text },
- },
- ],
- }),
-});
-
-if (!response.ok) {
- const body = await response.text();
- console.error(`Slack webhook failed (${response.status}): ${body}`);
- process.exit(1);
-}
-
-console.log(`Posted ${findings.length} HIGH+ finding(s) to Slack.`);
diff --git a/.github/workflows/deepsec.yml b/.github/workflows/deepsec.yml
deleted file mode 100644
index f5228d4f94..0000000000
--- a/.github/workflows/deepsec.yml
+++ /dev/null
@@ -1,165 +0,0 @@
-name: DeepSec full scan
-
-on:
- workflow_dispatch:
- inputs:
- agent:
- description: Agent backend (must match the model)
- required: true
- type: choice
- options:
- - codex
- - claude
- default: codex
- model:
- description: Model for process and revalidate
- required: true
- type: choice
- options:
- - gpt-5.5
- - gpt-5.5-pro
- - gpt-5.4
- - claude-opus-4-8
- - claude-sonnet-4-6
- default: gpt-5.5
- thinking_level:
- description: Reasoning effort (xhigh finds more, costs more)
- required: true
- type: choice
- options:
- - xhigh
- - high
- - medium
- default: xhigh
-
-permissions:
- contents: read
-
-concurrency:
- group: deepsec-full
- cancel-in-progress: false
-
-jobs:
- review:
- runs-on: ubuntu-latest
- timeout-minutes: 360
- defaults:
- run:
- working-directory: .deepsec
- env:
- AI_GATEWAY_API_KEY: ${{ secrets.DEEPSEC_AI_GATEWAY_API_KEY }}
- VERCEL_TOKEN: ${{ secrets.DEEPSEC_VERCEL_TOKEN }}
- VERCEL_TEAM_ID: ${{ secrets.DEEPSEC_VERCEL_TEAM_ID }}
- VERCEL_PROJECT_ID: ${{ secrets.DEEPSEC_VERCEL_PROJECT_ID }}
- DEEPSEC_AGENT: ${{ inputs.agent }}
- DEEPSEC_MODEL: ${{ inputs.model }}
- DEEPSEC_THINKING_LEVEL: ${{ inputs.thinking_level }}
- steps:
- - name: Check out code
- uses: actions/checkout@v4
-
- - name: Check agent and model
- working-directory: .
- run: |
- echo "agent=${DEEPSEC_AGENT} model=${DEEPSEC_MODEL} thinking=${DEEPSEC_THINKING_LEVEL}"
- case "${DEEPSEC_AGENT}:${DEEPSEC_MODEL}" in
- codex:gpt-*) ;;
- claude:claude-*) ;;
- *)
- echo "Model ${DEEPSEC_MODEL} does not match agent ${DEEPSEC_AGENT}."
- echo "Use gpt-* with codex, or claude-* with claude."
- exit 1
- ;;
- esac
-
- - name: Setup pnpm
- uses: pnpm/action-setup@v4
- with:
- version: 9.15.9
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: 24
- cache: pnpm
- cache-dependency-path: .deepsec/pnpm-lock.yaml
-
- - name: Install DeepSec
- run: |
- pnpm install --frozen-lockfile --ignore-workspace
- test -x node_modules/.bin/deepsec
-
- - name: Restore file records
- uses: actions/cache@v4
- with:
- path: .deepsec/data/web/files
- key: deepsec-web-files-${{ github.run_id }}
- restore-keys: |
- deepsec-web-files-
-
- - name: Scan
- run: pnpm exec deepsec scan --project-id web
-
- - name: Process in Vercel Sandboxes
- id: process
- continue-on-error: true
- run: |
- pnpm exec deepsec sandbox process \
- --project-id web \
- --agent "${DEEPSEC_AGENT}" \
- --model "${DEEPSEC_MODEL}" \
- --thinking-level "${DEEPSEC_THINKING_LEVEL}" \
- --sandboxes 10 \
- --concurrency 4 \
- --timeout 18000000
-
- - name: Revalidate HIGH+
- id: revalidate
- if: ${{ !cancelled() }}
- continue-on-error: true
- run: |
- pnpm exec deepsec revalidate \
- --project-id web \
- --min-severity HIGH \
- --agent "${DEEPSEC_AGENT}" \
- --model "${DEEPSEC_MODEL}" \
- --thinking-level "${DEEPSEC_THINKING_LEVEL}"
-
- - name: Export findings
- if: ${{ !cancelled() }}
- run: |
- pnpm exec deepsec export \
- --project-id web \
- --format json \
- --min-severity HIGH \
- --out findings.json
- pnpm exec deepsec export \
- --project-id web \
- --format md-dir \
- --min-severity HIGH \
- --out ./findings
-
- - name: Notify Slack
- if: ${{ !cancelled() && steps.process.outcome == 'success' && steps.revalidate.outcome == 'success' }}
- env:
- DEEPSEC_SLACK_HOOK: ${{ secrets.DEEPSEC_SLACK_HOOK }}
- run: pnpm notify-slack findings.json
-
- - name: Upload report
- if: ${{ !cancelled() }}
- uses: actions/upload-artifact@v4
- with:
- name: deepsec-full-findings
- path: |
- .deepsec/findings.json
- .deepsec/findings
- .deepsec/data/web/files
- if-no-files-found: warn
- retention-days: 90
-
- - name: Fail if process or revalidate errored
- if: ${{ !cancelled() && (steps.process.outcome == 'failure' || steps.revalidate.outcome == 'failure') }}
- run: |
- echo "process=${{ steps.process.outcome }} revalidate=${{ steps.revalidate.outcome }}"
- echo "DeepSec exited non-zero. Re-run this workflow with the same agent/model; finished files are kept and pending files resume."
- exit 1