feat: add authentication support to ntfy notifications - #3839
Merged
ajhollid merged 1 commit intoAug 18, 2026
Conversation
ntfy servers that require auth rejected every Checkmate alert because the
provider posted without an Authorization header, so alerts to protected
topics failed silently.
Adds ntfyAuthType ("none" | "token" | "basic"):
- token: Authorization: Bearer <accessToken>
- basic: Authorization: Basic base64(ntfyUsername:accessToken)
Both types store their secret in the existing accessToken field rather than
introducing a new secret, so credential handling stays in one place.
Incomplete credentials fail the send instead of falling back to an anonymous
post, and validation rejects partial auth config up front so a channel can't
be saved looking authenticated while posting anonymously.
Backend only; frontend follows once this lands.
Closes bluewave-labs#3717
egeoztass
requested review from
Br0wnHammer,
ajhollid and
karenvicent
as code owners
August 14, 2026 23:01
ajhollid
approved these changes
Aug 18, 2026
ajhollid
left a comment
Collaborator
There was a problem hiding this comment.
Solid implementation, thanks for your hard work!
RE the token field reuse, I think that's acceptable here, I don't see any need for a new field to be added.
Thanks again for your contribution!
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.
Closes #3717
One open question before you read the diff
@ajhollid — I asked this on #3717 but it's probably easier to answer here.
Where should the basic-auth password live? This PR reuses the existing
accessTokenfield as the single credential (bearer token whenntfyAuthTypeistoken, password when it'sbasic), rather than adding a dedicatedntfyPassword. The upside is that no new secret field enters the codebase, so it inherits whatever credential handling already exists and stays compatible with #3803. The downside is thataccessTokenholding a basic-auth password reads a little oddly.If you'd rather have an explicit
ntfyPassword, say so and I'll switch it — it's a rename across five files and the tests already cover the behaviour, so it's cheap to change. I went ahead and built it rather than leave the issue sitting, since several people on the thread are blocked on this.Problem
NtfyProviderposts to{address}/{topic}with onlyTitle,PriorityandTagsheaders — noAuthorizationat all. Any ntfy server that requires auth rejects every alert, and the provider catches the error and returnsfalse, so the channel silently never delivers. From the issue thread: "Ntfy alerts are simply not working at the moment."Change
Adds
ntfyAuthType—"none" | "token" | "basic"— mirroring thewebhookAuthTypediscriminator shape from #3785:token→Authorization: Bearer <accessToken>basic→Authorization: Basic base64(ntfyUsername:accessToken)none(or unset) → no header, exactly as todayntfyUsernameis the only new field and it isn't a secret.Two deliberate decisions:
Incomplete credentials fail the send rather than falling back to an anonymous post. If a channel is configured for auth but the credential is missing, posting anyway would publish to a topic the operator believes is protected. It logs and returns
falseinstead.Validation rejects partial auth config up front —
basicwithout a username,tokenwithout a token, and credentials supplied while auth is off. This is aimed at the concern you raised on #3785 ("I can create invalid authentication schemas without them being rejected"). Issues are reported per-field so the client can map them.Backend only, per your note on the issue that a backend implementation must come first and be fully tested. Frontend follows once this lands.
Conventions
NtfyAuthTypesis a const tuple innotification.type.ts, reused for both the Zod enum and the Mongoose schemaenum, per rules 8 and 10 indocs/coding-conventions.md.refineStrategyTypepattern frommonitorValidation.ts.Tests
23 cases in
ntfyProvider.test.ts(up from 12) and 19 innotificationValidation.test.ts(up from 5), covering both auth types, header composition, every incomplete-credential combination, and the "no auth type" default.npm test— 79 suites, 1361 tests passing.tsc --noEmit,eslint,prettier --checkall clean, OpenAPI spec regenerated.