Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6619660
Phase 0.1/0.2: upgrade dependency pins, split out dev dependencies
claude Aug 21, 2026
38646b7
Phase 0.3/0.4: add CI workflow and ruff/pytest configuration
claude Aug 21, 2026
2dc846d
Phase 0.5: apply ruff lint fixes and formatting
claude Aug 21, 2026
3fc5730
Phase 0.6: correct the license references to GPL-3.0
claude Aug 21, 2026
9070be2
Phase 0.7: gate Render auto-deploy on passing CI checks
claude Aug 21, 2026
4e37551
Phase 0.8: remove dead find_candidate_arrays and sync the stale docs
claude Aug 21, 2026
e493e29
Phase 1.1: neutralize spreadsheet formula injection on all four expor…
claude Aug 21, 2026
1fd8a25
Phase 1.2/1.3: stop logging API-fetch URLs; malformed API JSONL is a 400
claude Aug 21, 2026
4c8a49a
Phase 1.4: replace the outbound header rule with a real allowlist
claude Aug 21, 2026
c5291b2
Phase 1.5: add the missing hardening headers and tighten CSP
claude Aug 21, 2026
773e886
Phase 1.6: fail fast on the dev SECRET_KEY in production; validate in…
claude Aug 21, 2026
b03c5a9
Phase 1.7: bound recursion depth in extract_table_data and handle Rec…
claude Aug 21, 2026
0651651
Phase 1.8: run DNS on a shared bounded pool with admission control
claude Aug 21, 2026
ed60332
Phase 1.9: restrict API fetch to an allowlist of ports
claude Aug 21, 2026
a36b688
Phase 1.10: opt-in proxy-aware rate limiting
claude Aug 21, 2026
7614f58
Phase 1.11-1.15: JSON error handlers, no-store, upload checks, cookie…
claude Aug 21, 2026
4e285bc
Phase 2.1: gzip large text and JSON responses
claude Aug 21, 2026
dac58c6
Phase 2.2: cache static assets for a day behind versioned URLs
claude Aug 21, 2026
0a9515f
Phase 2.3-2.10: exports, preview projection, client caps, topology guard
claude Aug 21, 2026
8e1773b
Phase 2.3: record the confirming measurement for MAX_EXPORT_CELLS
claude Aug 21, 2026
b1f6a23
Phase 3.1-3.5: split process_json, add annotations, return preview_limit
claude Aug 21, 2026
213da85
Phase 4.1-4.5, 4.7, 4.8: client features and the /health split
claude Aug 21, 2026
20b3ef4
Phase 5.1-5.5: sync docs and memory, add DX tooling, bump to 1.2.0
claude Aug 21, 2026
b47ed46
Phase 1.11 follow-up: return JSON for CSRF rejections too
claude Aug 21, 2026
0bc406c
Address Codex review: port allowlist, readiness check, tree cap, JSON…
claude Aug 22, 2026
a737165
Address CodeRabbit review: response leak, theme vars, a11y, CI hardening
claude Aug 22, 2026
1ea1036
Fix import cycle and port-allowlist regression from review round 3
claude Aug 22, 2026
f5d0728
CI: use ref_name so the push and pull_request groups actually match
claude Aug 22, 2026
4141121
CI: key concurrency on the source repo; fix MD022 in MEMORY.md
claude Aug 22, 2026
c92563c
fix: reject non-dict export rows before the CSV stream opens
claude Sep 2, 2026
eb1ec15
fix: honor Accept-Encoding quality values before gzipping
claude Sep 2, 2026
ce9b716
fix: enforce the API_FETCH_TIMEOUT / gunicorn --timeout invariant at …
claude Sep 2, 2026
53b928f
fix: escape '<' in Markdown export cells
claude Sep 2, 2026
bc2a841
fix: move focus into the About modal and hand it back on close
claude Sep 2, 2026
28ebba6
docs: correct three statements that contradicted the code, drop a dea…
claude Sep 2, 2026
5dc42b2
ci: cover each commit once instead of cancelling a duplicate run
claude Sep 2, 2026
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
85 changes: 85 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Copy to .env and adjust. Every value below is the built-in default, so an
# unset variable behaves exactly like the line shown.
#
# cp .env.example .env
#
# .env is gitignored. Never commit real secrets.

# --- Required in production --------------------------------------------------

# Flask/CSRF signing key. The built-in development default is publicly known, so
# the app REFUSES TO START with it when APP_ENV=production.
# python -c "import secrets; print(secrets.token_hex(32))"
SECRET_KEY=dev-secret-key-change-in-production

# The single canonical production signal. Setting it to "production" enables the
# SECRET_KEY fail-fast, the Secure session cookie, and the rate-limit topology
# guard. No other spelling is accepted -- two names would let a deployment
# satisfy one gate and silently miss another.
# APP_ENV=production

# --- Deployment topology (see README "Deployment topology and rate limiting") --

# Worker count. Single source of truth: gunicorn reads it natively and every
# documented start command passes --workers "$WEB_CONCURRENCY". Required under
# APP_ENV=production.
WEB_CONCURRENCY=1

