Merge commit from fork

* Sanitize error message output

Escape HTML characters in error message for security.

* Update CHANGELOG.md

---------

Co-authored-by: Niko <github@dieserniko.link>
This commit is contained in:
Yue (Knox) LiuandNiko authored and GitHub committed 2025-11-26 20:58:33 +01:00
1 parent a91d9feb51
commit 880b92d724
2 files changed
+3 -1

No files matched your search

+1
View File
@@ -18,6 +18,7 @@ Add your changes below.
- Fixed dead link in README.md - Fixed dead link in README.md
- Corrected Spotify/Spotipy typo in documentation - Corrected Spotify/Spotipy typo in documentation
- Sanitize HTML error message output for OAuth flow
### Removed ### Removed
+2 -1
View File
@@ -8,6 +8,7 @@ __all__ = [
] ]
import base64 import base64
import html
import logging import logging
import os import os
import time import time
@@ -1252,7 +1253,7 @@ class RequestHandler(BaseHTTPRequestHandler):
if self.server.auth_code: if self.server.auth_code:
status = "successful" status = "successful"
elif self.server.error: elif self.server.error:
status = f"failed ({self.server.error})" status = f"failed ({html.escape(str(self.server.error))})"
else: else:
self._write("<html><body><h1>Invalid request</h1></body></html>") self._write("<html><body><h1>Invalid request</h1></body></html>")
return return