Repository navigation
uptime: partner API for fleet monitors (w3bs.org, threatcrush.com) - #404
Merged
Merged
Conversation
/api/uptime/v1/{settings,keys,monitors[/:id[/incidents]]} for first-party
apps: Bearer cpu_ partner token (uptime_partners, sha256 stored, minted by
scripts/mint-uptime-partner.ts) + X-Fleet-User-Email mapped to the crawlproof
user with that confirmed email. Everything is scoped to the user's one Fleet
project (projects.kind = 'fleet', made on first use), so the partners and the
dashboard show the same checks.
SSH checks can name a key in the user's logicsrc keyring by fingerprint; the
worker resolves it from the share link each check (10 min cache, HTTPS
app.logicsrc.com only, 5s, 64 KB), goes DOWN with "key <fp> removed from
keyring" once it is gone, and falls back to the snapshot if the keyring is
unreachable. Monitor validation moved to lib/uptime-monitor-input.ts and is
shared by the dashboard's createMonitor and the API.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ThreatCrush Security Scan47 finding(s) HIGH/CRITICAL: 2 | MEDIUM: 29 | LOW: 16
Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
Piece 2 of the fleetbar feature: first-party apps manage a crawlproof user's monitors server to server.
Endpoints (
/api/uptime/v1, JSON, errors{ error, message })GET|PUT /settings{ keys_url, alert_email, alert_phone }(keys_url must behttps://app.logicsrc.com/k/lks_….json)GET /keys(keyring fetched server-side, 10 min cache)GET|POST /monitors,GET|PATCH|DELETE /monitors/:id,GET /monitors/:id/incidentsAuth:
Authorization: Bearer cpu_…(tableuptime_partners, sha256 stored,scripts/mint-uptime-partner.ts <name>) +X-Fleet-User-Email, mapped to the crawlproof user with that confirmed email (uptime_user_id_by_email, service_role only). Unknown email: 404no_crawlproof_account+signup_url.Scope: the user's one Fleet project (
projects.kind = 'fleet', unique per owner, made on first use). Monitors are always filtered by that project id; another user's monitor id is a 404.Keyring SSH checks:
ssh: { username, fingerprint }resolves the key from the user's logicsrc share link and stores{ username, fingerprint, keys_url, key_comment, public_key (snapshot) }. The worker resolves by fingerprint each check (HTTPS app.logicsrc.com only, no redirects, 5s, 64 KB, 10 min cache): removed key = DOWNkey <fp> removed from keyring; unreachable keyring = snapshot.Validation: moved out of
createMonitorintolib/uptime-monitor-input.ts, used by both the dashboard action and the API (private keys still refused).Migration
20261029160000_uptime_partner_api.sql(additive) is already applied to prod.Tests:
tests/uptime-partner-api.test.ts(auth: bad/revoked token, unknown email; scoping; keyring resolution; removed-key DOWN; 64 KB cap; cache). Full suite + typecheck green locally.🤖 Generated with Claude Code