Commit Graph

45 Commits (2f3f30116cd31504f8f5ea6dde0433ea2086c379)

Author SHA1 Message Date
Test User 3d05dfa81d fix(status): merge alert channel, probe-drift detection and least-privilege CI
Three independently developed changes, merged and re-verified rather than
taken on trust.

1) Alert channel (Pushover, worker/src/pushover.ts). The fork's only built-in
   channel reads its credentials from the committed config, which is unusable
   in a PUBLIC repo, so outages notified nobody. Sent as a second channel from
   inside formatAndNotify, so skipNotificationIds, maintenance windows and
   gracePeriod gate it exactly as they gated the webhook. Fail-closed AND loud:
   without the secrets every dropped alert logs [ALERT-CHANNEL-BROKEN].

2) Probe drift (worker/src/probe.ts). checkProxyFallback silently degrades a
   two-region page to a one-region page: the fallback keeps checkLocation at
   the local colo, up stays true, nothing is reported. doMonitor now returns
   fromConfiguredRegion and a finding is raised after 15 runs without an answer
   from the configured region.

3) Least privilege (.github/workflows/deploy.yml). The job carries
   CLOUDFLARE_API_TOKEN and runs terraform apply while its GITHUB_TOKEN scope
   was inherited from a repo setting. Pinned to contents: read, top-level.

MERGE RESOLUTION — the only real conflict was semantic, not textual: (2) could
only send its finding over notification.webhook, and (1) establishes that this
webhook stays unset for good because its credentials would have to be
committed. Combined unchanged, the drift finding would have reached nobody. The
finding is therefore sent over the same Pushover channel, but labelled as
neither UP nor DOWN and at normal priority — a moved vantage point is an
operations fact, not a user-visible outage, and must not bypass quiet hours.

No user-visible change to the public status page.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 02:53:33 +02:00
Test User b2b9472d51 Merge remote-tracking branch 'q102/feat/alert-channel-pushover' into feat/ops-hardening-q100-q101-q102 2026-07-31 02:45:23 +02:00
Claude f77adf8091 feat(status): wire the alert channel — outages now actually notify someone
`notification.webhook` was commented out, so no monitor — including the
newly added second check region — reported an outage anywhere. The status
page watched production while its own failure was visible to nobody unless
a human happened to look.

The fork ships exactly ONE notification path, `notification.webhook`
(worker/src/util.ts:83 `webhookNotify`), and it reads its credentials from
the COMMITTED config object. This repository is public, so a Pushover app
token cannot live there — which is why the block stayed commented out.

This adds a second dispatch inside the same `formatAndNotify`, sending the
identical formatted message to Pushover with credentials from Worker SECRET
bindings (worker/src/pushover.ts). Same account and endpoint the Mac mini
already alerts through, so no new account and no new vendor.

Gating is unchanged: skipNotificationIds, maintenance windows and the
3-minute grace period gate Pushover exactly as they gated the webhook.

FAIL-CLOSED, not silent: without the secrets every dropped alert logs
`[ALERT-CHANNEL-BROKEN] … missing Worker secret(s) …` as an error naming
what is missing and how to fix it, so an unnotifiable outage is itself
visible in Workers Logs.

Secrets are bound in deploy.tf, not via `wrangler secret put`: the
`bindings` list is authoritative and would drop anything not declared there
on the next apply. deploy.yml passes them as TF_VAR_*; when the repository
secrets are unset the apply still succeeds with the bindings omitted.

OWNER ACTION REQUIRED: set repository secrets PUSHOVER_TOKEN and
PUSHOVER_USER on k55f97/osg-status. Until then the channel is wired but
loud-broken by design.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 02:43:44 +02:00
Test User c080da7bc8 feat(status): detect when a check region silently stops answering
checkProxyFallback: true is correct — a probe outage must not be published
as a service outage. But it makes the probe outage itself invisible:
monitor.ts:399-410 falls back to a local re-check, checkLocation keeps the
local colo, and nothing anywhere says the configured region has stopped
answering. A Durable Object that never comes back degrades a two-region
page to a one-region page in total silence.

