Modernize: Slack signing-secret auth, fetch, containerization + GHCR/Coolify deploy - #17
Open
ddbruce wants to merge 1 commit into
Open
Modernize: Slack signing-secret auth, fetch, containerization + GHCR/Coolify deploy#17ddbruce wants to merge 1 commit into
ddbruce wants to merge 1 commit into
Conversation
Behavior-preserving modernization. Same /whoson command args, same responses. Security / correctness: - Replace the deprecated Slack verification-token check with signing-secret HMAC verification (X-Slack-Signature over the raw body + timestamp replay guard). Requires SLACK_SIGNING_SECRET (was SLACK_SIGNING_TOKEN). - Fix missing-return auth bug: unauthenticated requests now stop with 401. - Add try/catch + a hard fetch timeout around the upstream call; user gets a friendly message instead of a hung/500 request. Dependencies / runtime: - Drop cachios (pulled axios 0.19, CVEs) — it never actually cached here (no per-request ttl was ever passed) so native fetch is a drop-in. - Drop standalone body-parser for built-in express.json()/urlencoded(). - Express 4.17 -> 5.x, dotenv 8 -> 17. - Dockerfile: node:latest -> node:24-alpine, npm ci, non-root, HEALTHCHECK, add GET /health. Tooling / delivery: - ESLint 8 (EOL) -> ESLint 9 flat config; extract the weekday resolver into a pure, tested helper (resolveWhosonQuery); add Jest tests (10). - Replace dead Drone CI with GitHub Actions (lint + test + amd64 build). - Add scripts/deploy.sh + config.example.sh (build amd64, push GHCR, trigger Coolify redeploy); real secrets live in gitignored scripts/config.sh. Verified: 10 unit tests + 6 end-to-end checks (valid signatures pass, unsigned/tampered rejected, upstream wiring) pass; amd64 image builds clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
Behavior-preserving modernization of
whoson. Same/whosoncommand args (today/week/yesterday/tomorrow/weekdays), same responses. Verified with 10 unit tests + 6 end-to-end checks (valid Slack signatures pass; unsigned/tampered rejected; upstream fetch + token passthrough work); amd64 image builds with 0 npm vulnerabilities.The old code compared the deprecated Slack verification token (
SLACK_SIGNING_TOKEN). This PR switches to proper signing-secret HMAC verification, which needs a new env var:SLACK_SIGNING_TOKENSLACK_SIGNING_SECRET— from the Slack app → Basic Information → App Credentials → Signing SecretThe Slack app itself does not need re-creating. Also note
BASE_URLis now documented in.env.example(the code always required it; it was undocumented).Changes
returnbug that let unauthenticated requests fall through.cachios(it pulled axios 0.19 w/ CVEs and never actually cached — no per-requestttlwas ever passed) for nativefetchwith a 10s timeout + error handling. JSON vs text passthrough preserved to match the old axios behavior.body-parserfor built-ins, dotenv 8 → 17; Dockerfilenode:latest→ pinnednode:24-alpine,npm ci, non-root,HEALTHCHECK+GET /health.switchverbatim into a pureresolveWhosonQuery(text, now)helper so it's unit-testable; behavior identical.scripts/deploy.sh+config.example.sh(build amd64 → push GHCR → CoolifyPOST /api/v1/deploy?uuid=); secrets in gitignoredscripts/config.sh.Notes / non-changes
?token=— that's the upstream's contract, unchanged.