Remove default ntfy server setting

Setting this to "https://ntfy.sh" has security implications: If the user
forgets to set his server, but uses the new short form for topics, the
notification will be sent to "ntfy.sh" and could expose information.
This commit is contained in:
Thorben Günther 2024-11-21 12:21:12 +01:00
parent 109b0f52c0
commit add22b771a
No known key found for this signature in database
GPG key ID: 415CD778D8C5AFED
4 changed files with 6 additions and 3 deletions

View file

@ -65,7 +65,7 @@ resolved {
ntfy {
# URL of the ntfy server.
# Default: "https://ntfy.sh"
# Default: ""
server https://ntfy.sh
# Name of the ntfy topic. For backwards compatibility you can specify the full URL of the
# topic (e.g. https://ntfy.sh/alertmanager-alerts) and the server will be parsed from it.

View file

@ -430,8 +430,6 @@ func Read(path string) (*Config, error) {
config.LogFormat = "text"
config.AlertMode = Multi
config.Ntfy.Server = "https://ntfy.sh"
config.Cache.Type = "disabled"
config.Cache.Duration = time.Hour * 24
// memory

View file

@ -47,6 +47,7 @@ resolved {
}
ntfy {
server https://ntfy.sh
topic https://ntfy.sh/alertmanager-alerts
certificate-fingerprint 13:6D:2B:88:9C:57:36:D0:81:B4:B2:9C:79:09:27:62:92:CF:B8:6A:6B:D3:AD:46:35:CB:70:17:EB:99:6E:28:08:2A:B8:C6:79:4B:F6:2E:81:79:41:98:1D:53:C8:07:B3:5C:24:5F:B1:8E:B6:FB:66:B5:DD:B4:D0:5C:29:91
user user

View file

@ -637,6 +637,10 @@ func (br *bridge) topicURL(topic string) (string, error) {
return topic, nil
}
if br.cfg.Ntfy.Server == "" {
return "", errors.New("cannot set topic: no ntfy server set")
}
s, err := url.JoinPath(br.cfg.Ntfy.Server, topic)
if err != nil {
return "", err