codeant-ai-for-open-source[bot] commented on code in PR #38777:
URL: https://github.com/apache/superset/pull/38777#discussion_r2968268980


##########
docs/admin_docs/configuration/sql-templating.mdx:
##########
@@ -18,10 +18,19 @@ To enable templating, the `ENABLE_TEMPLATE_PROCESSING` 
[feature flag](/admin-doc
 
 :::warning[Security Warning]
 
-While powerful, this feature executes template code on the server. Within the 
Superset security model, this is **intended functionality**, as users with 
permissions to edit charts and virtual datasets are considered **trusted 
users**.
+This feature executes Jinja template code **on the server** at query time. 
Within the Superset security model, this is **intended functionality** — users 
who can edit charts or virtual datasets are explicitly treated as **trusted 
users**.
 
-If you grant these permissions to untrusted users, this feature can be 
exploited as a **Server-Side Template Injection (SSTI)** vulnerability. Do not 
enable `ENABLE_TEMPLATE_PROCESSING` unless you fully understand and accept the 
associated security risks.
+**Do not enable `ENABLE_TEMPLATE_PROCESSING` unless all users with 
chart/dataset write access are fully trusted.** Specifically:
 
+- Any user with `can_write` permission on Datasets or Charts can embed 
arbitrary Jinja expressions in SQL templates.
+- A malicious or compromised user can use this to perform **Server-Side 
Template Injection (SSTI)**, which can lead to **remote code execution (RCE)** 
on the Superset server — not just data exposure.
+- The `url_param()` macro injects URL query-string values directly into SQL 
**without output escaping**. Any user who can construct or share a URL 
(including links to embedded dashboards) can influence the rendered SQL. Always 
validate or escape `url_param()` values in your templates when building SQL 
clauses.
+- The Jinja sandbox is **not enabled** by default. Standard Python object 
traversal (`''.__class__.__mro__[...].__subclasses__()`) is available to 
template authors.
+
+If you need dynamic query parameters for untrusted users, prefer 
**parameterized queries** or restrict `url_param()` values to an explicit 
allowlist within the template.
+
+:::tip
+`ENABLE_TEMPLATE_PROCESSING` defaults to `False`. Only enable it if your 
deployment requires Jinja templates and all users with dataset/chart edit 
access are administrators or fully trusted internal users.

Review Comment:
   **Suggestion:** The newly added nested admonition starts a `:::tip` block 
inside an existing `:::warning` block, but there is only one closing fence in 
this section. This creates an unmatched admonition fence and can cause 
incorrect docs rendering/build parsing. Replace the nested admonition with 
plain text (or avoid nesting) so the existing closing fence continues to close 
the warning block correctly. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ SQL templating page may render with broken admonitions.
   - ⚠️ `yarn build` docs pipeline may fail MDX parsing.
   ```
   </details>
   
   ```suggestion
   **Tip:** `ENABLE_TEMPLATE_PROCESSING` defaults to `False`. Only enable it if 
your deployment requires Jinja templates and all users with dataset/chart edit 
access are administrators or fully trusted internal users.
   ```
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Open `docs/admin_docs/configuration/sql-templating.mdx` and inspect lines 
`19-34`:
   `:::warning[Security Warning]` opens at line 19, then `:::tip` opens at line 
32, with only
   one closing fence `:::` at line 34.
   
   2. Build docs using the documented command `yarn build` 
(`docs/DOCS_CLAUDE.md:45`), which
   runs Docusaurus MDX parsing for this page.
   
   3. During parse of `sql-templating.mdx`, admonition fences are unbalanced in 
this section
   (two opens, one close), so the warning/tip container structure is malformed.
   
   4. Observe broken rendering or MDX build/parsing failure for the SQL 
templating page
   (`/docs/configuration/sql-templating`, referenced by redirect in
   `docs/static/.htaccess:36`).
   ```
   </details>
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** docs/admin_docs/configuration/sql-templating.mdx
   **Line:** 32:33
   **Comment:**
        *Logic Error: The newly added nested admonition starts a `:::tip` block 
inside an existing `:::warning` block, but there is only one closing fence in 
this section. This creates an unmatched admonition fence and can cause 
incorrect docs rendering/build parsing. Replace the nested admonition with 
plain text (or avoid nesting) so the existing closing fence continues to close 
the warning block correctly.
   
   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.
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38777&comment_hash=16c561f0b11b8d4cd6eb94e16484992741dc4df9ba17388958db9e1958a96930&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38777&comment_hash=16c561f0b11b8d4cd6eb94e16484992741dc4df9ba17388958db9e1958a96930&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]

Reply via email to