codeant-ai-for-open-source[bot] commented on code in PR #43504:
URL: https://github.com/apache/superset/pull/43504#discussion_r3850332670
##########
superset/views/base.py:
##########
@@ -812,6 +813,14 @@ def get_spa_template_context(
# No custom URL either, use default SVG
spinner_svg = get_default_spinner_svg()
+ # Serve the spinner as an <img> data URI (see spa.html). SVG loaded via
<img>
+ # can't execute scripts, so rendering doesn't depend on
sanitize_svg_content.
+ spinner_svg_data_uri = None
+ if spinner_svg:
+ spinner_svg_data_uri = "data:image/svg+xml;base64," + base64.b64encode(
+ spinner_svg.encode("utf-8")
+ ).decode("ascii")
Review Comment:
**Suggestion:** The theme validation only verifies that `token` is a
dictionary, so a truthy non-string `brandSpinnerSvg` supplied through
configuration or an existing database record can reach this code. Calling
`encode` on such a value raises `AttributeError` during every SPA render and
returns a 500 instead of falling back to the URL or default spinner. Restrict
this path to string values or treat invalid values as absent. [type error]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ SPA and login rendering fail with malformed theme configuration.
- ⚠️ Default spinner fallback is bypassed by invalid truthy values.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=cd5a1af432b34c43a69822c6b429cf3f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=cd5a1af432b34c43a69822c6b429cf3f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/views/base.py
**Line:** 819:822
**Comment:**
*Type Error: The theme validation only verifies that `token` is a
dictionary, so a truthy non-string `brandSpinnerSvg` supplied through
configuration or an existing database record can reach this code. Calling
`encode` on such a value raises `AttributeError` during every SPA render and
returns a 500 instead of falling back to the URL or default spinner. Restrict
this path to string values or treat invalid values as absent.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43504&comment_hash=61a2cccdb8cf3643315d661a0fb25098c524526d6045d0fba912956d57502798&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43504&comment_hash=61a2cccdb8cf3643315d661a0fb25098c524526d6045d0fba912956d57502798&reaction=dislike'>👎</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]