github-advanced-security[bot] commented on code in PR #36933:
URL: https://github.com/apache/superset/pull/36933#discussion_r2892620116
##########
embed-demo.html:
##########
@@ -0,0 +1,122 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Superset Embedded Chart Demo</title>
+ <style>
+ body {
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
sans-serif;
+ max-width: 1200px;
+ margin: 0 auto;
+ padding: 40px;
+ background: #f5f5f5;
+ }
+ h1 { color: #333; }
+ .input-section {
+ background: white;
+ border-radius: 8px;
+ padding: 20px;
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
+ margin-bottom: 20px;
+ }
+ input[type="text"] {
+ width: 100%;
+ padding: 10px;
+ font-family: monospace;
+ font-size: 13px;
+ border: 1px solid #ddd;
+ border-radius: 4px;
+ box-sizing: border-box;
+ margin-bottom: 12px;
+ }
+ button {
+ background: #20a7c9;
+ color: white;
+ border: none;
+ padding: 12px 24px;
+ font-size: 16px;
+ border-radius: 4px;
+ cursor: pointer;
+ margin-top: 10px;
+ }
+ button:hover {
+ background: #1a8fa8;
+ }
+ .chart-container {
+ background: white;
+ border-radius: 8px;
+ padding: 20px;
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
+ min-height: 450px;
+ }
+ label {
+ font-weight: 600;
+ display: block;
+ margin-bottom: 8px;
+ }
+ </style>
+</head>
+<body>
+ <h1>Superset Embedded Chart Demo</h1>
+
+ <div class="input-section">
+ <label for="iframe-url-input">iframe_url (from get_embeddable_chart
response):</label>
+ <input type="text" id="iframe-url-input"
placeholder="http://localhost:8088/embedded/chart/?permalink_key=..." />
+
+ <label for="guest-token-input">guest_token (from get_embeddable_chart
response):</label>
+ <input type="text" id="guest-token-input" placeholder="eyJ..." />
+
+ <button onclick="embedChart()">Embed Chart</button>
+ </div>
+
+ <div class="chart-container" id="chart-container">
+ <p style="color: #999; text-align: center; margin-top: 200px;">Chart will
appear here</p>
+ </div>
+
+ <script>
+ function embedChart() {
+ var iframeUrl = document.getElementById('iframe-url-input').value.trim();
+ var guestToken =
document.getElementById('guest-token-input').value.trim().replace(/\s/g, '');
+ var container = document.getElementById('chart-container');
+
+ if (!iframeUrl || !guestToken) {
+ container.textContent = 'Error: Both iframe_url and guest_token are
required.';
+ return;
+ }
+
+ // Validate URL scheme to prevent javascript: or data: URIs
+ if (!iframeUrl.startsWith('http://') &&
!iframeUrl.startsWith('https://')) {
+ container.textContent = 'Error: iframe_url must use http:// or
https://';
+ return;
+ }
+
+ var targetOrigin;
+ try {
+ targetOrigin = new URL(iframeUrl).origin;
+ } catch (e) {
+ container.textContent = 'Error: Invalid iframe_url';
+ return;
+ }
+
+ // Build iframe programmatically (no HTML parsing)
+ var iframe = document.createElement('iframe');
+ iframe.setAttribute('src', iframeUrl);
Review Comment:
## DOM text reinterpreted as HTML
[DOM text](1) is reinterpreted as HTML without escaping meta-characters.
[Show more
details](https://github.com/apache/superset/security/code-scanning/2250)
--
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]