Adds the missing comparison: configured region vs. the region the run
actually came from, persisted as state.probeOkAt (a timestamp, not a run
counter — the state is only written on change or after the write cooldown).
After 15 consecutive runs from outside the configured region the worker logs
every run and notifies once; once more on recovery. Nothing new on the public
page: "our probe moved" is an operations fact, not user-relevant status.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 02:30:12 +02:00
lyc8503 a5f65a7943 feat(worker): check all targets in parellel, reduces ~15% cpu time usage in test, also try to a fix rare race condition 2026-01-19 00:52:32 +08:00
lyc8503 3de3640d17 feat: D1 upgrade: deployment and migration process DONE! 2026-01-03 23:06:32 +08:00
lyc8503 e050065a3c [WIP] workers works! (lol) pages+migration todo 2025-12-31 22:19:29 +08:00
lyc8503 45d86424b2 [WIP] terraform cloudflare provider v5 works! more performance/migration/deployment work todo 2025-12-30 23:19:18 +08:00
lyc8503 ee2d23f151 feat: add default UA 2025-11-06 01:02:29 +08:00
lyc8503 70ad2e8677 feat: make cooldown optional and remove it from simple config 2025-11-05 23:10:18 +08:00
lyc8503 e87e350d6d feat: skip error change notification option 2025-11-05 01:06:21 +08:00
lyc8503 e757e1b970 Global ping as check proxy support (#147)
* WIP: http

* improve error handling

* tcp monitoring looks good

* fix globalping bugs and improve logs

* add globalping param

* looks good, add real call to globalping, todo fallback

* stupid JS, forgot bind this

* feat: add globalping city

* run prettier

* fix no magic

* fix missing country in TCP

* update config template
2025-10-29 22:18:39 +08:00
Steven Crocker 4b24ad38a2
Add webhook support to notification property in config (#143)
* Add basic webhook option to workerConfig.notification as alternative to apprise

* Add uptime.config.ts example for webhook option

* Removed trailing commas from newly added types for consistency

* Add ability to customize webhook body

* use template

---------

Co-authored-by: lyc8503 <me@lyc8503.net>
2025-10-15 20:11:32 +08:00
lyc8503 65408d4962 fix: incident header margin, run prettier 2025-09-21 15:28:59 +08:00
keito 5769a52f0c
fix: improve types for callback-related config (#135)
* fix: allow partial callbacks in config types

* fix: allow non-async callback functions in config types

* fix: specify type of monitor argument in callback type

* fix: use generics type for env argument in callback type
2025-08-07 18:47:19 +08:00
lyc8503 8a097698be Merge branch 'main' of https://github.com/lyc8503/UptimeFlare 2025-05-13 16:13:45 +08:00
lyc8503 813ec1ab96 fix #109: kill DO to avoid extra usage 2025-05-13 16:13:35 +08:00
Bennet Gallein a6c8eb6e12
maintenance mode (#101)
* feat: move types

* feat: add maintenance alert

* feat: move to config/base class to have fallback values on missing exports

* fix: wrong import for types

* Revert "fix: wrong import for types"

This reverts commit ca2b2e3a68.

* Revert "feat: move to config/base class to have fallback values on missing exports"

This reverts commit 9932ea2590.

* fix: imports

* chore: formatting

* fix: handle filtering for global status

* fix: pass props

* fix: ignore active maintenances when sending notifications

* fix: mark as warning when monitor is in maintenance

* fix: title width & warning icon

* fix: remove accordeons again

* alert config/style changes, worker code improve

* update example config

* update example config

* set monitors to be optional

---------

Co-authored-by: lyc8503 <me@lyc8503.net>
2025-05-01 01:09:53 +08:00
lyc8503 4bcf4173ea misc: run prettier 2025-04-19 21:50:43 +08:00
lyc8503 f02aef8d00 DurableObject remote checker, binding TODO 2025-04-14 02:12:06 +08:00
lyc8503 6a7effe668 WIP: check proxy on pages 2025-04-12 22:20:33 +08:00
lyc8503 8b07dfe30e SHOULD WORK: worker support proxy 2025-04-11 01:29:46 +08:00
lyc8503 9bc5deb99d feat #88 notification blacklist 2025-04-07 00:50:16 +08:00
lyc8503 e448e95909
Remove 90-day history (not used) to avoid CPU limit exceed on free tier 2025-03-24 20:55:49 +08:00
lyc8503 dcc2dbb278 remove old incident, keep history only for 90d 2024-06-30 21:54:57 +08:00
lyc8503 0eb03ebfff use apprise for better notification & fix callback bug & improve log 2024-05-20 14:18:08 +08:00
lyc8503 8102258e3b add logging, use external link 2024-03-18 17:01:58 +08:00
Eric Wang 4963a4815a fix: duplicate account_id in actions, typo fix 2024-03-18 08:26:20 +08:00
Eric Wang 0c6556eda9 feat: add notify telegram & bark, and some minor fixes 2024-03-18 00:06:31 +08:00
lyc8503 868f943f93 fix bug in record interval 2024-01-30 14:24:28 +08:00
lyc8503 9bdeec90f2 better callbacks, fix config leak 2023-12-09 14:59:59 +08:00
lyc8503 759a0f6159 feat: geo-specific check 2023-12-08 15:19:38 +08:00
lyc8503 ccbb48b040 fix: downtime calculation 2023-11-19 15:05:03 +08:00
lyc8503 76402693c3 worker tcp ping workaround 2023-11-19 00:54:12 +08:00
lyc8503 9a390c31fe format & add version 2023-11-06 12:19:33 +08:00
lyc8503 87611700c3 format code and no semi 2023-11-06 00:51:41 +08:00
lyc8503 eba65bd654 format code 2023-11-06 00:38:30 +08:00
lyc8503 6157bc0879 add tcp timeout, fix worker stuck 2023-10-28 16:02:22 +08:00
lyc8503 4817fef547 header responsive update, fix worker tcp read 2023-10-28 01:38:21 +08:00
lyc8503 7e694fd9b7 add advanced checks 2023-10-23 15:29:27 +08:00
lyc8503 0ac0f2e99a fix a stupid bug, please blame on vsc 2023-10-20 02:25:24 +08:00
lyc8503 93c069c419 lastIncident logic improve & index error msg 2023-10-20 02:08:56 +08:00
lyc8503 1f4900b143 disable fetch cache 2023-10-17 01:11:28 +08:00
lyc8503 f9212c88a6 wip: frontend header & overall status 2023-10-15 02:00:29 +08:00
lyc8503 cdd43685f2 wip: worker & pages 2023-10-14 15:21:52 +08:00