-
Notifications
You must be signed in to change notification settings - Fork 788
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
Unsafe options confirmation #1000
Conversation
DeepCode failed to analyze this pull requestSomething went wrong despite trying multiple times, sorry about that. |
I'm considering showing this dialog when the user attempts to run the monkey instead of when config options are selected. I think the code will be cleaner and it will be a more effective safeguard for the user. |
Codecov Report
@@ Coverage Diff @@
## develop #1000 +/- ##
========================================
Coverage 26.11% 26.11%
========================================
Files 402 402
Lines 12821 12821
========================================
Hits 3348 3348
Misses 9473 9473 Continue to review full report at Codecov.
|
monkey/monkey_island/cc/ui/src/components/ui-components/AdvancedMultiSelect.js
Show resolved
Hide resolved
...onkey_island/cc/ui/src/components/configuration-components/UnsafeOptionsConfirmationModal.js
Outdated
Show resolved
Hide resolved
532c67b
to
10a4252
Compare
Co-authored-by: VakarisZ <36815064+VakarisZ@users.noreply.github.com>
...onkey_island/cc/ui/src/components/configuration-components/UnsafeOptionsConfirmationModal.js
Outdated
Show resolved
Hide resolved
...onkey_island/cc/ui/src/components/configuration-components/UnsafeOptionsConfirmationModal.js
Outdated
Show resolved
Hide resolved
...onkey_island/cc/ui/src/components/configuration-components/UnsafeOptionsConfirmationModal.js
Outdated
Show resolved
Hide resolved
...onkey_island/cc/ui/src/components/configuration-components/UnsafeOptionsConfirmationModal.js
Outdated
Show resolved
Hide resolved
...onkey_island/cc/ui/src/components/configuration-components/UnsafeOptionsConfirmationModal.js
Show resolved
Hide resolved
monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js
Outdated
Show resolved
Hide resolved
monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js
Outdated
Show resolved
Hide resolved
monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js
Outdated
Show resolved
Hide resolved
monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js
Outdated
Show resolved
Hide resolved
monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js
Outdated
Show resolved
Hide resolved
fdb5c43
to
473091d
Compare
473091d
to
dd7c1bb
Compare
Retry DeepCode |
@@ -11,6 +11,8 @@ import {faExclamationCircle} from '@fortawesome/free-solid-svg-icons/faExclamati | |||
import {formValidationFormats} from '../configuration-components/ValidationFormats'; | |||
import transformErrors from '../configuration-components/ValidationErrorMessages'; | |||
import InternalConfig from '../configuration-components/InternalConfig'; | |||
import UnsafeOptionsConfirmationModal from '../configuration-components/UnsafeOptionsConfirmationModal.js'; | |||
import isUnsafeOptionSelected from '../utils/SafeOptionValidator.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import isUnsafeOptionSelected from '../utils/SafeOptionValidator.js' | |
import isUnsafeOptionSelected from '../utils/SafeOptionValidator.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ that you extracted the logic
@@ -74,6 +78,20 @@ class ConfigurePageComponent extends AuthComponent { | |||
}); | |||
}; | |||
|
|||
onUnsafeConfirmationCancelClick = () => { | |||
this.setState({showUnsafeOptionsConfirmation: false}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.setState({showUnsafeOptionsConfirmation: false}) | |
this.setState({showUnsafeOptionsConfirmation: false}); |
@@ -87,10 +105,14 @@ class ConfigurePageComponent extends AuthComponent { | |||
if (this.state.selectedSection === 'attack') { | |||
this.matrixSubmit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.matrixSubmit() | |
this.matrixSubmit(); |
@@ -87,10 +105,14 @@ class ConfigurePageComponent extends AuthComponent { | |||
if (this.state.selectedSection === 'attack') { | |||
this.matrixSubmit() | |||
} else { | |||
this.configSubmit() | |||
this.attemptConfigSubmit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.attemptConfigSubmit() | |
this.attemptConfigSubmit(); |
this.updateConfigSection(); | ||
this.setState({lastAction: 'submit_attempt'}, () => { | ||
if (this.canSafelySubmitConfig(this.state.configuration)) { | ||
this.configSubmit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.configSubmit() | |
this.configSubmit(); |
onCancelClick={this.onUnsafeConfirmationCancelClick} | ||
onContinueClick={this.onUnsafeConfirmationContinueClick} | ||
/> | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) | |
); |
lastAction: 'import_success' | ||
}, () => { | ||
this.sendConfig(); | ||
this.setInitialConfig(this.state.importCandidateConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.setInitialConfig(this.state.importCandidateConfig) | |
this.setInitialConfig(this.state.importCandidateConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, but we should strive to be consistent with semicolons
What does this PR do?
Adds a modal dialog warning the user when unsafe options are selected. This prevents users from accidentally selecting unsafe options.
PR Checklist
Testing Checklist