Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bb-cli/src/bb/apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const CONTROL_PLANE_REQUEST_TIMEOUT: Duration = Duration::from_secs(3 * 60);
const CONTROL_PLANE_RESPONSE_MAX_BYTES: usize = 2 * 1024 * 1024;
const TRUSTED_CONTROL_PLANE_HOSTS: &[&str] = &[
"compose-ctrl.test.blockstaging.build",
"compose-ctrl.block.builderlabstaging.xyz",
"compose-ctrl.app.builderlab.xyz",
];

Expand Down Expand Up @@ -3889,8 +3890,10 @@ mod tests {

for trusted in [
"https://compose-ctrl.test.blockstaging.build",
"https://compose-ctrl.block.builderlabstaging.xyz",
"https://compose-ctrl.app.builderlab.xyz",
"https://compose-ctrl.test.blockstaging.build:443",
"https://compose-ctrl.block.builderlabstaging.xyz:443",
] {
assert!(
ControlPlaneClient::new(trusted, "1.0.0", style).is_ok(),
Expand All @@ -3905,6 +3908,9 @@ mod tests {
"https://app.builderlab.xyz",
"https://compose-ctrl.test.blockstaging.build.attacker.example",
"https://compose-ctrl.test.blockstaging.build:444",
"http://compose-ctrl.block.builderlabstaging.xyz",
"https://compose-ctrl.block.builderlabstaging.xyz.attacker.example",
"https://compose-ctrl.block.builderlabstaging.xyz:444",
"https://compose-ctrl.app.builderlab.xyz.attacker.example",
"https://compose-ctrl.app.builderlab.xyz:444",
"https://user@compose-ctrl.test.blockstaging.build",
Expand Down
35 changes: 21 additions & 14 deletions src-tauri/src/commands/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const TELEMETRY_SCHEMA_VERSION: &str = "berd-otlp-logs-v3";
//
// - otel.berd.xyz — the production gateway (squareup/berd-monitoring's
// production deployment), injected for VITE_ENVIRONMENT=production builds.
// - otel.test.blockstaging.build — the staging gateway
// - otel.block.builderlabstaging.xyz — the staging gateway
// (squareup/berd-monitoring's staging deployment), injected for
// VITE_ENVIRONMENT=staging builds.
// - otlp.invalid.goose-internal.example — DUMMY placeholder injected in
Expand All @@ -56,7 +56,7 @@ const TELEMETRY_SCHEMA_VERSION: &str = "berd-otlp-logs-v3";
// tauri.conf.json's CSP connect-src.
const ALLOWED_OTEL_LOGS_HOSTS: [&str; 3] = [
"otel.berd.xyz",
"otel.test.blockstaging.build",
"otel.block.builderlabstaging.xyz",
"otlp.invalid.goose-internal.example",
];

Expand Down Expand Up @@ -1674,17 +1674,17 @@ mod tests {
#[test]
fn allows_the_staging_gateway_host_and_derives_its_bootstrap_url() {
let logs_url =
allowed_otel_logs_endpoint("https://otel.test.blockstaging.build/v1/logs").unwrap();
allowed_otel_logs_endpoint("https://otel.block.builderlabstaging.xyz/v1/logs").unwrap();

let bootstrap_url = telemetry_bootstrap_url(&logs_url).unwrap();

assert_eq!(
logs_url.as_str(),
"https://otel.test.blockstaging.build/v1/logs"
"https://otel.block.builderlabstaging.xyz/v1/logs"
);
assert_eq!(
bootstrap_url.as_str(),
"https://otel.test.blockstaging.build/v1/bootstrap"
"https://otel.block.builderlabstaging.xyz/v1/bootstrap"
);
}

Expand Down Expand Up @@ -1719,18 +1719,20 @@ mod tests {
/// request; the error must not echo the credential either.
#[test]
fn rejects_endpoint_with_userinfo_credentials() {
let error =
allowed_otel_logs_endpoint("https://user:hunter2@otel.test.blockstaging.build/v1/logs")
.unwrap_err();
let error = allowed_otel_logs_endpoint(
"https://user:hunter2@otel.block.builderlabstaging.xyz/v1/logs",
)
.unwrap_err();

assert!(error.contains("credentials"));
assert!(!error.contains("hunter2"));
}

#[test]
fn rejects_endpoint_with_username_only_userinfo() {
let error = allowed_otel_logs_endpoint("https://user@otel.test.blockstaging.build/v1/logs")
.unwrap_err();
let error =
allowed_otel_logs_endpoint("https://user@otel.block.builderlabstaging.xyz/v1/logs")
.unwrap_err();

assert!(error.contains("credentials"));
}
Expand All @@ -1740,8 +1742,9 @@ mod tests {
/// and installation id.
#[test]
fn rejects_endpoint_with_explicit_port() {
let error = allowed_otel_logs_endpoint("https://otel.test.blockstaging.build:8443/v1/logs")
.unwrap_err();
let error =
allowed_otel_logs_endpoint("https://otel.block.builderlabstaging.xyz:8443/v1/logs")
.unwrap_err();

assert!(error.contains("port"));
}
Expand All @@ -1751,9 +1754,13 @@ mod tests {
#[test]
fn allows_the_scheme_default_port() {
let url =
allowed_otel_logs_endpoint("https://otel.test.blockstaging.build:443/v1/logs").unwrap();
allowed_otel_logs_endpoint("https://otel.block.builderlabstaging.xyz:443/v1/logs")
.unwrap();

assert_eq!(url.as_str(), "https://otel.test.blockstaging.build/v1/logs");
assert_eq!(
url.as_str(),
"https://otel.block.builderlabstaging.xyz/v1/logs"
);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"security": {
"csp": {
"default-src": "'self' asset:",
"connect-src": "'self' ipc: asset: http://asset.localhost http://ipc.localhost http://localhost:* ws://localhost:* http://127.0.0.1:* ws://127.0.0.1:* data: https: https://otel.berd.xyz/v1/logs https://otel.berd.xyz/v1/bootstrap https://otel.test.blockstaging.build/v1/logs https://otel.test.blockstaging.build/v1/bootstrap https://otlp.invalid.goose-internal.example/v1/logs https://otlp.invalid.goose-internal.example/v1/bootstrap",
"connect-src": "'self' ipc: asset: http://asset.localhost http://ipc.localhost http://localhost:* ws://localhost:* http://127.0.0.1:* ws://127.0.0.1:* data: https: https://otel.berd.xyz/v1/logs https://otel.berd.xyz/v1/bootstrap https://otel.block.builderlabstaging.xyz/v1/logs https://otel.block.builderlabstaging.xyz/v1/bootstrap https://otlp.invalid.goose-internal.example/v1/logs https://otlp.invalid.goose-internal.example/v1/bootstrap",
"font-src": "'self'",
"img-src": "'self' asset: http://asset.localhost blob: data: https://models.dev",
"media-src": "'self' asset: http://asset.localhost blob: data:",
Expand Down
2 changes: 1 addition & 1 deletion src/shared/telemetry/exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { JsonLogsSerializer } from "@opentelemetry/otlp-transformer";
// Injected by vite.config.ts from VITE_OTLP_LOGS_ENDPOINT: the full telemetry
// gateway `https://<host>/v1/logs` URL. Production builds get the production
// gateway (otel.berd.xyz), staging builds the staging gateway
// (otel.test.blockstaging.build); development gets an obviously-fake DUMMY
// (otel.block.builderlabstaging.xyz); development gets an obviously-fake DUMMY
// host, so the prod/staging gate (see `./client`) plus that placeholder keep
// the path inert in dev and external clones. The native side derives the
// anonymous `/v1/bootstrap` URL from this same endpoint, so no bootstrap URL
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const PRODUCTION_OTLP_LOGS_ENDPOINT = "https://otel.berd.xyz/v1/logs";
// The staging gateway (squareup/berd-monitoring's staging deployment) —
// injected whenever VITE_ENVIRONMENT=staging.
const STAGING_OTLP_LOGS_ENDPOINT =
"https://otel.test.blockstaging.build/v1/logs";
"https://otel.block.builderlabstaging.xyz/v1/logs";

// DUMMY placeholder for development. The telemetry send path (OTel logs over
// OTLP) is gated to production/staging, so this fake host is never contacted
Expand Down
Loading