From 1e9d193a6daeb964187537565c4e046cb604066f Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 13 Jul 2022 18:54:13 +0530 Subject: [PATCH 1/4] UI: Clear configured credentials on Island reset --- .../cc/ui/src/components/ui-components/IslandResetModal.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/monkey/monkey_island/cc/ui/src/components/ui-components/IslandResetModal.tsx b/monkey/monkey_island/cc/ui/src/components/ui-components/IslandResetModal.tsx index 5b3db45eb..c744c869a 100644 --- a/monkey/monkey_island/cc/ui/src/components/ui-components/IslandResetModal.tsx +++ b/monkey/monkey_island/cc/ui/src/components/ui-components/IslandResetModal.tsx @@ -107,6 +107,10 @@ const IslandResetModal = (props: Props) => { if (res.status === 200) { return auth.authFetch('/api/clear-simulation-data', {method: 'POST'}) }}) + .then(res => { + if (res.status === 200) { + return auth.authFetch('/api/propagation-credentials/configured-credentials', {method: 'DELETE'}) + }}) .then(res => { if (res.status === 200) { return auth.authFetch('/api/island-mode', {method: 'POST', body: '{"mode": "unset"}'}) From 6eed07dd363d3fb1675bc9ac324387bb20c85389 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 13 Jul 2022 18:57:58 +0530 Subject: [PATCH 2/4] UI: Clear configured credentials on configuration reset --- .../monkey_island/cc/ui/src/components/pages/ConfigurePage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js index 154eff52c..d711ab017 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -236,7 +236,8 @@ class ConfigurePageComponent extends AuthComponent { ).then(() => { this.removePBAfile(API_PBA_WINDOWS, this.setPbaFilenameWindows) this.removePBAfile(API_PBA_LINUX, this.setPbaFilenameLinux) - }); + }) + .then(this.authFetch('/api/propagation-credentials/configured-credentials', {method: 'DELETE'})); }; removePBAfile(apiEndpoint, setFilenameFnc) { From 060250e021987c1a7ed5caa5b54093e1fcfbe7a6 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 13 Jul 2022 19:04:57 +0530 Subject: [PATCH 3/4] UI: Fix formatting in ConfigurePage.js for consistency --- .../cc/ui/src/components/pages/ConfigurePage.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js index d711ab017..9590fced2 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -233,11 +233,12 @@ class ConfigurePageComponent extends AuthComponent { this.updateConfig(); this.props.onStatusChange(); } - ).then(() => { - this.removePBAfile(API_PBA_WINDOWS, this.setPbaFilenameWindows) - this.removePBAfile(API_PBA_LINUX, this.setPbaFilenameLinux) - }) - .then(this.authFetch('/api/propagation-credentials/configured-credentials', {method: 'DELETE'})); + ) + .then(() => { + this.removePBAfile(API_PBA_WINDOWS, this.setPbaFilenameWindows) + this.removePBAfile(API_PBA_LINUX, this.setPbaFilenameLinux) + }) + .then(this.authFetch('/api/propagation-credentials/configured-credentials', {method: 'DELETE'})); }; removePBAfile(apiEndpoint, setFilenameFnc) { From cc17a57e20bdb8edcfd56000da95e0e0a2f4c9cb Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 13 Jul 2022 19:06:42 +0530 Subject: [PATCH 4/4] UI: Extract URL to constant in ConfigurePage.js --- .../monkey_island/cc/ui/src/components/pages/ConfigurePage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js index 9590fced2..a10823564 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -21,6 +21,7 @@ import {reformatConfig} from '../configuration-components/ReformatHook'; const CONFIG_URL = '/api/agent-configuration'; const RESET_URL = '/api/reset-agent-configuration'; +const CONFIGURED_PROPAGATION_CREDENTIALS_URL = '/api/propagation-credentials/configured-credentials'; export const API_PBA_LINUX = '/api/file-upload/PBAlinux'; export const API_PBA_WINDOWS = '/api/file-upload/PBAwindows'; @@ -238,7 +239,7 @@ class ConfigurePageComponent extends AuthComponent { this.removePBAfile(API_PBA_WINDOWS, this.setPbaFilenameWindows) this.removePBAfile(API_PBA_LINUX, this.setPbaFilenameLinux) }) - .then(this.authFetch('/api/propagation-credentials/configured-credentials', {method: 'DELETE'})); + .then(this.authFetch(CONFIGURED_PROPAGATION_CREDENTIALS_URL, {method: 'DELETE'})); }; removePBAfile(apiEndpoint, setFilenameFnc) {