Skip to content

Audit fixes: cross-timezone prompting, mrkdwn escaping, creator gating, scheduler hardening - #1

Merged
briancorbin merged 1 commit into
mainfrom
audit-fixes
Nov 20, 2026
Merged

briancorbin merged 1 commit into
mainfrom
audit-fixes

Conversation

@briancorbin

Copy link
Copy Markdown
Owner

Closes the code items from the 2026-11-19 audit (four lenses: claims vs code, fresh install, Slack security, scheduling). Companion site PR: best-coast/sunup.sh#1.

Closed

1. BLOCKING — cross-timezone participants never / wrongly prompted. computeDuePrompts is now judged purely by each participant's own clock (local weekday is scheduled, local time past promptTime, not yet handled for that local day — new participants.last_prompt_date). The target run is their local date, advanced past any channel run whose digest already posted but never past the channel's own current date (so a same-day late check-in stays a late check-in). Bare /sunup resolves the run the same way (resolveCheckinRunDate), with off-days falling back to the channel's run. Migration 0006.
Tests: full-week 10-minute-tick simulations for Tokyo channel + LA member, LA channel + Tokyo member, same-tz baseline, and London channel + LA member across both the US spring-forward (03-08) and the US/UK fall-backs (10-25, 11-01). Every prompt lands at local 09:00–09:09, once per weekday, before its run's digest.

2. MEDIUM — mrkdwn injection. escapeMrkdwn (& < >) on every user-supplied string (answers, blocker text, kudos, names, questions) at every mrkdwn/message-text call site; plain_text left alone. Tested per builder.

3. MEDIUM — no authorization. standups.created_by stored at setup; remove, config (modal and quick edits), and questions gated on creator or Slack admin/owner (users.info). Legacy rows with NULL creator stay open to anyone (documented). Removals and reconfigurations are logged with the actor. README section "Who can manage a check-in".

4. Scheduler should-fixes. Reminder loop skips snoozed users. Transient DM failures (429 / 5xx / network / non-JSON body) are not marked prompted and retry next tick; only definite Slack errors give up. Digest is claimed atomically (UPDATE … WHERE digest_posted_at IS NULL), released if the post fails, and responses are re-read after posting to fold in a racing submission. Reminder must be 0 or ≥ 10 minutes (config and modal). Participant tz refreshes on every check-in submission (setParticipantTz is live). computeStreak ignores unanswered future-dated runs.

5. RETENTION_DAYS also purges resolved blockers in both adapters (open ones kept). Kudos leaderboard in reports and the weekly retro is per channel; App Home stays workspace-wide.

6. wrangler.jsonc ships REPLACE-WITH-YOUR-D1-DATABASE-ID (dry-run bundle still passes). README: Node 22+ / 24+, db:migrate interactive confirm, audit-advisories-are-dev-only note, users:read for timezones and display names, adapter size, "no database server to run", retro "up to eight", export "most recent 10,000". .gitignore: *.db*.

7. MAC compare via crypto.subtle.verify (plus strict hex decoding). LINK_SECRET optional; fallback key is HMAC(signing secret, "sunup:link-secret:v1") so the Slack secret is never used directly. hono → 4.13.19 and @hono/node-server → 1.19.19 within existing ranges.

Deliberately skipped

  • @hono/node-server advisory GHSA-rmxm-3fg6-px4f (serveStatic double-decode) only clears at 2.x; sunup never uses serveStatic, so the major bump wasn't worth it here.
  • Reminders stay anchored to the channel's digest time, so a member 16h ahead can get the nudge at an odd local hour. Fixing that needs a per-participant reminder model; out of scope.
  • Report-link render caching (replay burns users.info), CSV bare-CR edge case, and the snooze 1 nits from the audit.
  • Members who join after promptTime are still prompted that same day (pre-existing behaviour, now consistent across timezones).

Verification

npm run typecheck clean across all workspaces; npm test 73 passing (core 63 incl. 16 new scheduler tests, node storage 10 incl. 5 new); wrangler deploy --dry-run bundles with the placeholder id.

🤖 Generated with Claude Code

…g, scheduler hardening

Prompting is now keyed on each participant's OWN local date and weekday
(new participants.last_prompt_date, one prompt per person per local day),
mapped onto the first channel run whose digest hasn't posted. A Tokyo
member of an LA channel gets Monday's prompt on Tokyo's Monday morning;
an LA member of a Tokyo channel gets prompted at LA 09:00 for the next
undigested run instead of never. Bare /sunup resolves the same way.

Every user-supplied string is escaped before it reaches Slack mrkdwn.
remove / config / questions are gated on the creator (new
standups.created_by) or a Slack admin; removals are logged.

Scheduler: reminders skip snoozed users; transient DM failures (429/5xx)
retry next tick instead of being marked prompted; the digest is claimed
atomically and re-read after posting; reminder floor of 10 minutes;
participant tz refreshes on every check-in.

Retention purges resolved blockers; kudos leaderboards in reports and the
retro are per channel; links are signed with LINK_SECRET or a key derived
from the signing secret and verified with crypto.subtle.verify; wrangler
ships a placeholder database_id; README and .gitignore updated; hono bumped.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@briancorbin
briancorbin merged commit f9f24e9 into main Nov 20, 2026
1 check passed
@briancorbin
briancorbin deleted the audit-fixes branch November 20, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant