fix: Tag RSS feed ignores security token when password protection is enabled#4235
Merged
Merged
Conversation
When password protection is enabled on changedetection.io, accessing the tag-specific RSS feed (`/rss/tag/[tag_name]?token=...`) failed and returned a 302 redirect to the `/login` page. The bug was located in `changedetectionio/flask_app.py` in the `check_authentication()` before-request handler, which incorrectly checked `request.endpoint and 'rss.feed' in request.endpoint`. This logic worked for the main feed (`rss.feed`) but failed for other endpoints like the tag feed (`rss.rss_tag_feed`). This commit updates the auth bypass to check if `request.blueprint == 'rss'` instead, allowing all RSS endpoints to handle token validation themselves via `validate_rss_token()`. A reproduction test `test_rss_tag_feed_ignores_security_token` has been added to verify the fix.
Owner
|
Amazing! thanks so much! |
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.
Fixes #4234
Description:
When password protection is enabled on changedetection.io, accessing the tag-specific RSS feed (
/rss/tag/[tag_name]?token=...) failed and returned a 302 redirect to the/loginpage. The issue occurred because thecheck_authentication()handler inflask_app.pyexplicitly checked for'rss.feed'in the endpoint, inadvertently excluding the tag RSS endpoint (rss.rss_tag_feed).Fix:
This PR updates the auth bypass check to
request.blueprint == 'rss', ensuring all RSS endpoints can correctly bypass global authentication and handle URL-based token validation internally.Testing:
test_rss_tag_feed_ignores_security_tokenintests/test_rss_tag_token.pyto ensure this functionality stays intact.