diff --git a/.moon/workspace.yml b/.moon/workspace.yml index a4c8de7dbaa..3a6afc820e0 100644 --- a/.moon/workspace.yml +++ b/.moon/workspace.yml @@ -42,6 +42,8 @@ unstable_remote: auth: token: 'DEPOT_TOKEN' headers: + Authorization: + 'Bearer depot_org_ece2365d877c7f2f437f46de5bf03bd54862e3ca7fde67f079264e971ecb0789' 'X-Depot-Org': '1xtpjd084j' 'X-Depot-Project': '90xxfkst9n' # cache: diff --git a/crates/config/src/workspace/remote_config.rs b/crates/config/src/workspace/remote_config.rs index b3fed94b615..2b8cae2c475 100644 --- a/crates/config/src/workspace/remote_config.rs +++ b/crates/config/src/workspace/remote_config.rs @@ -116,11 +116,15 @@ pub struct RemoteConfig { } impl RemoteConfig { + pub fn is_bearer_auth(&self) -> bool { + self.auth.as_ref().is_some_and(|auth| auth.token.is_some()) + } + pub fn is_localhost(&self) -> bool { self.host.contains("localhost") || self.host.contains("0.0.0.0") } pub fn is_secure(&self) -> bool { - self.auth.is_some() || self.tls.is_some() || self.mtls.is_some() + self.is_bearer_auth() || self.tls.is_some() || self.mtls.is_some() } } diff --git a/crates/remote/src/grpc_remote_client.rs b/crates/remote/src/grpc_remote_client.rs index 8191a2fcbc2..3646480e0e3 100644 --- a/crates/remote/src/grpc_remote_client.rs +++ b/crates/remote/src/grpc_remote_client.rs @@ -47,10 +47,6 @@ pub struct GrpcRemoteClient { impl GrpcRemoteClient { fn inject_auth_headers(&self, mut req: Request<()>) -> Result, Status> { - if self.config.mtls.is_some() || self.config.tls.is_some() { - return Ok(req); - } - if let Some(auth) = &self.config.auth { let headers = req.metadata_mut(); @@ -101,7 +97,7 @@ impl RemoteClient for GrpcRemoteClient { "(with mTLS)" } else if config.tls.is_some() { "(with TLS)" - } else if config.auth.is_some() { + } else if config.is_bearer_auth() { "(with auth)" } else { "(insecure)" @@ -110,13 +106,13 @@ impl RemoteClient for GrpcRemoteClient { // Although we use a grpc(s) protocol for the host, // tonic only supports http(s), so change it - let url = if let Some(suffix) = host.strip_prefix("grpc") { - format!("http{suffix}") - } else { - host.to_owned() - }; + // let url = if let Some(suffix) = host.strip_prefix("grpc") { + // format!("http{suffix}") + // } else { + // host.to_owned() + // }; - let mut endpoint = Endpoint::from_shared(url) + let mut endpoint = Endpoint::from_shared(host.to_owned()) .map_err(map_transport_error)? .user_agent("moon") .map_err(map_transport_error)? @@ -147,7 +143,7 @@ impl RemoteClient for GrpcRemoteClient { // We can't inject auth headers into this initial connection, // so defer the connection until a client is used - if self.config.auth.is_some() { + if self.config.is_bearer_auth() { self.channel = Some(endpoint.connect_lazy()); } else { self.channel = Some(endpoint.connect().await.map_err(map_transport_error)?); diff --git a/packages/types/src/common.ts b/packages/types/src/common.ts index d5a174a1db3..fb5b6adfa92 100644 --- a/packages/types/src/common.ts +++ b/packages/types/src/common.ts @@ -14,3 +14,5 @@ export interface Runtime { } export type ExtendsFrom = string[] | string; + +// 123