feat: resilient integrations, column caching, SSRF fix + tests, and one-click Docker/Railway hosting#100
Merged
Merged
Conversation
…ndling Introduce lib/integrations/fetch.ts — a drop-in fetch() replacement that adds a per-attempt AbortSignal.timeout, jittered exponential backoff on retryable statuses (429/408/5xx) and network errors, Retry-After parsing, and a typed UpstreamError with friendly rate-limit messaging. Route all 25 upstream integrations through it so a slow or rate-limiting provider no longer hangs a column or surfaces a raw fetch failure.
Wrap the column fetcher in cachedColumnFetch, keyed on typeId + config + cursor. Identical concurrent requests (duplicate columns, Refresh all) share a single in-flight promise, and results are reused for a few seconds so a burst of refreshes no longer fans out to the same upstream repeatedly.
…uite validateWebhookUrl trusted URL.hostname, which keeps IPv6 brackets ([::1]), so the private-range guard never matched and loopback/link-local IPv6 targets were allowed. Strip brackets before checking, handle IPv4-mapped IPv6 (dotted and hex-compressed), and broaden the link-local match. Add a vitest suite (271 tests): plugin contract, SSRF guard, column colour normalisation, keyword matching, fetch cache, fetchUpstream, and a deck export->import round-trip. The round-trip runs against a true in-memory PGlite, so make memory:// in DATABASE_URL mean an ephemeral in-memory database instead of silently writing to on-disk .minitor/pgdata (the migrate script skips it).
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 34690012 | Triggered | Generic Password | 2b7fdea | docker-compose.yml | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
dfe986c to
13c7d47
Compare
Add a multi-stage Dockerfile (Next.js standalone output), docker-compose.yml (app + Postgres, migrate-on-boot), docker-entrypoint.sh, railway.json, and a .dockerignore for one-command self-hosting. Introduce an optional single-password gate via middleware.ts (HTTP Basic Auth, off when MINITOR_PASSWORD is unset) with a public /api/health probe, plus a hosted mode (lib/hosted.ts): setEnvKeys refuses to run and the settings key editor renders read-only, since keys come from the environment on a shared public instance. Set output: standalone in next.config.ts and document the deploy paths in the README.
…naries Add vitest (+ test/test:watch scripts). Regenerate package-lock.json so the nested esbuild@0.28.1 and its platform binaries are fully recorded — npm 11 tolerated the omission locally but npm ci in a clean container failed on the missing optional deps.
13c7d47 to
62dd499
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Five focused changes: harden the integrations layer, cut redundant upstream traffic, close a webhook SSRF hole (with a new test suite), and make Minitor one-click self-hostable on Docker / Railway.
Commits
feat(integrations)— newlib/integrations/fetch.ts(fetchUpstream): per-attemptAbortSignal.timeout, jittered exponential backoff on retryable statuses (429/408/5xx) + network errors,Retry-Afterparsing, and a typedUpstreamErrorwith friendly rate-limit messaging. All 25 upstream integrations routed through it, so a slow or rate-limiting provider no longer hangs a column or leaks a raw fetch error.perf(columns)—cachedColumnFetch, keyed ontypeId + config + cursor. Identical concurrent requests (duplicate columns, "Refresh all") share one in-flight promise; results are reused for a few seconds so bursts don't fan out to the same upstream.fix(security)—validateWebhookUrltrustedURL.hostname, which keeps IPv6 brackets ([::1]), so the private-range guard never matched and loopback/link-local IPv6 targets were allowed. Now strips brackets, handles IPv4-mapped IPv6 (dotted + hex-compressed), and broadens link-local matching. Adds a vitest suite (271 tests): plugin contract, SSRF guard, colour normalisation, keyword matching, fetch cache,fetchUpstream, and a deck export→import round-trip (against a true in-memory PGlite — somemory://inDATABASE_URLnow means ephemeral in-memory rather than silently writing to on-disk.minitor/pgdata).feat(hosting)— multi-stageDockerfile(standalone output),docker-compose.yml(app + Postgres, migrate-on-boot),docker-entrypoint.sh,railway.json,.dockerignore. Optional single-password gate viamiddleware.ts(HTTP Basic Auth, off whenMINITOR_PASSWORDunset) with a public/api/healthprobe. Hosted mode (lib/hosted.ts):setEnvKeysrefuses to run and the settings key editor is read-only, since keys come from the environment on a shared public instance.chore(deps)— add vitest (+test/test:watchscripts) and regeneratepackage-lock.jsonso nestedesbuild@0.28.1+ platform binaries are fully recorded (npm 11 tolerated the omission;npm ciin a clean container did not).Verification
tsc --noEmitclean · 271/271 vitest tests passdocker compose upruns migrations on boot and serves gatedhacker-newsfetch returned real items throughfetchUpstream+ cacheNotes
./minitor: the password gate and hosted mode are both off unless their env vars are set.