# Replica count. Invisible from inside the process, so it is declared here and
# must mirror render.yaml's numInstances. Required under APP_ENV=production.
APP_REPLICAS=1

# Rate-limit counter storage. memory:// counters are process-local, so the
# effective limit is multiplied by workers x replicas. Anything above 1x1
# requires a shared backend (and requirements-redis.txt installed).
RATELIMIT_STORAGE_URI=memory://

# Trust X-Forwarded-* from exactly one proxy hop. Enable ONLY when the app sits
# behind a proxy you control; otherwise clients can forge their rate-limit bucket.
TRUST_PROXY=0

# --- Limits ------------------------------------------------------------------

MAX_UPLOAD_SIZE=10485760
PREVIEW_ROW_LIMIT=25
FLATTEN_MAX_DEPTH=10

# XLSX-only export budget, in cells (rows x columns). Derived from the
# measurement in docs/export-budget-v1.2.md. CSV/TSV are streamed and uncapped.
# 0 disables the guard.
MAX_EXPORT_CELLS=250000

# --- API fetch ---------------------------------------------------------------

API_FETCH_TIMEOUT=30
API_FETCH_MAX_RESPONSE=10485760

# Ports the API-fetch feature may connect to. Empty disables the check.
API_ALLOWED_PORTS=80,443,8443

# DNS admission control. API_DNS_TIMEOUT bounds how long a REQUEST waits, not how
# long the lookup runs -- getaddrinfo exposes no timeout and cannot be cancelled.
# API_DNS_MAX_WORKERS bounds concurrency, which is the actual starvation fix.
API_DNS_TIMEOUT=3
API_DNS_MAX_WORKERS=4
API_DNS_ADMISSION_TIMEOUT=1

# --- Rate limits -------------------------------------------------------------

RATE_LIMIT_DEFAULT=120/minute
RATE_LIMIT_PROCESS=30/minute
RATE_LIMIT_EXPORT=60/minute

# --- Misc --------------------------------------------------------------------

# Cache lifetime for static assets. Safe because asset URLs carry ?v=APP_VERSION.
STATIC_MAX_AGE=86400

# Responses below this size are not worth compressing.
GZIP_MIN_SIZE=1024

# Set to 0 to omit the version from /health.
HEALTH_REVEAL_VERSION=1

# Flask debug mode. Never enable in production.
FLASK_DEBUG=0
88 changes: 88 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CI

# Every commit is covered exactly once: a branch commit by its pull_request run,
# a main commit by its push run.
#
# `push: ["**"]` alongside `pull_request` ran BOTH on every push to a PR branch.
# The concurrency group below collapsed that pair, but collapsing means one of
# the two is cancelled -- and GitHub attaches a cancelled check run to the head
# commit, where it is not a success. So the PR reported `mergeable_state:
# unstable` on every push even with CI fully green, which is indistinguishable
# at a glance from a real failure. Not generating the duplicate beats cancelling
# it.
#
# The trade-off: a branch with no pull request open gets no CI. That is the
# intended shape -- the checks exist to gate the merge, and opening the PR is
# what starts them.
on:
push:
branches: ["main"]
pull_request:
Comment thread
badry-dev marked this conversation as resolved.

# Nothing here touches the GitHub API beyond checkout, so the token needs no
# write scope; an explicit block also stops it inheriting wider repo defaults.
permissions:
contents: read

# Supersede a branch's own earlier run when a new commit lands on it: pushing
# three times in a minute should not leave three runs competing for runners to
# report on commits nobody is waiting for any more.
#
# This cancels only runs for SUPERSEDED commits, never the current head's --
# the `on:` block above is what guarantees one run per commit, so there is no
# same-SHA pair left to collapse. A cancelled check run lands on the old commit,
# which is why this no longer costs the head commit its green state.
#
# The branch name alone is not unique across repositories: two pull requests
# opened from different forks on a branch both named `feature` would share a
# group, and cancel-in-progress would have them kill each other's checks. Keying
# on the source repo keeps forks apart. head_ref is the source branch on a
# pull_request and empty on a push; ref_name is the branch without the
# refs/heads/ prefix (github.ref would keep it).
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
Comment thread
badry-dev marked this conversation as resolved.
steps:
- uses: actions/checkout@v4
Comment thread
coderabbitai[bot] marked this conversation as resolved.
with:
# Nothing after this step talks to GitHub, so leaving the token in
# .git/config only widens what a compromised dependency can reach.
persist-credentials: false

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt

- name: Lint
run: ruff check .

- name: Format check
run: ruff format --check .

- uses: actions/setup-node@v4
with:
node-version: "22"

- name: Tests
run: python -m pytest tests/ -v

- name: Client-side export assertions (F1)
run: node tests/js/test_export_sanitize.mjs

- name: Client-side render/cap assertions (P4/P5/P13)
run: node tests/js/test_render_caps.mjs

- name: Client-side feature assertions (Phase 4)
run: node tests/js/test_features.mjs

- name: Audit runtime dependencies
run: pip-audit -r requirements.txt
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ ENV/
.DS_Store
Thumbs.db

# Node (test assertions only; no build step)
node_modules/

# Project specific
*.log
.env
Expand Down
Loading
Loading