~xenrox/ntfy-alertmanager#25: 
Silencing in ntfy web app does not work after commit 9dfd436e

I did a bisect testing the silence button in the ntfy web app.

I landed on the following commit:

commit 9dfd436: fix(authMiddleware): send 401 if no basicAuth is given

Without this commit: 0. Click "Silence" button

  1. OPTIONS CORS request gets a 200 on the endpoint, without the Authorization header
  2. Silence request proceeds and succeeds, with the Authorization header.

If ntfy-alertmanager was built with this commit: 0. Click "Silence" button

  1. OPTIONS CORS request gets a 401 on the endpoint, without the Authorization header (I have no idea why browser isn't sending that header, it's been told that it's allowed but maybe it just doesn't default or something??)
  2. Silence request gets stopped, and the silence action fails.

CORS related console logs, after commit:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading 
the remote resource at 
https://ntfy-alertmanager.jacksonchen666.com/silences. (Reason: CORS 
preflight response did not succeed). Status code: 401.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading 
the remote resource at 
https://ntfy-alertmanager.jacksonchen666.com/silences. (Reason: CORS 
request did not succeed). Status code: (null).

OPTIONS request, server headers list, before & after commit:

access-control-allow-headers
	Content-Type, Authorization
access-control-allow-methods
	POST, OPTIONS
access-control-allow-origin
	*

The browser (LibreWolf 144.0-1, Firefox soft-fork) does not include the Authorization header on the CORS preflight/OPTIONS request. I do not know why.

Git bisect logs
git bisect start
# status: waiting for both good and bad commits
# good: [2dcfb7270e712a0a86975faabd2d66d8cb06a086] Add CORS middleware
git bisect good 2dcfb7270e712a0a86975faabd2d66d8cb06a086
# status: waiting for bad commit, 1 good commit known
# bad: [b17db85e1da14a68550a54546463899f31381064] docker: Add healthcheck
git bisect bad b17db85e1da14a68550a54546463899f31381064
# good: [f4483532f52ed264cf1b1ea9e6ce194190c8ea91] Add support for 
displaying the alert's GeneratorURL
git bisect good f4483532f52ed264cf1b1ea9e6ce194190c8ea91
# good: [3217cb9b7dae05a02d5b44b18c81af973765ba6f] Upgrade dependencies
git bisect good 3217cb9b7dae05a02d5b44b18c81af973765ba6f
# good: [34b7f249be6f3295ff5a73f1007eadfa9357eea2] justfile: Multiple 
changes for helm handling
git bisect good 34b7f249be6f3295ff5a73f1007eadfa9357eea2
# bad: [758575aa6685d3055b1d6d00add3131bc1e60dab] fix(helm): add option 
to override global image part and add docs
git bisect bad 758575aa6685d3055b1d6d00add3131bc1e60dab
# bad: [9dfd436e29d2af4493e539604719d883b86cdbe1] fix(authMiddleware): 
send 401 if no basicAuth is given
git bisect bad 9dfd436e29d2af4493e539604719d883b86cdbe1
Status
RESOLVED FIXED
Submitter
Jackson
Assigned to
No-one
Submitted
9 months ago
Updated
9 months ago
Labels
bug

~xenrox 9 months ago

Ahh thanks for the detailed bug report. I think I know what the problem is. Should have time to push a fix today or tomorrow.

~xenrox 9 months ago

Thorben Günther referenced this ticket in commit ed3145c.

~xenrox 9 months ago

Hey,

can you test if it works for you now? For me the problem is fixed.

Jackson 9 months ago · edit

Yep, works for me now.

~xenrox REPORTED FIXED 9 months ago

Register here or Log in to comment, or comment via email.