Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV-46515 Add missing plugins #43

Merged

Conversation

copyhold
Copy link

@copyhold copyhold commented Oct 7, 2024

grafana-piechart-panel - is a part of grafana now, need to migrate:
update grafana_x.dashboard set data = replace(data, 'grafana-piechart-panel', 'piechart') where data like '%grafana-piechart-panel%';

agenty-flowcharting-panel - recompiled

youtube-video-panel - added new plugin that should provide the same function. need to migrate the existing ones

update grafana_x.dashboard set data = replace(data, 'youtube-video-panel', 'innius-video-panel') where data like '%youtube-video-panel%';

string += `${metric.label} : `;
string += `<span style="color:${metric.color}"><b>${metric.value}</b></span>`;
}
div.innerHTML = string;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cycode: SAST violation: 'Unsanitized user input in dynamic HTML insertion (XSS)'.

Severity: High

Description

Unsanitized user input in dynamic HTML insertion can lead to Cross-Site Scripting (XSS) attacks. This vulnerability arises when user-provided data is directly inserted into the DOM without proper sanitization, potentially allowing attackers to execute malicious scripts.

Cycode Remediation Guideline

✅ Do


  • Do use an HTML sanitization library to clean user input before inserting it into the HTML. This step helps prevent XSS attacks by removing or neutralizing any potentially harmful scripts.
import sanitizeHtml from 'sanitize-html';

const html = `<strong>${user.Input}</strong>`;
document.body.innerHTML = sanitizeHtml(html);

📋 References


Tell us what to do with one of the following hashtags:

Tag Short Description
#cycode_sast_ignore_here Ignore this violation — applies to this violation only
#cycode_sast_false_positive Mark as false positive — applies to this violation only

plugin.popover = function (text, tagBook, tagImage) {
const url = this.repository;
const images = `${this.repository}images/`;
const textEncoded = String(text).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cycode: SAST violation: 'Usage of manual HTML sanitization (XSS)'.

Severity: High

Description

Manually sanitizing HTML is prone to mistakes and can lead to Cross-Site Scripting (XSS) vulnerabilities. This occurs when user input is not properly sanitized, allowing attackers to inject malicious scripts into web pages viewed by other users.

Cycode Remediation Guideline

✅ Do


  • Do use a trusted HTML sanitization library to handle user input safely. Libraries designed for sanitization are more reliable as they cover a wide range of XSS attack vectors.
import sanitizeHtml from 'sanitize-html';

const html = sanitizeHtml(`<strong>${user.Input}</strong>`);

❌ Don't


  • Do not manually escape HTML to sanitize user input. This method is unreliable and can easily miss certain exploits.
const sanitizedUserInput = user.Input
  .replaceAll('<', '&lt;')
  .replaceAll('>', '&gt;'); // unsafe
const html = `<strong>${sanitizedUserInput}</strong>`;

📋 References


Tell us what to do with one of the following hashtags:

Tag Short Description
#cycode_sast_ignore_here Ignore this violation — applies to this violation only
#cycode_sast_false_positive Mark as false positive — applies to this violation only

@copyhold copyhold merged commit 89a46a1 into v10.4.x-logzio Oct 7, 2024
13 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants