diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c92433ad20..b834ac713a 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -99,7 +99,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true build-args: | - features=enterprise + features=enterprise,saml nsjail=true tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ee:latest diff --git a/backend/Cargo.lock b/backend/Cargo.lock index c3d22f9c42..2cf06f88c7 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -1119,11 +1119,11 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.65.1" +version = "0.69.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" +checksum = "9ffcebc3849946a7170a05992aac39da343a90676ab392c51a4280981d6379c2" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", "cexpr", "clang-sys", "lazy_static", @@ -1140,26 +1140,6 @@ dependencies = [ "which", ] -[[package]] -name = "bindgen" -version = "0.69.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ffcebc3849946a7170a05992aac39da343a90676ab392c51a4280981d6379c2" -dependencies = [ - "bitflags 2.4.1", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.39", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -4408,7 +4388,7 @@ checksum = "06f19e4cfa0ab5a76b627cec2d81331c49b034988eaf302c3bafeada684eadef" dependencies = [ "base64 0.21.5", "bigdecimal 0.4.2", - "bindgen 0.69.1", + "bindgen", "bitflags 2.4.1", "bitvec", "btoi", @@ -5851,9 +5831,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.28.2" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" +checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" dependencies = [ "memchr", "serde", @@ -6598,12 +6578,12 @@ dependencies = [ [[package]] name = "samael" -version = "0.0.12" +version = "0.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7af1a6bbd2d98a207abf060c0734b0b9eb8a2a679008bf7bb5296c8876e27958" +checksum = "b75583aad4a51c50fc0af69c230d18078c9d5a69a98d0f6013d01053acf744f4" dependencies = [ "base64 0.21.5", - "bindgen 0.65.1", + "bindgen", "chrono", "data-encoding", "derive_builder", @@ -6615,7 +6595,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "pkg-config", - "quick-xml 0.28.2", + "quick-xml 0.30.0", "rand 0.8.5", "serde", "thiserror", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index ba2d5a98bf..cac6063ea5 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -35,6 +35,7 @@ incremental = true [features] enterprise = ["windmill-worker/enterprise", "windmill-queue/enterprise", "windmill-api/enterprise"] +saml = ["windmill-api/saml"] benchmark = ["windmill-api/benchmark", "windmill-worker/benchmark", "windmill-queue/benchmark"] flamegraph = ["windmill-common/flamegraph", "windmill-worker/flamegraph"] loki = ["windmill-common/loki"] @@ -193,7 +194,7 @@ tokio-postgres = {version = "^0.7", features = ["array-impls", "with-serde_json- mysql_async = { version = "*", default-features = false, features = ["minimal", "default", "native-tls-tls"]} postgres-native-tls = "^0" native-tls = "^0" -samael = { version = "0.0.12", features = ["xmlsec"] } +samael = { version = "0.0.14", features = ["xmlsec"] } gcp_auth = "0.9.0" rust_decimal = { version = "^1", features = ["db-postgres"]} jsonwebtoken = "8.3.0" diff --git a/backend/windmill-api/Cargo.toml b/backend/windmill-api/Cargo.toml index 94024ba3e6..9a0f8b5ca5 100644 --- a/backend/windmill-api/Cargo.toml +++ b/backend/windmill-api/Cargo.toml @@ -9,7 +9,8 @@ name = "windmill_api" path = "src/lib.rs" [features] -enterprise = ["windmill-queue/enterprise", "async-stripe", "samael", "windmill-audit/enterprise"] +enterprise = ["windmill-queue/enterprise", "async-stripe", "windmill-audit/enterprise"] +saml = ["samael"] benchmark = [] [dependencies] diff --git a/backend/windmill-api/src/lib.rs b/backend/windmill-api/src/lib.rs index f0fc4221ba..25b03d1c49 100644 --- a/backend/windmill-api/src/lib.rs +++ b/backend/windmill-api/src/lib.rs @@ -36,7 +36,7 @@ use tower_http::{ trace::TraceLayer, }; use windmill_common::db::UserDB; -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] use windmill_common::ee::{get_license_plan, LicensePlan}; use windmill_common::utils::rd_string; use windmill_common::worker::ALL_TAGS; @@ -160,13 +160,13 @@ pub async fn run_server( .allow_headers([http::header::CONTENT_TYPE, http::header::AUTHORIZATION]) .allow_origin(Any); - #[cfg(feature = "enterprise")] + #[cfg(feature = "saml")] let sp_extension: (ServiceProviderExt, SamlSsoLogin) = match get_license_plan().await { LicensePlan::Enterprise => saml::build_sp_extension().await?, LicensePlan::Pro => (ServiceProviderExt(None), SamlSsoLogin(None)), }; - #[cfg(not(feature = "enterprise"))] + #[cfg(not(feature = "saml"))] let sp_extension = (ServiceProviderExt(), SamlSsoLogin(None)); let embeddings_db = if server_mode { diff --git a/backend/windmill-api/src/saml.rs b/backend/windmill-api/src/saml.rs index c07cf1651c..905ae35144 100644 --- a/backend/windmill-api/src/saml.rs +++ b/backend/windmill-api/src/saml.rs @@ -7,45 +7,45 @@ */ #![allow(non_snake_case)] -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] use axum::response::Redirect; use axum::{routing::post, Router}; -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] use axum::{Extension, Form}; -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] use std::sync::Arc; -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] use samael::metadata::{ContactPerson, ContactType, EntityDescriptor}; -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] use samael::service_provider::{ServiceProvider, ServiceProviderBuilder}; use serde::Deserialize; -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] use tower_cookies::Cookies; -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] use windmill_common::error::{Error, Result}; -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] use crate::db::DB; -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] use crate::users::login_externally; -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] use crate::BASE_URL; -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] #[derive(Clone)] pub struct ServiceProviderExt(pub Option); -#[cfg(not(feature = "enterprise"))] +#[cfg(not(feature = "saml"))] pub struct ServiceProviderExt(); -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] use windmill_common::ee::{get_license_plan, LicensePlan}; pub struct SamlSsoLogin(pub Option); -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] pub async fn build_sp_extension() -> anyhow::Result<(ServiceProviderExt, SamlSsoLogin)> { if let Some(url_metadata) = std::env::var("SAML_METADATA").ok() { //todo restrict for non ee @@ -93,7 +93,7 @@ pub struct SamlForm { pub SAMLResponse: Option, } -#[cfg(feature = "enterprise")] +#[cfg(feature = "saml")] pub async fn acs( Extension(db): Extension, cookies: Cookies, @@ -129,7 +129,7 @@ pub async fn acs( } } -#[cfg(not(feature = "enterprise"))] +#[cfg(not(feature = "saml"))] pub async fn acs() -> String { "SAML available only in enterprise version".to_string() }