diff --git a/monkey/monkey_island/cc/app.py b/monkey/monkey_island/cc/app.py index b4413e7a5..b4b884fc7 100644 --- a/monkey/monkey_island/cc/app.py +++ b/monkey/monkey_island/cc/app.py @@ -153,9 +153,9 @@ def init_api_resources(api): api.add_resource(PBAFileDownload, "/api/pba/download/") api.add_resource( FileUpload, - "/api/fileUpload/", - "/api/fileUpload/?load=", - "/api/fileUpload/?restore=", + "/api/file-upload/", + "/api/file-upload/?load=", + "/api/file-upload/?restore=", ) api.add_resource(PropagationCredentials, "/api/propagation-credentials/") api.add_resource(RemoteRun, "/api/remote-monkey") 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 4650aec07..5f67c9010 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -20,8 +20,8 @@ import HtmlFieldDescription from '../configuration-components/HtmlFieldDescripti import CONFIGURATION_TABS_PER_MODE from '../configuration-components/ConfigurationTabs.js'; const CONFIG_URL = '/api/configuration/island'; -export const API_PBA_LINUX = '/api/fileUpload/PBAlinux'; -export const API_PBA_WINDOWS = '/api/fileUpload/PBAwindows'; +export const API_PBA_LINUX = '/api/file-upload/PBAlinux'; +export const API_PBA_WINDOWS = '/api/file-upload/PBAwindows'; class ConfigurePageComponent extends AuthComponent { diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/test_pba_file_upload.py b/monkey/tests/unit_tests/monkey_island/cc/resources/test_pba_file_upload.py index 3dfad70a7..a0b8352e2 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/test_pba_file_upload.py +++ b/monkey/tests/unit_tests/monkey_island/cc/resources/test_pba_file_upload.py @@ -38,7 +38,7 @@ def mock_get_config_value(monkeypatch): @pytest.mark.parametrize("pba_os", [LINUX_PBA_TYPE, WINDOWS_PBA_TYPE]) def test_pba_file_upload_post(flask_client, pba_os, monkeypatch, mock_set_config_value): resp = flask_client.post( - f"/api/fileUpload/{pba_os}", + f"/api/file-upload/{pba_os}", data=TEST_FILE, content_type="multipart/form-data; " "boundary=---------------------------" "1", follow_redirects=True, @@ -48,7 +48,7 @@ def test_pba_file_upload_post(flask_client, pba_os, monkeypatch, mock_set_config def test_pba_file_upload_post__invalid(flask_client, monkeypatch, mock_set_config_value): resp = flask_client.post( - "/api/fileUpload/bogus", + "/api/file-upload/bogus", data=TEST_FILE, content_type="multipart/form-data; " "boundary=---------------------------" "1", follow_redirects=True, @@ -66,7 +66,7 @@ def test_pba_file_upload_post__internal_server_error( ) resp = flask_client.post( - f"/api/fileUpload/{pba_os}", + f"/api/file-upload/{pba_os}", data=TEST_FILE, content_type="multipart/form-data; boundary=---------------------------1", follow_redirects=True, @@ -78,7 +78,7 @@ def test_pba_file_upload_post__internal_server_error( def test_pba_file_upload_get__file_not_found( flask_client, pba_os, monkeypatch, mock_get_config_value ): - resp = flask_client.get(f"/api/fileUpload/{pba_os}?load=bogus_mogus.py") + resp = flask_client.get(f"/api/file-upload/{pba_os}?load=bogus_mogus.py") assert resp.status_code == 404 @@ -87,22 +87,22 @@ def test_pba_file_upload_endpoint( flask_client, pba_os, monkeypatch, mock_get_config_value, mock_set_config_value ): resp_post = flask_client.post( - f"/api/fileUpload/{pba_os}", + f"/api/file-upload/{pba_os}", data=TEST_FILE, content_type="multipart/form-data; " "boundary=---------------------------" "1", follow_redirects=True, ) - resp_get = flask_client.get(f"/api/fileUpload/{pba_os}?load=test.py") + resp_get = flask_client.get(f"/api/file-upload/{pba_os}?load=test.py") assert resp_get.status_code == 200 assert resp_get.data.decode() == "m0nk3y" # Closing the response closes the file handle, else it can't be deleted resp_get.close() resp_delete = flask_client.delete( - f"/api/fileUpload/{pba_os}", data="test.py", content_type="text/plain;" + f"/api/file-upload/{pba_os}", data="test.py", content_type="text/plain;" ) - resp_get_del = flask_client.get(f"/api/fileUpload/{pba_os}?load=test.py") + resp_get_del = flask_client.get(f"/api/file-upload/{pba_os}?load=test.py") assert resp_post.status_code == 200 assert resp_delete.status_code == 200 @@ -114,14 +114,14 @@ def test_pba_file_upload_endpoint__invalid( flask_client, monkeypatch, mock_set_config_value, mock_get_config_value ): resp_post = flask_client.post( - "/api/fileUpload/bogus", + "/api/file-upload/bogus", data=TEST_FILE, content_type="multipart/form-data; " "boundary=---------------------------" "1", follow_redirects=True, ) - resp_get = flask_client.get("/api/fileUpload/bogus?load=test.py") + resp_get = flask_client.get("/api/file-upload/bogus?load=test.py") resp_delete = flask_client.delete( - "/api/fileUpload/bogus", data="test.py", content_type="text/plain;" + "/api/file-upload/bogus", data="test.py", content_type="text/plain;" ) assert resp_post.status_code == 422 assert resp_get.status_code == 422