diff --git a/src-tauri/src/ipc.rs b/src-tauri/src/ipc.rs index 4ec8317..ea6a62c 100644 --- a/src-tauri/src/ipc.rs +++ b/src-tauri/src/ipc.rs @@ -12,6 +12,7 @@ use crate::state::AppState; pub struct Request { pub id: u64, pub clients: Vec>, + pub base: bool, } diff --git a/src-tauri/src/server.rs b/src-tauri/src/server.rs index e9fd750..02fe4e3 100644 --- a/src-tauri/src/server.rs +++ b/src-tauri/src/server.rs @@ -58,8 +58,8 @@ impl Handler { self.stream.write(b"HTTP/1.0 403 Access Denied\r\n\r\n").await?; return Ok(()) } - // at present only the running exe should be permitted to access this route - if req_path == b"/creddy/base-credentials" { + let base = req_path == b"/creddy/base-credentials"; + if base { if clients.len() != 1 || clients[0].is_none() || clients[0].as_ref().unwrap().exe != std::env::current_exe()? @@ -69,14 +69,14 @@ impl Handler { } } - let req = Request {id: self.request_id, clients}; + let req = Request {id: self.request_id, clients, base}; self.app.emit_all("credentials-request", &req)?; let starting_visibility = self.show_window()?; match self.wait_for_response().await? { Approval::Approved => { let state = self.app.state::(); - let creds = if req_path == b"/creddy/base-credentials" { + let creds = if base { state.serialize_base_creds().await? } else { diff --git a/src/App.svelte b/src/App.svelte index 4f0d979..1a96d9f 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -15,6 +15,7 @@ invoke('get_config').then(config => $appState.config = config); listen('credentials-request', (tauriEvent) => { $appState.pendingRequests.put(tauriEvent.payload); }); +window.state = $appState; acceptRequest(); diff --git a/src/views/Approve.svelte b/src/views/Approve.svelte index 6ad1040..0b2dd99 100644 --- a/src/views/Approve.svelte +++ b/src/views/Approve.svelte @@ -80,6 +80,18 @@ {/if} + {#if $appState.currentRequest.base} +
+
+ + + WARNING: This application is requesting your base (long-lived) AWS credentials. + These crednetials are less secure than session credentials, since they don't expire automatically. + +
+
+ {/if} +

{appName ? `"${appName}"` : 'An appplication'} would like to access your AWS credentials.