Conversation
| RunningScript.instance.script_binding[0]["__file__"] = procedure_name | ||
| exec(instrumented_script, RunningScript.instance.script_binding[0], RunningScript.instance.script_binding[1]) | ||
| exec( | ||
| instrumented_script, RunningScript.instance.script_binding[0], RunningScript.instance.script_binding[1] |
There was a problem hiding this comment.
Unsafe exec usage can lead to remote code execution - high severity
Using exec with expressions based on user input can execute arbitrary code.
Remediation: If you must use exec, create a allowlist for the input that goes into it to filter the strings.
View details in Aikido Security
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2563 +/- ##
==========================================
- Coverage 79.21% 79.18% -0.04%
==========================================
Files 662 662
Lines 51218 51271 +53
Branches 736 736
==========================================
+ Hits 40573 40599 +26
- Misses 10565 10592 +27
Partials 80 80
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| }) | ||
| }, | ||
| async scriptComplete() { | ||
| this.fatal = false |
There was a problem hiding this comment.
We're no longer marking fatal lines ... the output shows which line is fatal and the script simply stops with the status set to 'Crashed'
| if (this.state === 'completed_errors') { | ||
| // Displaying 'Completed_errors' is not very user friendly | ||
| this.state = 'completed' | ||
| } |
There was a problem hiding this comment.
Rather than always setting to 'Stopped', we preserve the state unless 'completed_errors' which I just translate. The error will be in the script output.
There was a problem hiding this comment.
Couldn't this cause users to just see "completed" at the top and exit out without noticing the errors? I feel like there should be some sort of indication of errors where we display state. Maybe an alert icon, or shade it orange/yellow?
There was a problem hiding this comment.
Execution Status remains with completed_errors, which is good. I do tend to agree that the UI should make it clear that the script did encounter errors.
There was a problem hiding this comment.
The script still completed but it potentially had errors like Check Errors or even logical errors (divide by zero). The user clicked Retry or Go and the script completed. So I'm not sure what you mean by exit out. The status is in the script execution status. Perhaps we do textcolor changes of the status where completed_errors would display Completed but it would be orange. Crashed / Killed is red and all others green. Thoughts?
There was a problem hiding this comment.
Can we make completed_errors state display in the UI as Completed with Errors? I feel like that's the most user-friendly.
There was a problem hiding this comment.
That makes the State box much wider to be readable
There was a problem hiding this comment.
Could we add an alert icon or shade the box a color? Maybe also a tooltip, but that might not be necessary.
By "exit out," I mean leave the page (close the browser tab or navigate away)
| case 'completed_errors': | ||
| case 'stopped': | ||
| case 'crashed': | ||
| case 'killed': |
There was a problem hiding this comment.
These are all the possible 'completed' states. The script is done in the backend.
| end | ||
| end | ||
|
|
||
| require 'openc3/utilities/logger' |
There was a problem hiding this comment.
Moving this fixes the circular dependency in Enterprise tests where OpenC3.disable_warnings is not defined.
| from openc3.tools.test_runner.test import SkipTestCase | ||
| from openc3.script.suite import Group | ||
| from openc3.utilities.script_instrumentor import ScriptInstrumentor | ||
| import openc3.utilities.target_file_importer |
| # All ask and prompt dialogs should include a 'Cancel' button | ||
| # If they cancel we wait so they can potentially stop | ||
| if input == "Cancel": | ||
| if user_input == "Cancel": |
There was a problem hiding this comment.
input shadows a built-in so renamed
| kill_thread(self, RunningScript.output_thread) | ||
| RunningScript.output_thread = None | ||
| self.mark_completed() | ||
| self.current_filename = None |
There was a problem hiding this comment.
This is actually a bug because we're setting the current_filename method to None which basically removes it. I think any call to RunningScript.instance.current_filename() would crash after this. Maybe didn't matter because this is in Exception handling and we're already complete.
| formatted_lines = traceback.format_exception(exc_type, exc_value, exc_traceback) | ||
| # Print the last 4 lines to show the exception, the ^^^^ line, | ||
| # the line itself, and the filename / line number | ||
| Logger.error("".join(formatted_lines[-4:])) |
There was a problem hiding this comment.
Changed to show the actual line number of the exception. I noticed that previous we just print only the exception which doesn't show where it is. Makes it a lot harder to debug.
|
Not sure if the reformatted was due to |

closes #2534
This would replace #2552 which had good ideas but I wanted to disallow retry for a crashed script ... it doesn't make sense to retry because unless you modify the script it will continue to crash. Also I wanted to explicitly handle all the script states in the case statement (spawning and init were not handled).