Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1484e1074 |
No files matched your search
@@ -1,268 +0,0 @@
|
|||||||
//! The workspace's branding for the dashboard (tenant-registry#155): its CI
|
|
||||||
//! colour, which frames every page, its logo, and the one-time notice for its
|
|
||||||
//! admins that both were taken from its website.
|
|
||||||
//!
|
|
||||||
//! The registry derives and stores the branding; the agent only passes on
|
|
||||||
//! what the entitlement check (already cached per tenant) says, serves the
|
|
||||||
//! logo from its own origin, and forwards an admin's "Passt". Without a
|
|
||||||
//! registry, or when it cannot be asked, there is simply no branding.
|
|
||||||
|
|
||||||
use axum::extract::Extension;
|
|
||||||
use axum::http::{header, StatusCode};
|
|
||||||
use axum::response::{IntoResponse, Response};
|
|
||||||
use axum::Json;
|
|
||||||
use serde::Serialize;
|
|
||||||
|
|
||||||
use compliance_core::tenant::TenantContext;
|
|
||||||
use compliance_core::tenant_ctx::TenantCtx;
|
|
||||||
|
|
||||||
use super::dto::AgentExt;
|
|
||||||
use crate::registry::{AckRefusal, Branding};
|
|
||||||
|
|
||||||
/// What the dashboard draws.
|
|
||||||
#[derive(Debug, Default, PartialEq, Eq, Serialize, utoipa::ToSchema)]
|
|
||||||
pub struct BrandingView {
|
|
||||||
/// The frame colour, `#rrggbb`; none means no frame.
|
|
||||||
pub color: Option<String>,
|
|
||||||
/// Whether `GET /api/v1/branding/logo` has a logo.
|
|
||||||
pub logo: bool,
|
|
||||||
/// The workspace's name, beside the logo.
|
|
||||||
pub name: Option<String>,
|
|
||||||
/// Whether to show the caller the notice; only ever for its admins.
|
|
||||||
pub notice: bool,
|
|
||||||
/// The domain the branding was taken from, for the notice.
|
|
||||||
pub domain: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BrandingView {
|
|
||||||
/// The view of `branding` for `caller`: the notice only for a person who
|
|
||||||
/// is an admin of the workspace, never for support or an API key.
|
|
||||||
fn of(branding: &Branding, caller: &TenantContext) -> Self {
|
|
||||||
let admin = caller.is_admin() && caller.staff.is_none() && caller.api_key.is_none();
|
|
||||||
let notice = admin && branding.notice && branding.domain.is_some();
|
|
||||||
Self {
|
|
||||||
color: branding.frame_color(),
|
|
||||||
logo: branding.logo_etag().is_some(),
|
|
||||||
name: branding.name.clone().filter(|n| !n.trim().is_empty()),
|
|
||||||
notice,
|
|
||||||
domain: notice.then(|| branding.domain.clone()).flatten(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The workspace's branding as the registry answered, or none.
|
|
||||||
async fn branding(agent: &crate::agent::ComplianceAgent, tenant_id: &str) -> Option<Branding> {
|
|
||||||
let registry = agent.registry.as_ref()?;
|
|
||||||
match registry.check_entitlement(tenant_id, None, None).await {
|
|
||||||
Ok(check) => check.branding,
|
|
||||||
Err(e) => {
|
|
||||||
tracing::debug!(tenant_id, "branding not read: {e}");
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The workspace's branding.
|
|
||||||
///
|
|
||||||
/// Its CI colour, whether it has a logo, and whether the caller (an admin)
|
|
||||||
/// still has to acknowledge a branding taken from its website. Every field is
|
|
||||||
/// empty when the workspace has none or the registry cannot be asked.
|
|
||||||
#[utoipa::path(
|
|
||||||
get,
|
|
||||||
path = "/api/v1/branding",
|
|
||||||
tag = "Workspace",
|
|
||||||
responses(
|
|
||||||
(status = 200, description = "The branding", body = BrandingView),
|
|
||||||
(status = 401, description = "No valid bearer token"),
|
|
||||||
)
|
|
||||||
)]
|
|
||||||
pub async fn get_branding(
|
|
||||||
Extension(agent): AgentExt,
|
|
||||||
tenant: TenantCtx,
|
|
||||||
) -> Json<serde_json::Value> {
|
|
||||||
let view = branding(&agent, &tenant.0.tenant_id)
|
|
||||||
.await
|
|
||||||
.map(|b| BrandingView::of(&b, &tenant.0))
|
|
||||||
.unwrap_or_default();
|
|
||||||
Json(serde_json::json!({ "data": view }))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The workspace's logo.
|
|
||||||
///
|
|
||||||
/// A PNG of at most 256 px, from the registry, never an SVG.
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// `404` when the workspace has no logo; `502` when the registry cannot
|
|
||||||
/// deliver it.
|
|
||||||
#[utoipa::path(
|
|
||||||
get,
|
|
||||||
path = "/api/v1/branding/logo",
|
|
||||||
tag = "Workspace",
|
|
||||||
responses(
|
|
||||||
(status = 200, description = "The logo", content_type = "image/png"),
|
|
||||||
(status = 404, description = "No logo"),
|
|
||||||
(status = 502, description = "The registry cannot deliver it"),
|
|
||||||
(status = 401, description = "No valid bearer token"),
|
|
||||||
)
|
|
||||||
)]
|
|
||||||
pub async fn get_logo(
|
|
||||||
Extension(agent): AgentExt,
|
|
||||||
tenant: TenantCtx,
|
|
||||||
) -> Result<Response, StatusCode> {
|
|
||||||
let tenant_id = &tenant.0.tenant_id;
|
|
||||||
let (Some(registry), Some(b)) = (agent.registry.as_ref(), branding(&agent, tenant_id).await)
|
|
||||||
else {
|
|
||||||
return Err(StatusCode::NOT_FOUND);
|
|
||||||
};
|
|
||||||
let etag = b.logo_etag().ok_or(StatusCode::NOT_FOUND)?;
|
|
||||||
match registry.branding_logo(tenant_id, etag).await {
|
|
||||||
Ok(Some(png)) => Ok((
|
|
||||||
[
|
|
||||||
(header::CONTENT_TYPE, "image/png".to_string()),
|
|
||||||
(header::ETAG, format!("\"{etag}\"")),
|
|
||||||
(header::CACHE_CONTROL, "private, max-age=300".to_string()),
|
|
||||||
(header::X_CONTENT_TYPE_OPTIONS, "nosniff".to_string()),
|
|
||||||
],
|
|
||||||
png,
|
|
||||||
)
|
|
||||||
.into_response()),
|
|
||||||
Ok(None) => Err(StatusCode::NOT_FOUND),
|
|
||||||
Err(e) => {
|
|
||||||
tracing::warn!(tenant_id, "logo not fetched: {e}");
|
|
||||||
Err(StatusCode::BAD_GATEWAY)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Acknowledge the workspace's branding ("Passt").
|
|
||||||
///
|
|
||||||
/// An admin confirms the logo and colour taken from the workspace's website;
|
|
||||||
/// the notice then no longer shows.
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// `403` when the caller is no admin of the workspace; `503` without a
|
|
||||||
/// registry; `502` when the registry cannot record it.
|
|
||||||
#[utoipa::path(
|
|
||||||
post,
|
|
||||||
path = "/api/v1/branding/ack",
|
|
||||||
tag = "Workspace",
|
|
||||||
responses(
|
|
||||||
(status = 204, description = "Recorded"),
|
|
||||||
(status = 403, description = "Only the workspace's admins acknowledge it"),
|
|
||||||
(status = 502, description = "The registry cannot record it"),
|
|
||||||
(status = 503, description = "No registry"),
|
|
||||||
(status = 401, description = "No valid bearer token"),
|
|
||||||
)
|
|
||||||
)]
|
|
||||||
pub async fn ack(Extension(agent): AgentExt, tenant: TenantCtx) -> StatusCode {
|
|
||||||
let caller = &tenant.0;
|
|
||||||
if !caller.is_admin() || caller.staff.is_some() || caller.api_key.is_some() {
|
|
||||||
return StatusCode::FORBIDDEN;
|
|
||||||
}
|
|
||||||
let Some(registry) = agent.registry.as_ref() else {
|
|
||||||
return StatusCode::SERVICE_UNAVAILABLE;
|
|
||||||
};
|
|
||||||
match registry
|
|
||||||
.ack_branding(&caller.tenant_id, &caller.user_id)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Ok(()) => StatusCode::NO_CONTENT,
|
|
||||||
Err(AckRefusal::NotAdmin) => {
|
|
||||||
tracing::info!(
|
|
||||||
tenant_id = %caller.tenant_id,
|
|
||||||
"branding ack refused: the registry does not count the caller as an admin"
|
|
||||||
);
|
|
||||||
StatusCode::FORBIDDEN
|
|
||||||
}
|
|
||||||
Err(AckRefusal::Failed(e)) => {
|
|
||||||
tracing::warn!(tenant_id = %caller.tenant_id, "branding ack failed: {e}");
|
|
||||||
StatusCode::BAD_GATEWAY
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
use compliance_core::{OrgRole, TenantStatus};
|
|
||||||
|
|
||||||
fn caller(roles: Vec<OrgRole>) -> TenantContext {
|
|
||||||
TenantContext {
|
|
||||||
tenant_id: "t-1".into(),
|
|
||||||
tenant_slug: "acme".into(),
|
|
||||||
org_roles: roles,
|
|
||||||
products: vec!["compliance-scanner".into()],
|
|
||||||
plan: "entry".into(),
|
|
||||||
status: TenantStatus::Active,
|
|
||||||
user_id: "u-1".into(),
|
|
||||||
user_name: None,
|
|
||||||
staff: None,
|
|
||||||
api_key: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn derived() -> Branding {
|
|
||||||
Branding {
|
|
||||||
color: Some("#14B8A6".into()),
|
|
||||||
logo_etag: Some("a".repeat(64)),
|
|
||||||
notice: true,
|
|
||||||
domain: Some("example.de".into()),
|
|
||||||
name: Some("Example GmbH".into()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn only_an_admin_sees_the_notice() {
|
|
||||||
// Arrange
|
|
||||||
let b = derived();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
let admin = BrandingView::of(&b, &caller(vec![OrgRole::ItAdmin]));
|
|
||||||
let member = BrandingView::of(&b, &caller(vec![OrgRole::User]));
|
|
||||||
|
|
||||||
// Assert: both see the frame and logo, only the admin the notice.
|
|
||||||
assert_eq!(admin.color.as_deref(), Some("#14b8a6"));
|
|
||||||
assert!(admin.logo && member.logo);
|
|
||||||
assert!(admin.notice);
|
|
||||||
assert_eq!(admin.domain.as_deref(), Some("example.de"));
|
|
||||||
assert!(!member.notice);
|
|
||||||
assert_eq!(member.domain, None);
|
|
||||||
assert_eq!(member.color, admin.color);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn support_and_api_keys_never_see_the_notice() {
|
|
||||||
let b = derived();
|
|
||||||
let mut staff = caller(vec![OrgRole::Owner]);
|
|
||||||
staff.staff = Some(compliance_core::tenant::StaffAccess {
|
|
||||||
user_id: "s-1".into(),
|
|
||||||
user_name: None,
|
|
||||||
});
|
|
||||||
assert!(!BrandingView::of(&b, &staff).notice);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_malformed_colour_or_etag_is_no_frame_and_no_logo() {
|
|
||||||
for color in ["red", "#12345", "#1234567", "#gggggg", "url(x)", ""] {
|
|
||||||
let b = Branding {
|
|
||||||
color: Some(color.into()),
|
|
||||||
logo_etag: Some("not-a-hash".into()),
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
let view = BrandingView::of(&b, &caller(vec![OrgRole::Owner]));
|
|
||||||
assert_eq!(view.color, None, "{color}");
|
|
||||||
assert!(!view.logo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_notice_without_a_domain_is_not_shown() {
|
|
||||||
let b = Branding {
|
|
||||||
domain: None,
|
|
||||||
..derived()
|
|
||||||
};
|
|
||||||
assert!(!BrandingView::of(&b, &caller(vec![OrgRole::Owner])).notice);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
pub mod admin;
|
pub mod admin;
|
||||||
pub mod branding;
|
|
||||||
pub mod chat;
|
pub mod chat;
|
||||||
pub mod connections;
|
pub mod connections;
|
||||||
pub mod cve_history;
|
pub mod cve_history;
|
||||||
|
|||||||
@@ -250,16 +250,14 @@ pub async fn export(
|
|||||||
|
|
||||||
/// `DELETE /api/v1/platform/tenants/{id}/data` — GDPR erasure: drops the
|
/// `DELETE /api/v1/platform/tenants/{id}/data` — GDPR erasure: drops the
|
||||||
/// tenant database and removes its code from disk (clones, uploads, work
|
/// tenant database and removes its code from disk (clones, uploads, work
|
||||||
/// trees, blobs, runner artifacts). Requires `{"confirm": "<tenant id>"}`:
|
/// trees, blobs, runner artifacts). Requires `{"confirm": "<slug or id>"}`.
|
||||||
/// the same id as in the path, so a call can only erase the tenant it names
|
|
||||||
/// twice; anything else is refused with 400 before anything is touched.
|
|
||||||
pub async fn delete_data(
|
pub async fn delete_data(
|
||||||
State(st): State<PlatformState>,
|
State(st): State<PlatformState>,
|
||||||
Path(tenant_id): Path<String>,
|
Path(tenant_id): Path<String>,
|
||||||
body: Option<Json<LifecycleBody>>,
|
body: Option<Json<LifecycleBody>>,
|
||||||
) -> Result<Json<serde_json::Value>, StatusCode> {
|
) -> Result<Json<serde_json::Value>, StatusCode> {
|
||||||
let confirm = body.and_then(|Json(b)| b.confirm);
|
let confirm = body.and_then(|Json(b)| b.confirm).unwrap_or_default();
|
||||||
if !confirms_erasure(&tenant_id, confirm.as_deref()) {
|
if confirm.is_empty() {
|
||||||
return Err(StatusCode::BAD_REQUEST);
|
return Err(StatusCode::BAD_REQUEST);
|
||||||
}
|
}
|
||||||
// Where the tenant's code lies on disk, read before its records go.
|
// Where the tenant's code lies on disk, read before its records go.
|
||||||
@@ -301,12 +299,6 @@ pub async fn delete_data(
|
|||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether `confirm` confirms erasing `tenant_id`: it must be that id,
|
|
||||||
/// exactly. A missing or empty value, or another tenant's id, does not.
|
|
||||||
fn confirms_erasure(tenant_id: &str, confirm: Option<&str>) -> bool {
|
|
||||||
!tenant_id.is_empty() && confirm == Some(tenant_id)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `POST /api/v1/platform/tenants/demo/reset` — drops and re-creates the
|
/// `POST /api/v1/platform/tenants/demo/reset` — drops and re-creates the
|
||||||
/// demo tenant database. With `{"seed": true}` it then re-seeds the bundled
|
/// demo tenant database. With `{"seed": true}` it then re-seeds the bundled
|
||||||
/// demo targets and starts their scans, which is what the nightly reset of the
|
/// demo targets and starts their scans, which is what the nightly reset of the
|
||||||
@@ -856,20 +848,3 @@ mod target_count_tests {
|
|||||||
assert!(stages[0].contains_key("$match") && stages[1].contains_key("$group"));
|
assert!(stages[0].contains_key("$match") && stages[1].contains_key("$group"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod erasure_tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn only_the_tenants_own_id_confirms_its_erasure() {
|
|
||||||
assert!(confirms_erasure("t-1", Some("t-1")));
|
|
||||||
assert!(!confirms_erasure("t-1", None));
|
|
||||||
assert!(!confirms_erasure("t-1", Some("")));
|
|
||||||
assert!(!confirms_erasure("t-1", Some("t-2")));
|
|
||||||
assert!(!confirms_erasure("t-1", Some("T-1")));
|
|
||||||
assert!(!confirms_erasure("t-1", Some(" t-1")));
|
|
||||||
assert!(!confirms_erasure("t-1", Some("yes")));
|
|
||||||
assert!(!confirms_erasure("", Some("")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -73,10 +73,6 @@ fn described_routes() -> OpenApiRouter {
|
|||||||
handlers::supply_chain_layout::reset_layout
|
handlers::supply_chain_layout::reset_layout
|
||||||
))
|
))
|
||||||
.routes(routes!(handlers::metering::get_usage))
|
.routes(routes!(handlers::metering::get_usage))
|
||||||
// The workspace's branding (tenant-registry#155).
|
|
||||||
.routes(routes!(handlers::branding::get_branding))
|
|
||||||
.routes(routes!(handlers::branding::get_logo))
|
|
||||||
.routes(routes!(handlers::branding::ack))
|
|
||||||
// Whether the caller may use Prüfwerk at all: answered by the
|
// Whether the caller may use Prüfwerk at all: answered by the
|
||||||
// authentication and entitlement layers in front of it (a blocked
|
// authentication and entitlement layers in front of it (a blocked
|
||||||
// member gets 403 MEMBER_BLOCKED), for the dashboard's sign-in check.
|
// member gets 403 MEMBER_BLOCKED), for the dashboard's sign-in check.
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ async fn seed_one(
|
|||||||
compliance_core::models::OnboardedTarget::new(full_name.to_string(), demo.target_type);
|
compliance_core::models::OnboardedTarget::new(full_name.to_string(), demo.target_type);
|
||||||
target.description = demo.description.clone();
|
target.description = demo.description.clone();
|
||||||
target.demo = true;
|
target.demo = true;
|
||||||
target.devices = demo.devices.clone();
|
|
||||||
for a in demo.artifacts.iter().filter(|a| !a.is_upload()) {
|
for a in demo.artifacts.iter().filter(|a| !a.is_upload()) {
|
||||||
match a.resolved_source_ref() {
|
match a.resolved_source_ref() {
|
||||||
Some(source_ref) => target.artifacts.push(targets::reference_artifact(
|
Some(source_ref) => target.artifacts.push(targets::reference_artifact(
|
||||||
|
|||||||
@@ -117,10 +117,6 @@ pub struct DemoTarget {
|
|||||||
/// Applied by the nightly harness to the fixtures it onboards itself.
|
/// Applied by the nightly harness to the fixtures it onboards itself.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub enabled_scans: Vec<String>,
|
pub enabled_scans: Vec<String>,
|
||||||
/// Siemens controllers the target runs on (SPS item 4a), stored with the
|
|
||||||
/// target so its SBOM lists them and Siemens' advisories match them.
|
|
||||||
#[serde(default)]
|
|
||||||
pub devices: Vec<compliance_core::models::PlcDevice>,
|
|
||||||
/// Golden baseline for the nightly regression.
|
/// Golden baseline for the nightly regression.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub expect: Expect,
|
pub expect: Expect,
|
||||||
@@ -495,32 +491,6 @@ mod tests {
|
|||||||
assert_eq!(on_disk.name_prefix, bundled.name_prefix);
|
assert_eq!(on_disk.name_prefix, bundled.name_prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn demo_devices_are_stored_as_the_api_would_store_them() {
|
|
||||||
// Arrange
|
|
||||||
let m = manifest();
|
|
||||||
let pump = m
|
|
||||||
.targets
|
|
||||||
.iter()
|
|
||||||
.find(|t| t.key == "plc-pump-station")
|
|
||||||
.expect("pump station in the manifest");
|
|
||||||
|
|
||||||
// Assert: a controller on a firmware Siemens names as affected
|
|
||||||
// (SSA-876787: below V2.9.8), so the demo SBOM is not empty.
|
|
||||||
assert!(!pump.devices.is_empty());
|
|
||||||
for t in &m.targets {
|
|
||||||
for d in &t.devices {
|
|
||||||
let normalised = compliance_core::models::PlcDevice::new(
|
|
||||||
&d.order_number,
|
|
||||||
&d.firmware,
|
|
||||||
d.label.as_deref(),
|
|
||||||
)
|
|
||||||
.expect("a valid controller");
|
|
||||||
assert_eq!(&normalised, d, "{}: store it normalised", t.key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn manifest_is_well_formed() {
|
fn manifest_is_well_formed() {
|
||||||
let m = manifest();
|
let m = manifest();
|
||||||
@@ -619,7 +589,6 @@ mod tests {
|
|||||||
optional: true,
|
optional: true,
|
||||||
}],
|
}],
|
||||||
enabled_scans: Vec::new(),
|
enabled_scans: Vec::new(),
|
||||||
devices: Vec::new(),
|
|
||||||
expect: Expect::default(),
|
expect: Expect::default(),
|
||||||
};
|
};
|
||||||
assert!(t.source_only());
|
assert!(t.source_only());
|
||||||
|
|||||||
@@ -118,72 +118,6 @@ pub struct EntitlementCheck {
|
|||||||
pub expires_at: Option<String>,
|
pub expires_at: Option<String>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
/// The workspace's branding (tenant-registry#155); absent when there is
|
|
||||||
/// nothing to show.
|
|
||||||
#[serde(default)]
|
|
||||||
pub branding: Option<Branding>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A workspace's branding as the registry derived or an admin set it
|
|
||||||
/// (tenant-registry#155): its CI colour, which frames every page, its logo,
|
|
||||||
/// and whether its admins have yet to acknowledge a derived one.
|
|
||||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize, Serialize)]
|
|
||||||
pub struct Branding {
|
|
||||||
/// `#rrggbb`, or null.
|
|
||||||
#[serde(default)]
|
|
||||||
pub color: Option<String>,
|
|
||||||
/// The SHA-256 (hex) of the stored logo, or null when there is none.
|
|
||||||
#[serde(default)]
|
|
||||||
pub logo_etag: Option<String>,
|
|
||||||
/// Whether a derived branding waits for an admin's "Passt".
|
|
||||||
#[serde(default)]
|
|
||||||
pub notice: bool,
|
|
||||||
/// The domain it was derived from; present while `notice` is.
|
|
||||||
#[serde(default)]
|
|
||||||
pub domain: Option<String>,
|
|
||||||
/// The workspace's name, shown beside the logo.
|
|
||||||
#[serde(default)]
|
|
||||||
pub name: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Branding {
|
|
||||||
/// The frame colour as `#rrggbb` in lower case; anything else is no
|
|
||||||
/// frame, so a malformed value can never reach a style.
|
|
||||||
pub fn frame_color(&self) -> Option<String> {
|
|
||||||
let c = self.color.as_deref()?.trim();
|
|
||||||
let hex = c.strip_prefix('#')?;
|
|
||||||
(hex.len() == 6 && hex.bytes().all(|b| b.is_ascii_hexdigit()))
|
|
||||||
.then(|| c.to_ascii_lowercase())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The logo's ETag when it is a SHA-256 in hex; anything else is no logo.
|
|
||||||
pub fn logo_etag(&self) -> Option<&str> {
|
|
||||||
self.logo_etag
|
|
||||||
.as_deref()
|
|
||||||
.filter(|e| e.len() == 64 && e.bytes().all(|b| b.is_ascii_hexdigit()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Why the registry did not record an admin's "Passt".
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
||||||
pub enum AckRefusal {
|
|
||||||
/// The user is no IT admin or owner of the workspace (403 `not_admin`).
|
|
||||||
NotAdmin,
|
|
||||||
/// The registry could not be asked, or answered something else.
|
|
||||||
Failed(String),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The largest logo the agent takes from the registry, which stores 256 px
|
|
||||||
/// PNGs: far below this.
|
|
||||||
const MAX_LOGO_BYTES: usize = 1 << 20;
|
|
||||||
|
|
||||||
/// Whether `tenant_id` may stand in a registry path: the registry's ids are
|
|
||||||
/// UUIDs, so anything else is refused before a request is made.
|
|
||||||
fn path_safe(tenant_id: &str) -> bool {
|
|
||||||
!tenant_id.is_empty()
|
|
||||||
&& tenant_id
|
|
||||||
.bytes()
|
|
||||||
.all(|b| b.is_ascii_alphanumeric() || b == b'-')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EntitlementCheck {
|
impl EntitlementCheck {
|
||||||
@@ -378,9 +312,6 @@ pub struct RegistryClient {
|
|||||||
/// API-key verdicts, valid and invalid, keyed by the key's SHA-256 (never
|
/// API-key verdicts, valid and invalid, keyed by the key's SHA-256 (never
|
||||||
/// the key itself), for [`API_KEY_TTL`].
|
/// the key itself), for [`API_KEY_TTL`].
|
||||||
api_keys: DashMap<String, (Instant, ApiKeyVerify)>,
|
api_keys: DashMap<String, (Instant, ApiKeyVerify)>,
|
||||||
/// Each tenant's logo with its ETag, kept until the registry names
|
|
||||||
/// another (tenant-registry#155).
|
|
||||||
logos: DashMap<String, (String, axum::body::Bytes)>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Debug for RegistryClient {
|
impl std::fmt::Debug for RegistryClient {
|
||||||
@@ -424,7 +355,6 @@ impl RegistryClient {
|
|||||||
cache: DashMap::new(),
|
cache: DashMap::new(),
|
||||||
projects: DashMap::new(),
|
projects: DashMap::new(),
|
||||||
api_keys: DashMap::new(),
|
api_keys: DashMap::new(),
|
||||||
logos: DashMap::new(),
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,113 +476,6 @@ impl RegistryClient {
|
|||||||
Ok(check)
|
Ok(check)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The workspace's logo with the ETag `etag`, as a PNG, or `None` when
|
|
||||||
/// the registry has none. Kept per tenant and asked for again only when
|
|
||||||
/// the registry names another ETag; then with `If-None-Match`, so an
|
|
||||||
/// unchanged logo is not sent twice.
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// When the registry cannot be asked or answers with something other
|
|
||||||
/// than a PNG of at most 1 MiB.
|
|
||||||
pub async fn branding_logo(
|
|
||||||
&self,
|
|
||||||
tenant_id: &str,
|
|
||||||
etag: &str,
|
|
||||||
) -> Result<Option<axum::body::Bytes>, String> {
|
|
||||||
let cached = self
|
|
||||||
.logos
|
|
||||||
.get(tenant_id)
|
|
||||||
.map(|hit| (hit.0.clone(), hit.1.clone()));
|
|
||||||
if let Some((tag, png)) = &cached {
|
|
||||||
if tag == etag {
|
|
||||||
return Ok(Some(png.clone()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !path_safe(tenant_id) {
|
|
||||||
return Err("tenant id not usable in a path".into());
|
|
||||||
}
|
|
||||||
let mut rb = self
|
|
||||||
.request(
|
|
||||||
reqwest::Method::GET,
|
|
||||||
&format!("/v1/tenants/{tenant_id}/branding/logo"),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
if let Some((tag, _)) = &cached {
|
|
||||||
rb = rb.header(reqwest::header::IF_NONE_MATCH, format!("\"{tag}\""));
|
|
||||||
}
|
|
||||||
let resp = rb
|
|
||||||
.send()
|
|
||||||
.await
|
|
||||||
.map_err(|e| format!("logo request failed: {e}"))?;
|
|
||||||
match resp.status() {
|
|
||||||
reqwest::StatusCode::NOT_MODIFIED => Ok(cached.map(|(_, png)| png)),
|
|
||||||
reqwest::StatusCode::NOT_FOUND => {
|
|
||||||
self.logos.remove(tenant_id);
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
status if status.is_success() => {
|
|
||||||
let is_png = resp
|
|
||||||
.headers()
|
|
||||||
.get(reqwest::header::CONTENT_TYPE)
|
|
||||||
.and_then(|v| v.to_str().ok())
|
|
||||||
.is_some_and(|v| v.starts_with("image/png"));
|
|
||||||
if !is_png {
|
|
||||||
return Err("logo is not a PNG".into());
|
|
||||||
}
|
|
||||||
let tag = resp
|
|
||||||
.headers()
|
|
||||||
.get(reqwest::header::ETAG)
|
|
||||||
.and_then(|v| v.to_str().ok())
|
|
||||||
.map(|v| v.trim_start_matches("W/").trim_matches('"').to_string())
|
|
||||||
.unwrap_or_else(|| etag.to_string());
|
|
||||||
let png = resp
|
|
||||||
.bytes()
|
|
||||||
.await
|
|
||||||
.map_err(|e| format!("logo not read: {e}"))?;
|
|
||||||
if png.len() > MAX_LOGO_BYTES {
|
|
||||||
return Err("logo larger than 1 MiB".into());
|
|
||||||
}
|
|
||||||
self.logos.insert(tenant_id.to_string(), (tag, png.clone()));
|
|
||||||
Ok(Some(png))
|
|
||||||
}
|
|
||||||
status => Err(format!("logo request returned {status}")),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Record an admin's "Passt" on the workspace's derived branding
|
|
||||||
/// (`POST /v1/tenants/{id}/branding/ack`) and drop the cached entitlement
|
|
||||||
/// answers, so the notice goes with the next check.
|
|
||||||
///
|
|
||||||
/// # Errors
|
|
||||||
///
|
|
||||||
/// [`AckRefusal::NotAdmin`] when the registry does not count `user_id` as
|
|
||||||
/// an IT admin or owner of the tenant; [`AckRefusal::Failed`] otherwise.
|
|
||||||
pub async fn ack_branding(&self, tenant_id: &str, user_id: &str) -> Result<(), AckRefusal> {
|
|
||||||
if !path_safe(tenant_id) {
|
|
||||||
return Err(AckRefusal::Failed("tenant id not usable in a path".into()));
|
|
||||||
}
|
|
||||||
let resp = self
|
|
||||||
.request(
|
|
||||||
reqwest::Method::POST,
|
|
||||||
&format!("/v1/tenants/{tenant_id}/branding/ack"),
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
.map_err(AckRefusal::Failed)?
|
|
||||||
.json(&serde_json::json!({ "user_id": user_id }))
|
|
||||||
.send()
|
|
||||||
.await
|
|
||||||
.map_err(|e| AckRefusal::Failed(format!("ack failed: {e}")))?;
|
|
||||||
match resp.status() {
|
|
||||||
status if status.is_success() => {
|
|
||||||
self.invalidate(tenant_id);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
reqwest::StatusCode::FORBIDDEN => Err(AckRefusal::NotAdmin),
|
|
||||||
status => Err(AckRefusal::Failed(format!("ack returned {status}"))),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Drop the cached answer for a tenant (after a platform lifecycle call).
|
/// Drop the cached answer for a tenant (after a platform lifecycle call).
|
||||||
pub fn invalidate(&self, tenant_id: &str) {
|
pub fn invalidate(&self, tenant_id: &str) {
|
||||||
self.cache
|
self.cache
|
||||||
@@ -1140,7 +963,6 @@ mod tests {
|
|||||||
cache: DashMap::new(),
|
cache: DashMap::new(),
|
||||||
projects: DashMap::new(),
|
projects: DashMap::new(),
|
||||||
api_keys: DashMap::new(),
|
api_keys: DashMap::new(),
|
||||||
logos: DashMap::new(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let started = Instant::now();
|
let started = Instant::now();
|
||||||
@@ -1197,7 +1019,6 @@ mod tests {
|
|||||||
cache: DashMap::new(),
|
cache: DashMap::new(),
|
||||||
projects: DashMap::new(),
|
projects: DashMap::new(),
|
||||||
api_keys: DashMap::new(),
|
api_keys: DashMap::new(),
|
||||||
logos: DashMap::new(),
|
|
||||||
};
|
};
|
||||||
(client, calls, down)
|
(client, calls, down)
|
||||||
}
|
}
|
||||||
@@ -1268,106 +1089,4 @@ mod tests {
|
|||||||
assert!(client.api_keys.contains_key(&key_digest("bp_good")));
|
assert!(client.api_keys.contains_key(&key_digest("bp_good")));
|
||||||
assert!(client.api_keys.iter().all(|e| !e.key().contains("bp_")));
|
assert!(client.api_keys.iter().all(|e| !e.key().contains("bp_")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A registry with one tenant's logo (ETag `"aa…"`, honouring
|
|
||||||
/// If-None-Match) and an ack endpoint that takes only `u-admin`; the
|
|
||||||
/// number of logo bodies it sent is counted.
|
|
||||||
async fn branding_registry() -> (RegistryClient, Arc<std::sync::atomic::AtomicUsize>) {
|
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
|
||||||
let sent = Arc::new(AtomicUsize::new(0));
|
|
||||||
let s = sent.clone();
|
|
||||||
let tag = "a".repeat(64);
|
|
||||||
let quoted = format!("\"{tag}\"");
|
|
||||||
let app = axum::Router::new()
|
|
||||||
.route(
|
|
||||||
"/v1/tenants/{id}/branding/logo",
|
|
||||||
axum::routing::get(
|
|
||||||
move |axum::extract::Path(id): axum::extract::Path<String>,
|
|
||||||
headers: axum::http::HeaderMap| {
|
|
||||||
let (s, quoted) = (s.clone(), quoted.clone());
|
|
||||||
async move {
|
|
||||||
use axum::response::IntoResponse;
|
|
||||||
if id != "t-1" {
|
|
||||||
return axum::http::StatusCode::NOT_FOUND.into_response();
|
|
||||||
}
|
|
||||||
if headers.get("if-none-match").and_then(|v| v.to_str().ok())
|
|
||||||
== Some(quoted.as_str())
|
|
||||||
{
|
|
||||||
return axum::http::StatusCode::NOT_MODIFIED.into_response();
|
|
||||||
}
|
|
||||||
s.fetch_add(1, Ordering::SeqCst);
|
|
||||||
(
|
|
||||||
[("content-type", "image/png"), ("etag", quoted.as_str())],
|
|
||||||
b"\x89PNG fake".to_vec(),
|
|
||||||
)
|
|
||||||
.into_response()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.route(
|
|
||||||
"/v1/tenants/{id}/branding/ack",
|
|
||||||
axum::routing::post(
|
|
||||||
|axum::Json(body): axum::Json<serde_json::Value>| async move {
|
|
||||||
if body["user_id"] == "u-admin" {
|
|
||||||
axum::http::StatusCode::NO_CONTENT
|
|
||||||
} else {
|
|
||||||
axum::http::StatusCode::FORBIDDEN
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
|
|
||||||
let addr = listener.local_addr().unwrap();
|
|
||||||
tokio::spawn(async move { axum::serve(listener, app).await.unwrap() });
|
|
||||||
let client = RegistryClient {
|
|
||||||
base_url: format!("http://{addr}"),
|
|
||||||
product: "pruefwerk".into(),
|
|
||||||
http: reqwest::Client::new(),
|
|
||||||
token_url: None,
|
|
||||||
client_id: None,
|
|
||||||
client_secret: None,
|
|
||||||
token: Mutex::new(None),
|
|
||||||
cache: DashMap::new(),
|
|
||||||
projects: DashMap::new(),
|
|
||||||
api_keys: DashMap::new(),
|
|
||||||
logos: DashMap::new(),
|
|
||||||
};
|
|
||||||
(client, sent)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn a_logo_is_fetched_once_per_etag_and_none_is_none() {
|
|
||||||
use std::sync::atomic::Ordering;
|
|
||||||
// Arrange
|
|
||||||
let (client, sent) = branding_registry().await;
|
|
||||||
let tag = "a".repeat(64);
|
|
||||||
|
|
||||||
// Act: twice with the same ETag, then with another one.
|
|
||||||
let first = client.branding_logo("t-1", &tag).await.unwrap();
|
|
||||||
let again = client.branding_logo("t-1", &tag).await.unwrap();
|
|
||||||
let other = client.branding_logo("t-1", &"b".repeat(64)).await.unwrap();
|
|
||||||
|
|
||||||
// Assert: one body sent; the other ETag was answered 304 from the
|
|
||||||
// cached PNG; a tenant without a logo has none.
|
|
||||||
assert_eq!(first.as_deref(), Some(&b"\x89PNG fake"[..]));
|
|
||||||
assert_eq!(again, first);
|
|
||||||
assert_eq!(other, first);
|
|
||||||
assert_eq!(sent.load(Ordering::SeqCst), 1);
|
|
||||||
assert_eq!(client.branding_logo("t-2", &tag).await.unwrap(), None);
|
|
||||||
assert!(
|
|
||||||
client.branding_logo("../x", &tag).await.is_err(),
|
|
||||||
"no path from an id"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn only_an_admin_the_registry_knows_acknowledges() {
|
|
||||||
let (client, _) = branding_registry().await;
|
|
||||||
assert_eq!(client.ack_branding("t-1", "u-admin").await, Ok(()));
|
|
||||||
assert_eq!(
|
|
||||||
client.ack_branding("t-1", "u-member").await,
|
|
||||||
Err(AckRefusal::NotAdmin)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -285,7 +285,6 @@ async fn seed_nightly(
|
|||||||
"target_type": t.target_type,
|
"target_type": t.target_type,
|
||||||
"description": t.description,
|
"description": t.description,
|
||||||
"artifacts": references,
|
"artifacts": references,
|
||||||
"devices": t.devices,
|
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|||||||
@@ -369,100 +369,6 @@ code {
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The workspace's branding (tenant-registry#155): its CI colour frames every
|
|
||||||
page and its logo stands in for the wordmark. The frame never takes a
|
|
||||||
click, and our own colours (accent, severities) never change with it. */
|
|
||||||
.brand-frame {
|
|
||||||
position: fixed;
|
|
||||||
inset: 0;
|
|
||||||
border: 6px solid var(--brand-frame);
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 80;
|
|
||||||
}
|
|
||||||
|
|
||||||
.customer-logo,
|
|
||||||
.customer-initials {
|
|
||||||
width: 28px;
|
|
||||||
height: 28px;
|
|
||||||
border-radius: var(--radius);
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.customer-logo {
|
|
||||||
object-fit: contain;
|
|
||||||
}
|
|
||||||
|
|
||||||
.customer-initials {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background: var(--brand-frame, var(--bg-elevated));
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.brand-name.customer-name {
|
|
||||||
font-weight: 600;
|
|
||||||
letter-spacing: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.brand-credit {
|
|
||||||
padding: 8px 14px 0;
|
|
||||||
font-size: 11px;
|
|
||||||
color: var(--text-tertiary);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.branding-notice {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px 16px;
|
|
||||||
padding: 12px 16px;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
/* Clear of the notification bell, fixed at the top right. */
|
|
||||||
margin-right: 56px;
|
|
||||||
border-radius: var(--radius-lg);
|
|
||||||
background: var(--bg-card);
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
/* The bell sits in the top bar there. */
|
|
||||||
.branding-notice {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.branding-notice .customer-logo,
|
|
||||||
.branding-notice .customer-initials {
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.branding-notice-text {
|
|
||||||
flex: 1 1 280px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 2px;
|
|
||||||
font-size: 13px;
|
|
||||||
color: var(--text-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.branding-notice-text strong {
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--text-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.branding-notice-actions {
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar-nav {
|
.sidebar-nav {
|
||||||
padding: 8px 8px 16px;
|
padding: 8px 8px 16px;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
use crate::app::Route;
|
use crate::app::Route;
|
||||||
use crate::components::branding::BrandingNotice;
|
|
||||||
use crate::components::help_chat::HelpChat;
|
use crate::components::help_chat::HelpChat;
|
||||||
use crate::components::no_access::{NoAccess, ReadOnlyBanner};
|
use crate::components::no_access::{NoAccess, ReadOnlyBanner};
|
||||||
use crate::components::notification_bell::NotificationBell;
|
use crate::components::notification_bell::NotificationBell;
|
||||||
@@ -26,13 +25,8 @@ pub fn AppShell() -> Element {
|
|||||||
// then takes it away; an unreachable agent reads as the full set.
|
// then takes it away; an unreachable agent reads as the full set.
|
||||||
let platform = use_server_future(fetch_platform_info)?;
|
let platform = use_server_future(fetch_platform_info)?;
|
||||||
let auth = use_server_future(check_auth)?;
|
let auth = use_server_future(check_auth)?;
|
||||||
// The workspace's branding (tenant-registry#155), read with the page so
|
|
||||||
// the frame never appears a moment late; none when it cannot be read.
|
|
||||||
let branding = use_server_future(crate::infrastructure::branding::fetch_branding)?;
|
|
||||||
let platform_now = platform().and_then(Result::ok).unwrap_or_default();
|
let platform_now = platform().and_then(Result::ok).unwrap_or_default();
|
||||||
use_context_provider(|| Signal::new(platform_now));
|
use_context_provider(|| Signal::new(platform_now));
|
||||||
let branding_now = branding().and_then(Result::ok).unwrap_or_default();
|
|
||||||
use_context_provider(|| Signal::new(branding_now.clone()));
|
|
||||||
// A sign-in can run out while a page stays open: check now and then, and
|
// A sign-in can run out while a page stays open: check now and then, and
|
||||||
// send the browser to the login rather than letting every page fail.
|
// send the browser to the login rather than letting every page fail.
|
||||||
use_future(move || async move {
|
use_future(move || async move {
|
||||||
@@ -74,19 +68,8 @@ pub fn AppShell() -> Element {
|
|||||||
Some(Ok(info)) if info.authenticated => {
|
Some(Ok(info)) if info.authenticated => {
|
||||||
use_context_provider(|| Signal::new(info.clone()));
|
use_context_provider(|| Signal::new(info.clone()));
|
||||||
let read_only = !info.access.can_write();
|
let read_only = !info.access.can_write();
|
||||||
let shell_class = if branding_now.framed() {
|
|
||||||
"app-shell branded"
|
|
||||||
} else {
|
|
||||||
"app-shell"
|
|
||||||
};
|
|
||||||
let frame_style = branding_now.frame_style();
|
|
||||||
rsx! {
|
rsx! {
|
||||||
div { class: "{shell_class}", style: "{frame_style}",
|
div { class: "app-shell",
|
||||||
// The workspace's CI colour around every page; it never
|
|
||||||
// takes a click.
|
|
||||||
if branding_now.framed() {
|
|
||||||
div { class: "brand-frame", "aria-hidden": "true" }
|
|
||||||
}
|
|
||||||
Sidebar {}
|
Sidebar {}
|
||||||
main { class: "main-content",
|
main { class: "main-content",
|
||||||
if let Some(tenant) = info.support_tenant.clone() {
|
if let Some(tenant) = info.support_tenant.clone() {
|
||||||
@@ -95,7 +78,6 @@ pub fn AppShell() -> Element {
|
|||||||
if read_only {
|
if read_only {
|
||||||
ReadOnlyBanner {}
|
ReadOnlyBanner {}
|
||||||
}
|
}
|
||||||
BrandingNotice {}
|
|
||||||
Outlet::<Route> {}
|
Outlet::<Route> {}
|
||||||
}
|
}
|
||||||
NotificationBell {}
|
NotificationBell {}
|
||||||
|
|||||||
@@ -1,95 +0,0 @@
|
|||||||
//! The workspace's branding in the app (tenant-registry#155): its mark in the
|
|
||||||
//! sidebar and the one-time notice for its admins. The frame itself is the
|
|
||||||
//! app shell's.
|
|
||||||
|
|
||||||
use dioxus::prelude::*;
|
|
||||||
|
|
||||||
use crate::i18n::texts::branding as tx;
|
|
||||||
use crate::i18n::use_lang;
|
|
||||||
use crate::infrastructure::branding::{ack_branding, Branding, LOGO_URL};
|
|
||||||
use compliance_core::models::AuthInfo;
|
|
||||||
|
|
||||||
/// The workspace's branding, provided by the app shell; none outside it.
|
|
||||||
pub fn use_branding() -> Branding {
|
|
||||||
try_use_context::<Signal<Branding>>()
|
|
||||||
.map(|b| b.read().clone())
|
|
||||||
.unwrap_or_default()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The workspace in the sidebar: its logo, or its initials on its CI colour,
|
|
||||||
/// and unless `with_name` is off its name with "Prüfwerk" beneath.
|
|
||||||
#[component]
|
|
||||||
pub fn CustomerMark(branding: Branding, with_name: bool) -> Element {
|
|
||||||
let lang = use_lang()();
|
|
||||||
let initials = branding.initials();
|
|
||||||
let ink = branding.ink();
|
|
||||||
let name = branding.name.clone().unwrap_or_default();
|
|
||||||
rsx! {
|
|
||||||
if branding.logo {
|
|
||||||
img { class: "customer-logo", src: LOGO_URL, alt: "" }
|
|
||||||
} else {
|
|
||||||
span {
|
|
||||||
class: "customer-initials",
|
|
||||||
style: "color: {ink};",
|
|
||||||
"aria-hidden": "true",
|
|
||||||
"{initials}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if with_name {
|
|
||||||
div { class: "brand-text",
|
|
||||||
if name.is_empty() {
|
|
||||||
span { class: "brand-name", {tx::PRODUCT.get(lang)} }
|
|
||||||
} else {
|
|
||||||
span { class: "brand-name customer-name", "{name}" }
|
|
||||||
span { class: "brand-sub", {tx::PRODUCT.get(lang)} }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// "Logo und Farbe von <domain> übernommen", for the workspace's admins only
|
|
||||||
/// (the agent sends `notice` to no one else), until one of them says "Passt".
|
|
||||||
/// "Passt" hides it at once; the registry records it in the background.
|
|
||||||
#[component]
|
|
||||||
pub fn BrandingNotice() -> Element {
|
|
||||||
let lang = use_lang()();
|
|
||||||
let branding = use_branding();
|
|
||||||
let mut hidden = use_signal(|| false);
|
|
||||||
let portal_url = try_use_context::<Signal<AuthInfo>>()
|
|
||||||
.map(|a| a.read().portal_url.clone())
|
|
||||||
.unwrap_or_default();
|
|
||||||
let Some(domain) = branding.domain.clone().filter(|_| branding.notice) else {
|
|
||||||
return rsx! {};
|
|
||||||
};
|
|
||||||
if hidden() {
|
|
||||||
return rsx! {};
|
|
||||||
}
|
|
||||||
rsx! {
|
|
||||||
div { class: "branding-notice", role: "status",
|
|
||||||
CustomerMark { branding: branding.clone(), with_name: false }
|
|
||||||
div { class: "branding-notice-text",
|
|
||||||
strong { {tx::notice_title(&domain, lang)} }
|
|
||||||
span { {tx::NOTICE_BODY.get(lang)} }
|
|
||||||
}
|
|
||||||
div { class: "branding-notice-actions",
|
|
||||||
button {
|
|
||||||
r#type: "button",
|
|
||||||
class: "btn btn-primary",
|
|
||||||
onclick: move |_| {
|
|
||||||
hidden.set(true);
|
|
||||||
spawn(async move {
|
|
||||||
if let Err(e) = ack_branding().await {
|
|
||||||
tracing::warn!("branding ack failed: {e}");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
{tx::OK.get(lang)}
|
|
||||||
}
|
|
||||||
if !portal_url.is_empty() {
|
|
||||||
a { class: "btn btn-secondary", href: "{portal_url}", {tx::CHANGE.get(lang)} }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,6 @@ pub mod app_shell;
|
|||||||
pub mod artifact_upload;
|
pub mod artifact_upload;
|
||||||
pub mod attack_chain;
|
pub mod attack_chain;
|
||||||
pub mod billing_swap;
|
pub mod billing_swap;
|
||||||
pub mod branding;
|
|
||||||
pub mod code_inspector;
|
pub mod code_inspector;
|
||||||
pub mod code_snippet;
|
pub mod code_snippet;
|
||||||
pub mod component_overview;
|
pub mod component_overview;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ use dioxus_free_icons::icons::bs_icons::*;
|
|||||||
use dioxus_free_icons::Icon;
|
use dioxus_free_icons::Icon;
|
||||||
|
|
||||||
use crate::app::Route;
|
use crate::app::Route;
|
||||||
use crate::components::branding::{use_branding, CustomerMark};
|
|
||||||
use crate::components::lang_toggle::LangToggle;
|
use crate::components::lang_toggle::LangToggle;
|
||||||
use crate::components::no_access::use_can_write;
|
use crate::components::no_access::use_can_write;
|
||||||
use crate::components::theme_toggle::ThemeToggle;
|
use crate::components::theme_toggle::ThemeToggle;
|
||||||
@@ -40,7 +39,6 @@ pub fn Sidebar() -> Element {
|
|||||||
let mut collapsed = use_signal(|| false);
|
let mut collapsed = use_signal(|| false);
|
||||||
let source_only = use_source_only();
|
let source_only = use_source_only();
|
||||||
let lang = use_lang()();
|
let lang = use_lang()();
|
||||||
let branding = use_branding();
|
|
||||||
|
|
||||||
let can_write = use_can_write();
|
let can_write = use_can_write();
|
||||||
// Open supplier offers, counted on "Prüfobjekte" (#1028).
|
// Open supplier offers, counted on "Prüfobjekte" (#1028).
|
||||||
@@ -154,13 +152,7 @@ pub fn Sidebar() -> Element {
|
|||||||
Icon { icon: BsList, width: 20, height: 20 }
|
Icon { icon: BsList, width: 20, height: 20 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
div { class: "mobile-bar-brand",
|
div { class: "mobile-bar-brand", Wordmark { with_name: true } }
|
||||||
if branding.branded() {
|
|
||||||
CustomerMark { branding: branding.clone(), with_name: true }
|
|
||||||
} else {
|
|
||||||
Wordmark { with_name: true }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if mobile_open() {
|
if mobile_open() {
|
||||||
div { class: "mobile-backdrop", onclick: move |_| mobile_open.set(false) }
|
div { class: "mobile-backdrop", onclick: move |_| mobile_open.set(false) }
|
||||||
@@ -169,11 +161,7 @@ pub fn Sidebar() -> Element {
|
|||||||
// The breakpilot brand, as the portal shows it; Prüfwerk is the
|
// The breakpilot brand, as the portal shows it; Prüfwerk is the
|
||||||
// product within it.
|
// product within it.
|
||||||
div { class: "sidebar-header",
|
div { class: "sidebar-header",
|
||||||
if branding.branded() {
|
Wordmark { with_name: !collapsed() }
|
||||||
CustomerMark { branding: branding.clone(), with_name: !collapsed() }
|
|
||||||
} else {
|
|
||||||
Wordmark { with_name: !collapsed() }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if !portal_url.is_empty() {
|
if !portal_url.is_empty() {
|
||||||
a {
|
a {
|
||||||
@@ -308,9 +296,6 @@ pub fn Sidebar() -> Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !collapsed() && branding.branded() {
|
|
||||||
div { class: "brand-credit", {crate::i18n::texts::branding::CREDIT.get(lang)} }
|
|
||||||
}
|
|
||||||
if !collapsed() {
|
if !collapsed() {
|
||||||
div { class: "sidebar-legal",
|
div { class: "sidebar-legal",
|
||||||
a { href: PRIVACY_URL, target: "_blank", rel: "noopener", {nav::PRIVACY.get(lang)} }
|
a { href: PRIVACY_URL, target: "_blank", rel: "noopener", {nav::PRIVACY.get(lang)} }
|
||||||
|
|||||||
@@ -9205,45 +9205,3 @@ pub mod devices {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The workspace's branding (tenant-registry#155): the sidebar's credit line
|
|
||||||
/// and the one-time notice for its admins.
|
|
||||||
pub mod branding {
|
|
||||||
use super::Text;
|
|
||||||
use crate::i18n::Lang;
|
|
||||||
|
|
||||||
/// Under the workspace's name in the sidebar.
|
|
||||||
pub const PRODUCT: Text = Text {
|
|
||||||
de: "Prüfwerk",
|
|
||||||
en: "Prüfwerk",
|
|
||||||
};
|
|
||||||
/// At the foot of a branded sidebar: whose product it is.
|
|
||||||
pub const CREDIT: Text = Text {
|
|
||||||
de: "Prüfwerk von Breakpilot",
|
|
||||||
en: "Prüfwerk by Breakpilot",
|
|
||||||
};
|
|
||||||
/// Who sees the notice, and where to change the branding.
|
|
||||||
pub const NOTICE_BODY: Text = Text {
|
|
||||||
de: "Nur Administrator:innen sehen diesen Hinweis. Ändern können Sie beides im Portal \
|
|
||||||
unter Erscheinungsbild.",
|
|
||||||
en: "Only admins see this notice. You can change both in the portal under Appearance.",
|
|
||||||
};
|
|
||||||
/// Acknowledges the branding.
|
|
||||||
pub const OK: Text = Text {
|
|
||||||
de: "Passt",
|
|
||||||
en: "Looks right",
|
|
||||||
};
|
|
||||||
/// Opens the portal to change it.
|
|
||||||
pub const CHANGE: Text = Text {
|
|
||||||
de: "Ändern",
|
|
||||||
en: "Change",
|
|
||||||
};
|
|
||||||
|
|
||||||
/// The notice's title: where logo and colour were taken from.
|
|
||||||
pub fn notice_title(domain: &str, lang: Lang) -> String {
|
|
||||||
match lang {
|
|
||||||
Lang::De => format!("Logo und Farbe von {domain} übernommen"),
|
|
||||||
Lang::En => format!("Logo and colour taken from {domain}"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,195 +0,0 @@
|
|||||||
//! The workspace's branding (tenant-registry#155): its CI colour framing
|
|
||||||
//! every page, its logo in the sidebar, and the one-time notice for its
|
|
||||||
//! admins. Proxies the agent's `/api/v1/branding*`.
|
|
||||||
|
|
||||||
use dioxus::prelude::*;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
/// The branding as the agent reports it; all empty means none.
|
|
||||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
|
|
||||||
pub struct Branding {
|
|
||||||
/// The frame colour, `#rrggbb`; none means no frame.
|
|
||||||
#[serde(default)]
|
|
||||||
pub color: Option<String>,
|
|
||||||
/// Whether [`LOGO_URL`] has a logo.
|
|
||||||
#[serde(default)]
|
|
||||||
pub logo: bool,
|
|
||||||
/// The workspace's name, beside the logo.
|
|
||||||
#[serde(default)]
|
|
||||||
pub name: Option<String>,
|
|
||||||
/// Whether to show this admin the notice.
|
|
||||||
#[serde(default)]
|
|
||||||
pub notice: bool,
|
|
||||||
/// The domain the branding was taken from.
|
|
||||||
#[serde(default)]
|
|
||||||
pub domain: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Branding {
|
|
||||||
/// The inline style that sets the frame colour, or empty without one.
|
|
||||||
/// Only a `#rrggbb` value ever reaches it, whatever the agent sent.
|
|
||||||
pub fn frame_style(&self) -> String {
|
|
||||||
match self.color.as_deref() {
|
|
||||||
Some(c) if is_hex_colour(c) => format!("--brand-frame: {c};"),
|
|
||||||
_ => String::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Whether the sidebar shows the workspace instead of the Breakpilot
|
|
||||||
/// wordmark: it has a colour or a logo.
|
|
||||||
pub fn branded(&self) -> bool {
|
|
||||||
self.framed() || self.logo
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The text colour on the CI colour: white or Breakpilot ink, whichever
|
|
||||||
/// reads better.
|
|
||||||
pub fn ink(&self) -> &'static str {
|
|
||||||
let Some(hex) = self.color.as_deref().filter(|c| is_hex_colour(c)) else {
|
|
||||||
return "#FFFFFF";
|
|
||||||
};
|
|
||||||
let channel = |i: usize| {
|
|
||||||
let v = f64::from(u8::from_str_radix(&hex[i..i + 2], 16).unwrap_or(0)) / 255.0;
|
|
||||||
if v <= 0.039_28 {
|
|
||||||
v / 12.92
|
|
||||||
} else {
|
|
||||||
((v + 0.055) / 1.055).powf(2.4)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let lum = 0.2126 * channel(1) + 0.7152 * channel(3) + 0.0722 * channel(5);
|
|
||||||
// Contrast with white is 1.05 / (L + 0.05); with ink (#14162B,
|
|
||||||
// L about 0.0085) it is (L + 0.05) / 0.0585.
|
|
||||||
if 1.05 / (lum + 0.05) >= (lum + 0.05) / 0.0585 {
|
|
||||||
"#FFFFFF"
|
|
||||||
} else {
|
|
||||||
"#14162B"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Whether the frame is drawn.
|
|
||||||
pub fn framed(&self) -> bool {
|
|
||||||
self.color.as_deref().is_some_and(is_hex_colour)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The initials shown instead of a logo: the first letters of the first
|
|
||||||
/// two words of the name, or none without a name.
|
|
||||||
pub fn initials(&self) -> String {
|
|
||||||
self.name
|
|
||||||
.as_deref()
|
|
||||||
.unwrap_or_default()
|
|
||||||
.split_whitespace()
|
|
||||||
.filter_map(|w| w.chars().find(|c| c.is_alphanumeric()))
|
|
||||||
.take(2)
|
|
||||||
.flat_map(char::to_uppercase)
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `#rrggbb`.
|
|
||||||
fn is_hex_colour(c: &str) -> bool {
|
|
||||||
c.strip_prefix('#')
|
|
||||||
.is_some_and(|h| h.len() == 6 && h.bytes().all(|b| b.is_ascii_hexdigit()))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Where the browser loads the workspace's logo.
|
|
||||||
pub const LOGO_URL: &str = "/api/branding/logo";
|
|
||||||
|
|
||||||
/// The agent's answer, read on the server only.
|
|
||||||
#[cfg(feature = "server")]
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
|
||||||
struct BrandingResponse {
|
|
||||||
data: Branding,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The workspace's branding; none when the agent cannot say.
|
|
||||||
#[server]
|
|
||||||
pub async fn fetch_branding() -> Result<Branding, ServerFnError> {
|
|
||||||
let resp = super::agent_client::agent_get("/api/v1/branding")
|
|
||||||
.await?
|
|
||||||
.send()
|
|
||||||
.await
|
|
||||||
.map_err(|e| ServerFnError::new(e.to_string()))?;
|
|
||||||
let answer: BrandingResponse = super::agent_client::json_or_error(resp).await?;
|
|
||||||
Ok(answer.data)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `GET /api/branding/logo`: the workspace's logo, a PNG.
|
|
||||||
#[get("/api/branding/logo")]
|
|
||||||
pub async fn branding_logo() -> Result<dioxus::fullstack::FileStream, ServerFnError> {
|
|
||||||
let resp = super::agent_client::agent_get("/api/v1/branding/logo")
|
|
||||||
.await?
|
|
||||||
.send()
|
|
||||||
.await
|
|
||||||
.map_err(|e| ServerFnError::new(e.to_string()))?;
|
|
||||||
let resp = super::agent_client::ok_response(resp).await?;
|
|
||||||
let size = resp.content_length();
|
|
||||||
let body = axum::body::Body::from_stream(resp.bytes_stream()).into_data_stream();
|
|
||||||
Ok(dioxus::fullstack::FileStream::from_raw(
|
|
||||||
"logo.png".to_string(),
|
|
||||||
size,
|
|
||||||
"image/png".to_string(),
|
|
||||||
body,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Record an admin's "Passt" on the branding taken from the website.
|
|
||||||
#[server]
|
|
||||||
pub async fn ack_branding() -> Result<(), ServerFnError> {
|
|
||||||
let resp = super::agent_client::agent_request(reqwest::Method::POST, "/api/v1/branding/ack")
|
|
||||||
.await?
|
|
||||||
.send()
|
|
||||||
.await
|
|
||||||
.map_err(|e| ServerFnError::new(e.to_string()))?;
|
|
||||||
super::agent_client::ok_response(resp).await?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn only_a_hex_colour_draws_a_frame() {
|
|
||||||
for (color, framed) in [
|
|
||||||
("#14b8a6", true),
|
|
||||||
("#C8102E", true),
|
|
||||||
("red", false),
|
|
||||||
("#12345", false),
|
|
||||||
("#14b8a6; background: url(x)", false),
|
|
||||||
] {
|
|
||||||
let b = Branding {
|
|
||||||
color: Some(color.into()),
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
assert_eq!(b.framed(), framed, "{color}");
|
|
||||||
assert_eq!(b.frame_style().is_empty(), !framed, "{color}");
|
|
||||||
}
|
|
||||||
assert!(!Branding::default().framed());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn the_initials_read_on_the_ci_colour() {
|
|
||||||
let on = |c: &str| {
|
|
||||||
Branding {
|
|
||||||
color: Some(c.into()),
|
|
||||||
..Default::default()
|
|
||||||
}
|
|
||||||
.ink()
|
|
||||||
};
|
|
||||||
assert_eq!(on("#C8102E"), "#FFFFFF");
|
|
||||||
assert_eq!(on("#1F3A5F"), "#FFFFFF");
|
|
||||||
assert_eq!(on("#F5B700"), "#14162B");
|
|
||||||
assert_eq!(on("#14B8A6"), "#14162B");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn initials_come_from_the_first_two_words() {
|
|
||||||
let named = |n: &str| Branding {
|
|
||||||
name: Some(n.into()),
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
assert_eq!(named("Musterwerk GmbH").initials(), "MG");
|
|
||||||
assert_eq!(named("nordachse").initials(), "N");
|
|
||||||
assert_eq!(named(" (Lindtal) Werke AG").initials(), "LW");
|
|
||||||
assert_eq!(Branding::default().initials(), "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
// Server function modules (compiled for both web and server;
|
// Server function modules (compiled for both web and server;
|
||||||
// the #[server] macro generates client stubs for the web target)
|
// the #[server] macro generates client stubs for the web target)
|
||||||
pub mod auth_check;
|
pub mod auth_check;
|
||||||
pub mod branding;
|
|
||||||
pub mod chat;
|
pub mod chat;
|
||||||
pub mod cve_history;
|
pub mod cve_history;
|
||||||
pub mod cve_matrix;
|
pub mod cve_matrix;
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ What Prüfwerk keeps about a target, where, and when it is removed.
|
|||||||
|
|
||||||
Deleting a target (`DELETE /api/v1/targets/{id}`, or **Delete** on the
|
Deleting a target (`DELETE /api/v1/targets/{id}`, or **Delete** on the
|
||||||
targets page) removes its records and its files. Erasing a tenant
|
targets page) removes its records and its files. Erasing a tenant
|
||||||
(`DELETE /api/v1/platform/tenants/{id}/data` with `{"confirm": "<tenant id>"}`,
|
(`DELETE /api/v1/platform/tenants/{id}/data`, confirmed) drops its database
|
||||||
the same id as in the path) drops its database
|
|
||||||
and removes every file listed above; the response says how many paths were
|
and removes every file listed above; the response says how many paths were
|
||||||
removed and how many could not be. Only paths inside the two configured base
|
removed and how many could not be. Only paths inside the two configured base
|
||||||
directories are ever removed.
|
directories are ever removed.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"key": "plc-pump-station",
|
"key": "plc-pump-station",
|
||||||
"name": "PLC pump station (ST + FBD, composite)",
|
"name": "PLC pump station (ST + FBD, composite)",
|
||||||
"target_type": "plc_sps",
|
"target_type": "plc_sps",
|
||||||
"description": "Composite PlcSps demo: Structured Text + FBD-as-PLCopen-XML control logic, plus an optional live Modbus endpoint (in-cluster plc-sim) and an optional device firmware image. Runs on a Siemens S7-1500 CPU with an old firmware, so its SBOM lists the controller and Siemens' advisories match it. Exercises PLC SAST, ICS probe, semantic control mapping, Siemens advisory matching.",
|
"description": "Composite PlcSps demo: Structured Text + FBD-as-PLCopen-XML control logic, plus an optional live Modbus endpoint (in-cluster plc-sim) and an optional device firmware image. Exercises PLC SAST, ICS probe, semantic control mapping.",
|
||||||
"artifacts": [
|
"artifacts": [
|
||||||
{
|
{
|
||||||
"kind": "plc_project",
|
"kind": "plc_project",
|
||||||
@@ -30,13 +30,6 @@
|
|||||||
"optional": true
|
"optional": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"devices": [
|
|
||||||
{
|
|
||||||
"order_number": "6ES7511-1AK02-0AB0",
|
|
||||||
"firmware": "2.9.4",
|
|
||||||
"label": "Pump station CPU"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"expect": {
|
"expect": {
|
||||||
"min_findings": 16,
|
"min_findings": 16,
|
||||||
"sast_rule_ids": [
|
"sast_rule_ids": [
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"scan_status": "completed",
|
"scan_status": "completed",
|
||||||
"skipped_stages": [],
|
"skipped_stages": [],
|
||||||
"sbom": [
|
"sbom": [],
|
||||||
"siemens-device:6ES7511-1AK02-0AB0@2.9.4"
|
|
||||||
],
|
|
||||||
"findings": [
|
"findings": [
|
||||||
"plc-control-logic:plc-array-unchecked-index pump_station.st:29",
|
"plc-control-logic:plc-array-unchecked-index pump_station.st:29",
|
||||||
"plc-control-logic:plc-default-password pump_fbd.xml:8",
|
"plc-control-logic:plc-default-password pump_fbd.xml:8",
|
||||||
|
|||||||
Reference in new issue
Block a user