1
0
Fork 0
Commit graph

23 commits

Author SHA1 Message Date
Pablo Ovelleiro Corral
c669b87012
Merge pull request #7 from jaseemabid/jabid/url-parse
Validate ntfy.sh URL before use
2024-04-02 11:30:37 +02:00
Jaseem Abid
631eeb0816 Validate ntfy.sh URL before use
I had a couple of panics due to invalid URL, which could have been an
error message during startup.

Example:

    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]: 2024/04/01 17:33:49 Received valid hook from 127.0.0.1:43130
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]: 2024/04/01 17:33:49 Processing alert: {firing map[alertname:Target Down instance:devkit.local:80 job:esphome severity:high] map[description:The target is not reachable summary:Target is down] 2024->
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]: 2024/04/01 17:33:49 http: panic serving 127.0.0.1:43130: runtime error: invalid memory address or nil pointer dereference
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]: goroutine 1013 [running]:
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]: net/http.(*conn).serve.func1()
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]:         /usr/lib/go/src/net/http/server.go:1868 +0xb9
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]: panic({0x840200?, 0xd01360?})
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]:         /usr/lib/go/src/runtime/panic.go:920 +0x270
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]: main.WebhookHandler({0xa1d5f0, 0xc00038e000}, 0xc0001b0000)
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]:         /home/j/src/alertmanager-ntfy/main.go:45 +0xbf2
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]: net/http.HandlerFunc.ServeHTTP(0x10?, {0xa1d5f0?, 0xc00038e000?}, 0xc0004020ac?)
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]:         /usr/lib/go/src/net/http/server.go:2136 +0x29
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]: net/http.(*ServeMux).ServeHTTP(0x411f45?, {0xa1d5f0, 0xc00038e000}, 0xc0001b0000)
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]:         /usr/lib/go/src/net/http/server.go:2514 +0x142
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]: net/http.serverHandler.ServeHTTP({0xa1c0c0?}, {0xa1d5f0?, 0xc00038e000?}, 0x6?)
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]:         /usr/lib/go/src/net/http/server.go:2938 +0x8e
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]: net/http.(*conn).serve(0xc0000d21b0, {0xa1e1f0, 0xc00027a600})
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]:         /usr/lib/go/src/net/http/server.go:2009 +0x5f4
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]: created by net/http.(*Server).Serve in goroutine 1
    Apr 01 17:33:49 nyx.jabid.in alertmanager-ntfy[878013]:         /usr/lib/go/src/net/http/server.go:3086 +0x5cb
2024-04-01 19:21:37 +01:00
Pablo Ovelleiro Corral
fca24b84f2
Merge pull request #6 from danjl1100/allow-empty-user
allow empty username in case of access tokens in Basic Auth
2024-03-24 21:31:45 +01:00
Daniel Lambert
2ce561304a allow empty username in case of access tokens in Basic Auth 2024-03-23 21:15:31 -05:00
Pablo Ovelleiro Corral
9aa539bb4f
Merge branch 'main' of github.com:pinpox/alertmanager-ntfy 2024-02-28 11:02:11 +01:00
Pablo Ovelleiro Corral
aa99149afc
flake.lock: Update
Flake lock file updates:

• Updated input 'flake-compat':
    'github:edolstra/flake-compat/b4a34015c698c7793d592d66adbab377907a2be8' (2022-04-19)
  → 'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33' (2023-10-04)
• Updated input 'flake-utils':
    'github:numtide/flake-utils/6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817' (2022-10-29)
  → 'github:numtide/flake-utils/1ef2e671c3b0c19053962c07dbda38332dcebf26' (2024-01-15)
• Added input 'flake-utils/systems':
    'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e' (2023-04-09)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/d40fea9aeb8840fea0d377baa4b38e39b9582458' (2022-10-31)
  → 'github:nixos/nixpkgs/13aff9b34cc32e59d35c62ac9356e4a41198a538' (2024-02-26)
2024-02-28 11:02:07 +01:00
Pablo Ovelleiro Corral
1c5d171b97
Merge pull request #5 from merspieler/main
Fix things up
2024-02-05 08:53:34 +01:00
merspieler
37354956d2
Another case of deprecated use fixed 2024-02-05 00:02:04 +01:00
merspieler
0f0c2ed224
Fix readme 2024-02-05 00:00:03 +01:00
merspieler
b25d625177
Fix deprecation warning 2024-02-04 23:51:34 +01:00
merspieler
aaddfe7507
Make the config name actually how it is in the readme 2024-02-04 23:51:05 +01:00
Pablo Ovelleiro Corral
23fa2327be
Merge pull request #4 from merspieler/main 2024-01-26 07:01:12 +01:00
merspieler
d6ef79c244
Fix typo in readme 2024-01-26 02:31:33 +01:00
Pablo Ovelleiro Corral
48cf817171
Merge pull request #3 from pinpox/add-license-1
Create LICENCE
2023-03-01 22:14:35 +01:00
Pablo Ovelleiro Corral
3394f22171
Create LICENCE 2023-03-01 22:14:21 +01:00
Pablo Ovelleiro Corral
220226f468
Merge pull request #1 from jaseemabid/main
Enable basic auth only if username/password is set
2023-02-14 16:18:47 +01:00
Jaseem Abid
cc35ddbe0f Enable basic auth only if username/password is set
Empty password leads to an authorization error, which isn't ideal.

Also log the response in case its an error, I think this would be handy
in case the upstream starts misbehaving. By default won't add to log
noise.

Example:

```
curl -s -u ':' -d "test" ntfy.sh/test  | jq .
{
  "code": 40101,
  "http": 401,
  "error": "unauthorized",
  "link": "https://ntfy.sh/docs/publish/#authentication"
}
```
2023-02-10 19:35:21 +00:00
Pablo Ovelleiro Corral
c658a0fd33
Add more logging 2022-11-04 08:32:26 +01:00
Pablo Ovelleiro Corral
acd656c6ea
Skip resolved messsages 2022-11-04 07:45:37 +01:00
Pablo Ovelleiro Corral
911bf2fa92
Add priority 2022-11-03 11:14:36 +01:00
Pablo Ovelleiro Corral
1beeb0a7b6
Update flake 2022-11-02 16:50:31 +01:00
Pablo Ovelleiro Corral
492d64123c
Update README.md 2022-11-02 14:48:45 +01:00
Pablo Ovelleiro Corral
4c0c0bf056
initial commit 2022-11-02 14:46:55 +01:00