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
15 changes: 15 additions & 0 deletions .codeql-dismissals.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$comment": "CodeQL alerts dismissed as false positives. Format: ruleId:file:line. These are skipped by scripts/security-scan.sh to match GitHub dismissals.",
"dismissed": [
{
"rule": "js/request-forgery",
"file": "src/lib/spotify-core.ts",
"reason": "SSRF mitigated by validateSpotifyPath() + URL origin check"
},
{
"rule": "js/http-to-file-access",
"file": "src/lib/spotify-core.ts",
"reason": "Local-dev-only debug log file write, sanitized values"
}
]
}
17 changes: 17 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# CODEOWNERS - Defines code ownership for pull request reviews
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

# Default owners for everything in the repo
* @312-dev/maintainers

# Security-sensitive files require explicit review
/.github/workflows/ @312-dev/maintainers
/src/lib/crypto.ts @312-dev/maintainers
/src/lib/auth.ts @312-dev/maintainers
/src/db/schema.ts @312-dev/maintainers
/SECURITY.md @312-dev/maintainers

# CI/CD and DevOps
/Dockerfile @312-dev/maintainers
/fly.toml @312-dev/maintainers
/.github/ @312-dev/maintainers
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Bug Report
about: Report a bug to help us improve Swapify
title: ''
labels: bug
assignees: ''
---

## Description

A clear and concise description of the bug.

## Steps to Reproduce

1. Go to '...'
2. Click on '...'
3. See error

## Expected Behavior

What you expected to happen.

## Actual Behavior

What actually happened.

## Screenshots

If applicable, add screenshots to help explain the problem.

## Environment

- Browser: [e.g., Chrome 120, Safari 17]
- OS: [e.g., iOS 17, macOS 14]
- Device: [e.g., iPhone 15, MacBook Pro]

## Additional Context

Add any other context about the problem here (console errors, logs, etc.).
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Security Vulnerability
url: https://github.com/312-dev/swapify/security/advisories/new
about: Report a security vulnerability privately
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature Request
about: Suggest a new feature for Swapify
title: ''
labels: enhancement
assignees: ''
---

## Problem Statement

A clear description of the problem you're trying to solve. Ex. "I'm always frustrated when..."

## Proposed Solution

A clear description of what you'd like to happen.

## Alternatives Considered

A description of any alternative solutions or features you've considered.

## Additional Context

Add any other context, mockups, or screenshots about the feature request here.
39 changes: 39 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Summary

Brief description of changes and motivation.

## Changes

- Change 1
- Change 2

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation update
- [ ] Refactoring (no functional changes)
- [ ] Dependencies update

## Testing

- [ ] Tested locally with `npm run dev`
- [ ] Added/updated tests (if applicable)
- [ ] `npm run lint:strict` passes with zero warnings
- [ ] `npm run type-check` passes

## Checklist

- [ ] My code follows the project's code style (see [CLAUDE.md](../CLAUDE.md))
- [ ] I have run `npm run lint:strict` and `npm run format:check` locally
- [ ] My changes generate no new warnings
- [ ] Any dependent changes have been merged and published

## Screenshots (if applicable)

Add screenshots for UI changes.

## Related Issues

Closes #(issue number)
12 changes: 12 additions & 0 deletions .github/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# OpenSSF Scorecard Maintainer Annotations
# https://github.com/ossf/scorecard/blob/main/config/README.md

annotations:
- checks:
- code-review
reasons:
- reason: not-applicable
# This is a solo-maintainer project. Requiring code review from a
# second human reviewer is not feasible. All changes undergo:
# - Automated CI checks (linting, type-checking, tests, build)
# - Self-review before merge
58 changes: 55 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
name: CI

on:
push:
branches: [main]
paths-ignore:
- '*.md'
pull_request:
branches: [main]
paths-ignore:
- '*.md'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: read-all

jobs:
ci:
lint-and-check:
name: Lint, Type Check, Build
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v6
Expand All @@ -20,8 +34,10 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint
- name: Lint (ratchet - no net-new warnings allowed)
# lint:ci threshold = current warning count (44). Ratchet down as tech debt is resolved.
# Pre-commit enforces --max-warnings 0 on changed files, so new code must be clean.
run: npm run lint:ci

- name: Format check
run: npm run format:check
Expand All @@ -43,6 +59,22 @@ jobs:
POLL_SECRET: test-poll-secret-16chars
NEXT_PUBLIC_APP_URL: https://test.swapify.app

- name: Test with coverage
run: npm run test:coverage
continue-on-error: true
env:
IRON_SESSION_PASSWORD: test-password-that-is-at-least-32-characters-long
POLL_SECRET: test-poll-secret-16chars
NEXT_PUBLIC_APP_URL: https://test.swapify.app

- name: Upload coverage report
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: always()
with:
name: coverage
path: coverage/
retention-days: 7

- name: Check for schema drift
run: |
SCHEMA_CHANGED=$(git diff origin/main...HEAD --name-only -- src/db/schema.ts | wc -l)
Expand All @@ -57,3 +89,23 @@ jobs:
run: npm run build
env:
NEXT_PUBLIC_APP_URL: https://swapify.312.dev

- name: Worker build
run: npm run worker:build

ci:
name: CI Status
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [lint-and-check]
if: always()
steps:
- name: Check CI results
run: |
results="${{ needs.lint-and-check.result }}"
echo "Job results: $results"
if echo "$results" | grep -qE '(failure|cancelled)'; then
echo "::error::CI job failed or was cancelled"
exit 1
fi
echo "All CI checks passed"
23 changes: 16 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
name: Deploy

on:
push:
workflow_run:
workflows: ["CI"]
types: [completed]
branches: [main]
workflow_dispatch:

concurrency:
group: deploy-production
cancel-in-progress: false

jobs:
ci:
name: Lint, Type Check, Build
gate:
name: Check CI Status
runs-on: ubuntu-latest

timeout-minutes: 5
if: >
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
steps:
- uses: actions/checkout@v6

Expand Down Expand Up @@ -48,9 +57,9 @@ jobs:

migrate:
name: Run Database Migrations
needs: ci
needs: gate
runs-on: ubuntu-latest
concurrency: deploy-production
timeout-minutes: 10

steps:
- uses: actions/checkout@v6
Expand All @@ -72,7 +81,7 @@ jobs:
name: Deploy to Fly.io
needs: migrate
runs-on: ubuntu-latest
concurrency: deploy-production
timeout-minutes: 15

steps:
- uses: actions/checkout@v6
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# OpenSSF Scorecard
# Runs security health checks and publishes results to scorecard.dev
#
# NOTE: Actions in this workflow use version tags instead of SHA hashes
# because Scorecard's publish_results feature requires version tags for
# workflow verification. See: https://github.com/ossf/scorecard-action#workflow-restrictions

name: Scorecard

on:
push:
branches: [main]
schedule:
# Weekly scan on Sunday at midnight UTC
- cron: "0 0 * * 0"
workflow_dispatch:

permissions: read-all

jobs:
analysis:
name: Scorecard Analysis
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
security-events: write
id-token: write
contents: read
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false

- name: Run Scorecard
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
with:
results_file: results.sarif
results_format: sarif
publish_results: true

- name: Upload SARIF to GitHub Security tab
uses: github/codeql-action/upload-sarif@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v3
with:
sarif_file: results.sarif
Loading
Loading