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

[Feature] Add node deployment using processes (Multiplatform) #11

Merged
merged 48 commits into from
Sep 25, 2024

Conversation

enriquetomasmb
Copy link
Collaborator

No description provided.

@enriquetomasmb enriquetomasmb changed the title [Feature] Include deployment using processes (Multiplatform) [Feature] Add node deployment using processes (Multiplatform) Sep 25, 2024
Comment on lines 2002 to +2004
$('#confirm-modal-body').html('Are you sure you want to run the scenario?\n' +
'<br><br><p class="badge text-bg-danger">Warning: you will stop the running scenario and start a new one</p>');
'<br><p class="badge text-bg-warning">The scenario will be deployed using the selected deployment option: ' + deploymentOption.value + '</p>' +
'<br><p class="badge text-bg-danger">Warning: you will stop the running scenario and start a new one</p>');

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium

DOM text
is reinterpreted as HTML without escaping meta-characters.

Copilot Autofix AI 6 months ago

To fix the problem, we need to ensure that any user input or DOM text that is reinterpreted as HTML is properly sanitized or escaped to prevent XSS attacks. In this case, we should escape the deploymentOption.value before inserting it into the HTML content of the modal.

The best way to fix this is to use a function that escapes HTML special characters. This will ensure that any potentially malicious content is rendered as plain text rather than executable HTML or JavaScript.

Suggested changeset 1
nebula/frontend/templates/deployment.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/nebula/frontend/templates/deployment.html b/nebula/frontend/templates/deployment.html
--- a/nebula/frontend/templates/deployment.html
+++ b/nebula/frontend/templates/deployment.html
@@ -2001,4 +2001,12 @@
                 var deploymentOption = document.querySelector('input[name="deploymentRadioOptions"]:checked');
+                const escapeHtml = (unsafe) => {
+                    return unsafe
+                        .replace(/&/g, "&amp;")
+                        .replace(/</g, "&lt;")
+                        .replace(/>/g, "&gt;")
+                        .replace(/"/g, "&quot;")
+                        .replace(/'/g, "&#039;");
+                };
                 $('#confirm-modal-body').html('Are you sure you want to run the scenario?\n' +
-                    '<br><p class="badge text-bg-warning">The scenario will be deployed using the selected deployment option: ' + deploymentOption.value + '</p>' +
+                    '<br><p class="badge text-bg-warning">The scenario will be deployed using the selected deployment option: ' + escapeHtml(deploymentOption.value) + '</p>' +
                     '<br><p class="badge text-bg-danger">Warning: you will stop the running scenario and start a new one</p>');
EOF
@@ -2001,4 +2001,12 @@
var deploymentOption = document.querySelector('input[name="deploymentRadioOptions"]:checked');
const escapeHtml = (unsafe) => {
return unsafe
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
};
$('#confirm-modal-body').html('Are you sure you want to run the scenario?\n' +
'<br><p class="badge text-bg-warning">The scenario will be deployed using the selected deployment option: ' + deploymentOption.value + '</p>' +
'<br><p class="badge text-bg-warning">The scenario will be deployed using the selected deployment option: ' + escapeHtml(deploymentOption.value) + '</p>' +
'<br><p class="badge text-bg-danger">Warning: you will stop the running scenario and start a new one</p>');
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@@ -737,6 +926,10 @@
os.path.join(os.environ["NEBULA_ROOT"], "app", "tmp", scenario_name),
exist_ok=True,
)
os.chmod(
os.path.join(os.environ["NEBULA_ROOT"], "app", "tmp", scenario_name),

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
@enriquetomasmb enriquetomasmb merged commit 1264a49 into main Sep 25, 2024
2 of 3 checks passed
@enriquetomasmb enriquetomasmb deleted the feature/processes branch September 25, 2024 12:55
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