From 1b95e75310271e698c603c6af3a4c48fa7338b90 Mon Sep 17 00:00:00 2001 From: nicholai Date: Thu, 9 Oct 2025 01:39:24 -0600 Subject: [PATCH] initialized repository --- .env.example | 49 + .gitea/issue_templates/bug_report.md | 26 + .gitea/issue_templates/enhancement.md | 15 + .gitea/issue_templates/feature_request.md | 23 + .gitea/pull_request_template.md | 29 + .gitea/workflows/ci.yml | 42 + .gitea/workflows/pr-lint.yml | 17 + .gitignore | 54 + CONTRIBUTING.md | 57 + COPYING.txt | 674 ++ README.md | 317 +- bandit-runner-app/.gitignore | 45 + bandit-runner-app/.vscode/settings.json | 5 + bandit-runner-app/README.md | 36 + bandit-runner-app/cloudflare-env.d.ts | 8346 +++++++++++++++++++++ bandit-runner-app/eslint.config.mjs | 16 + bandit-runner-app/next.config.ts | 11 + bandit-runner-app/open-next.config.ts | 9 + bandit-runner-app/package.json | 32 + bandit-runner-app/pnpm-lock.yaml | 8161 ++++++++++++++++++++ bandit-runner-app/postcss.config.mjs | 5 + bandit-runner-app/public/_headers | 3 + bandit-runner-app/public/file.svg | 1 + bandit-runner-app/public/globe.svg | 1 + bandit-runner-app/public/next.svg | 1 + bandit-runner-app/public/vercel.svg | 1 + bandit-runner-app/public/window.svg | 1 + bandit-runner-app/src/app/favicon.ico | Bin 0 -> 25931 bytes bandit-runner-app/src/app/globals.css | 26 + bandit-runner-app/src/app/layout.tsx | 34 + bandit-runner-app/src/app/page.tsx | 103 + bandit-runner-app/tsconfig.json | 31 + bandit-runner-app/wrangler.jsonc | 51 + docs/bandit-runner.md | 41 + docs/setup-audit-report.md | 390 + public/bandit-logo.png | Bin 0 -> 1392166 bytes scripts/seed-labels.sh | 100 + 37 files changed, 18751 insertions(+), 2 deletions(-) create mode 100644 .env.example create mode 100644 .gitea/issue_templates/bug_report.md create mode 100644 .gitea/issue_templates/enhancement.md create mode 100644 .gitea/issue_templates/feature_request.md create mode 100644 .gitea/pull_request_template.md create mode 100644 .gitea/workflows/ci.yml create mode 100644 .gitea/workflows/pr-lint.yml create mode 100644 CONTRIBUTING.md create mode 100644 COPYING.txt create mode 100644 bandit-runner-app/.gitignore create mode 100644 bandit-runner-app/.vscode/settings.json create mode 100644 bandit-runner-app/README.md create mode 100644 bandit-runner-app/cloudflare-env.d.ts create mode 100644 bandit-runner-app/eslint.config.mjs create mode 100644 bandit-runner-app/next.config.ts create mode 100644 bandit-runner-app/open-next.config.ts create mode 100644 bandit-runner-app/package.json create mode 100644 bandit-runner-app/pnpm-lock.yaml create mode 100644 bandit-runner-app/postcss.config.mjs create mode 100644 bandit-runner-app/public/_headers create mode 100644 bandit-runner-app/public/file.svg create mode 100644 bandit-runner-app/public/globe.svg create mode 100644 bandit-runner-app/public/next.svg create mode 100644 bandit-runner-app/public/vercel.svg create mode 100644 bandit-runner-app/public/window.svg create mode 100644 bandit-runner-app/src/app/favicon.ico create mode 100644 bandit-runner-app/src/app/globals.css create mode 100644 bandit-runner-app/src/app/layout.tsx create mode 100644 bandit-runner-app/src/app/page.tsx create mode 100644 bandit-runner-app/tsconfig.json create mode 100644 bandit-runner-app/wrangler.jsonc create mode 100644 docs/bandit-runner.md create mode 100644 docs/setup-audit-report.md create mode 100644 public/bandit-logo.png create mode 100755 scripts/seed-labels.sh diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..c3efd86 --- /dev/null +++ b/.env.example @@ -0,0 +1,49 @@ +# Bandit Runner Environment Variables +# Copy this to .env.local and fill in your values + +# ============================================================================= +# Required for Development +# ============================================================================= + +# OpenAI API Key (or compatible endpoint) +# Get from: https://platform.openai.com/api-keys +OPENAI_API_KEY=sk-... + +# ============================================================================= +# Cloudflare (Required for Production) +# ============================================================================= + +# Cloudflare Account ID +# Find at: https://dash.cloudflare.com/ β†’ Workers & Pages β†’ Overview +CLOUDFLARE_ACCOUNT_ID= + +# Cloudflare API Token +# Create at: https://dash.cloudflare.com/profile/api-tokens +# Permissions needed: Workers Scripts:Edit, D1:Edit, R2:Edit +CLOUDFLARE_API_TOKEN= + +# ============================================================================= +# Optional Configuration +# ============================================================================= + +# Alternative LLM Endpoint (e.g., OpenRouter, local inference) +# LLM_BASE_URL=https://openrouter.ai/api/v1 +# LLM_API_KEY= + +# Bandit SSH Configuration (defaults shown) +# BANDIT_HOST=bandit.labs.overthewire.org +# BANDIT_PORT=2220 + +# Run Coordinator Settings +# MAX_STEPS_PER_RUN=100 +# TIMEOUT_SECONDS=300 + +# ============================================================================= +# Development Only +# ============================================================================= + +# Next.js +# NEXT_PUBLIC_API_URL=http://localhost:3000 + +# Wrangler Local Dev +# PORT=8787 diff --git a/.gitea/issue_templates/bug_report.md b/.gitea/issue_templates/bug_report.md new file mode 100644 index 0000000..67cb886 --- /dev/null +++ b/.gitea/issue_templates/bug_report.md @@ -0,0 +1,26 @@ +--- +name: "🐞 Bug report" +about: Report a reproducible problem +labels: ["type:fix"] +--- + +### What happened? + + +### Expected behavior + +### Repro steps +1. +2. +3. + +### Logs / screenshots + + +### Environment +- Browser: +- Node: `node -v` +- pnpm: `pnpm -v` +- App commit SHA: + +### Extra context diff --git a/.gitea/issue_templates/enhancement.md b/.gitea/issue_templates/enhancement.md new file mode 100644 index 0000000..46cc524 --- /dev/null +++ b/.gitea/issue_templates/enhancement.md @@ -0,0 +1,15 @@ +--- +name: "✨ Enhancement" +about: Improve an existing capability +labels: ["type:docs","type:chore"] +--- + +### Current behavior + +### Desired behavior + +### Acceptance criteria +- [ ] AC1 +- [ ] AC2 + +### Notes / risks diff --git a/.gitea/issue_templates/feature_request.md b/.gitea/issue_templates/feature_request.md new file mode 100644 index 0000000..91aa07f --- /dev/null +++ b/.gitea/issue_templates/feature_request.md @@ -0,0 +1,23 @@ +--- +name: "πŸš€ Feature request" +about: Propose a net-new capability +labels: ["type:feat"] +--- + +### Problem this solves + +### Proposed solution (what & why) + +### Non-goals / constraints + +### Acceptance criteria +- [ ] AC1 +- [ ] AC2 + +### Alternatives considered + +### Impacted areas +- [ ] UI +- [ ] RunCoordinator DO +- [ ] Scoring/validators +- [ ] Storage (D1/R2) diff --git a/.gitea/pull_request_template.md b/.gitea/pull_request_template.md new file mode 100644 index 0000000..b442efb --- /dev/null +++ b/.gitea/pull_request_template.md @@ -0,0 +1,29 @@ +## Summary + + +## Type +- [ ] feat +- [ ] fix +- [ ] docs +- [ ] chore +- [ ] refactor +- [ ] test + +## Screenshots / logs + + +## How to test +1. +2. +3. + +## Checklist +- [ ] Tests added/updated (unit or integration) +- [ ] Typecheck & lint pass (`pnpm check`) +- [ ] Builds locally (`pnpm build`) +- [ ] Docs/README/ADR updated if needed +- [ ] No secrets committed + +## Linked issues +Fixes # +Refs # diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..73ec255 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,42 @@ +name: CI + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + build-test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./bandit-runner-app + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "pnpm" + cache-dependency-path: bandit-runner-app/pnpm-lock.yaml + + - name: Install deps + run: pnpm install --frozen-lockfile + + - name: Lint + run: pnpm lint + + - name: Typecheck + run: npx tsc --noEmit + + - name: Build (OpenNext) + run: pnpm build diff --git a/.gitea/workflows/pr-lint.yml b/.gitea/workflows/pr-lint.yml new file mode 100644 index 0000000..dc13715 --- /dev/null +++ b/.gitea/workflows/pr-lint.yml @@ -0,0 +1,17 @@ +name: PR Title Lint + +on: + pull_request: + types: [opened, edited, synchronize] + +jobs: + pr-title: + runs-on: ubuntu-latest + steps: + - name: Check PR title + run: | + title="$(jq -r '.pull_request.title' < "$GITHUB_EVENT_PATH")" + if ! grep -Eq '^(feat|fix|docs|chore|refactor|test)(\(.+\))?: .+' <<<"$title"; then + echo "PR title must follow Conventional Commits. Got: $title" + exit 1 + fi diff --git a/.gitignore b/.gitignore index ceaea36..925f48e 100644 --- a/.gitignore +++ b/.gitignore @@ -130,3 +130,57 @@ dist .yarn/install-state.gz .pnp.* +# --- Cloudflare / Wrangler +.wrangler/ +.dev.vars +.wrangler/state/ +.wrangler/state/** + +# D1 local databases (Wrangler stores sqlite under .wrangler/state) +*.sqlite +*.sqlite-journal + +# OpenNext build artifacts +.open-next/ +.open-next/** + +# Vercel local metadata (Next tooling sometimes creates this) +.vercel/ + +# pnpm store (optional; usually outside project, but ignore if present locally) +.pnpm-store/ + +# Lockfile hygiene (commit pnpm-lock.yaml; ignore the others) +package-lock.json +yarn.lock +bun.lockb + +# OS/editor junk +.DS_Store +Thumbs.db +*.swp +*.swo +.idea/ +.vscode/* +!.vscode/extensions.json +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json + +# Turborepo cache (if you introduce turbo later) +.turbo/ + +# Playwright / Cypress / Vitest / Jest artifacts +playwright-report/ +test-results/ +coverage-final.json +jest-test-results.json +cypress/videos/ +cypress/screenshots/ +cypress/downloads/ + +# Misc caches +.npm/_logs +.*.cache +.cache-loader/ + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..c1c019c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,57 @@ +## Branch Strategy + +We use short-lived topic branches, Conventional Commits, and PRs into `main`. + +### Branch prefixes +Create branches using one of: +- `feat/-` – new features (e.g., `feat/runner-do-timeouts`) +- `fix/-` – bug fixes +- `docs/-` – docs only +- `chore/-` – tooling, config, non-product changes +- `refactor/-` – no behavior change +- `test/-` – test-only changes + +### Examples +```bash +git checkout -b feat/ssh-timeout-handler +git checkout -b fix/scoring-edge-case +git checkout -b docs/adr-durable-objects +git checkout -b chore/update-deps +``` + +### Commit messages +Follow [Conventional Commits](https://www.conventionalcommits.org/): +``` +(): + + + +