diff --git a/Cargo.lock b/Cargo.lock index d1cef70ea..f4aaab65c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1233,7 +1233,7 @@ dependencies = [ [[package]] name = "edgedb-derive" version = "0.5.2" -source = "git+https://github.com/edgedb/edgedb-rust/#479e57085f600b54a7f61c11c3d578e545bac7db" +source = "git+https://github.com/edgedb/edgedb-rust/#14f2914ca1e40a78b6fa22d0beb3e4caf3dfd01d" dependencies = [ "proc-macro2", "quote", @@ -1244,7 +1244,7 @@ dependencies = [ [[package]] name = "edgedb-errors" version = "0.4.2" -source = "git+https://github.com/edgedb/edgedb-rust/#479e57085f600b54a7f61c11c3d578e545bac7db" +source = "git+https://github.com/edgedb/edgedb-rust/#14f2914ca1e40a78b6fa22d0beb3e4caf3dfd01d" dependencies = [ "bytes", ] @@ -1252,7 +1252,7 @@ dependencies = [ [[package]] name = "edgedb-protocol" version = "0.6.1" -source = "git+https://github.com/edgedb/edgedb-rust/#479e57085f600b54a7f61c11c3d578e545bac7db" +source = "git+https://github.com/edgedb/edgedb-rust/#14f2914ca1e40a78b6fa22d0beb3e4caf3dfd01d" dependencies = [ "bigdecimal", "bitflags 2.6.0", @@ -1270,7 +1270,7 @@ dependencies = [ [[package]] name = "edgedb-tokio" version = "0.5.1" -source = "git+https://github.com/edgedb/edgedb-rust/#479e57085f600b54a7f61c11c3d578e545bac7db" +source = "git+https://github.com/edgedb/edgedb-rust/#14f2914ca1e40a78b6fa22d0beb3e4caf3dfd01d" dependencies = [ "anyhow", "arc-swap", @@ -3660,6 +3660,7 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "223891c85e2a29c3fe8fb900c1fae5e69c2e42415e3177752e8718475efa5019" dependencies = [ + "backtrace", "snafu-derive", ] @@ -3885,7 +3886,7 @@ dependencies = [ [[package]] name = "test-utils" version = "0.1.0" -source = "git+https://github.com/edgedb/test-utils.git#fdb2b93975a92dd3569c9cc0c18e4b64e2a39a0f" +source = "git+https://github.com/edgedb/test-utils.git#36af0d100941520d64d94ddc367371faf91c4f3a" dependencies = [ "anyhow", "command-fds", diff --git a/Cargo.toml b/Cargo.toml index 440d4f295..739a6ce9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -167,7 +167,7 @@ rexpect = {git="https://github.com/tailhook/rexpect", branch="default_terminal_s openssl-sys = {version="0.9.104", features=["vendored"]} [profile.dev] -opt-level = 2 # 1 -- needed so windows don't get stack overflow, 2 - for GHA +opt-level = 0 [profile.release] debug = true diff --git a/src/commands/configure.rs b/src/commands/configure.rs index 0ef2a6c71..da4c3136e 100644 --- a/src/commands/configure.rs +++ b/src/commands/configure.rs @@ -157,6 +157,9 @@ pub async fn configure( C::Set(Set { parameter: S::ApplyAccessPolicies(ConfigStr { value }), }) => set(cli, "apply_access_policies", None, value).await, + C::Set(Set { + parameter: S::ApplyAccessPoliciesSQL(ConfigStr { value }), + }) => set(cli, "apply_access_policies_sql", None, value).await, C::Set(Set { parameter: S::AllowUserSpecifiedId(ConfigStr { value }), }) => set(cli, "allow_user_specified_id", None, value).await, @@ -195,8 +198,8 @@ pub async fn configure( parameter: S::StoreMigrationSdl(ConfigStr { value }), }) => set(cli, "store_migration_sdl", None, format!("'{value}'")).await, C::Set(Set { - parameter: S::NetHttpMaxConnections(ConfigStr { value }), - }) => set(cli, "net_http_max_connections", None, value).await, + parameter: S::HttpMaxConnections(ConfigStr { value }), + }) => set(cli, "http_max_connections", None, value).await, C::Set(Set { parameter: S::SimpleScoping(ConfigStr { value }), }) => set(cli, "simple_scoping", None, value).await, @@ -220,12 +223,13 @@ pub async fn configure( C::QueryExecutionTimeout => "query_execution_timeout", C::AllowBareDdl => "allow_bare_ddl", C::ApplyAccessPolicies => "apply_access_policies", + C::ApplyAccessPoliciesSQL => "apply_access_policies_sql", C::AllowUserSpecifiedId => "allow_user_specified_id", C::CorsAllowOrigins => "cors_allow_origins", C::AutoRebuildQueryCache => "auto_rebuild_query_cache", C::AutoRebuildQueryCacheTimeout => "auto_rebuild_query_cache_timeout", C::StoreMigrationSdl => "store_migration_sdl", - C::NetHttpMaxConnections => "net_http_max_connections", + C::HttpMaxConnections => "http_max_connections", C::SimpleScoping => "simple_scoping", C::WarnOldScoping => "warn_old_scoping", }; diff --git a/src/commands/parser.rs b/src/commands/parser.rs index def9d6f7c..b74eeb7ca 100644 --- a/src/commands/parser.rs +++ b/src/commands/parser.rs @@ -563,6 +563,12 @@ pub enum ValueParameter { /// allowing any queries to be executed. ApplyAccessPolicies(ConfigStr), + /// Apply access policies in SQL queries. + /// + /// User-specified access policies are not applied when set to `false`, + /// allowing any queries to be executed. + ApplyAccessPoliciesSQL(ConfigStr), + /// Allow setting user-specified object identifiers. AllowUserSpecifiedId(ConfigStr), @@ -585,7 +591,7 @@ pub enum ValueParameter { /// The maximum number of concurrent HTTP connections. /// /// HTTP connections for the `std::net::http` module. - NetHttpMaxConnections(ConfigStr), + HttpMaxConnections(ConfigStr), /// Whether to use the new simple scoping behavior (disable path factoring). SimpleScoping(ConfigStr), @@ -626,6 +632,8 @@ pub enum ConfigParameter { AllowBareDdl, /// Reset apply_access_policies parameter to `true` ApplyAccessPolicies, + /// Reset apply_access_policies_sql parameter to `false` + ApplyAccessPoliciesSQL, /// Reset allow_user_specified_id parameter to `false` AllowUserSpecifiedId, /// Reset cors_allow_origins to an empty set @@ -637,7 +645,7 @@ pub enum ConfigParameter { /// When to store resulting SDL of a Migration StoreMigrationSdl, /// The maximum number of concurrent HTTP connections. - NetHttpMaxConnections, + HttpMaxConnections, /// Whether to use the new simple scoping behavior. SimpleScoping, /// Whether to warn when depending on old scoping behavior. diff --git a/src/interactive.rs b/src/interactive.rs index 68055b6ce..ce33a7e84 100644 --- a/src/interactive.rs +++ b/src/interactive.rs @@ -10,10 +10,10 @@ use tokio::sync::mpsc::channel; use tokio_stream::StreamExt; use edgedb_errors::{ParameterTypeMismatchError, StateMismatchError}; +use edgedb_protocol::client_message::Cardinality; use edgedb_protocol::client_message::CompilationOptions; -use edgedb_protocol::client_message::{Cardinality, IoFormat}; use edgedb_protocol::common::RawTypedesc; -use edgedb_protocol::common::{Capabilities, State}; +use edgedb_protocol::common::{Capabilities, IoFormat, State}; use edgedb_protocol::descriptors::Typedesc; use edgedb_protocol::model::Duration; use edgedb_protocol::value::Value; diff --git a/src/variables.rs b/src/variables.rs index d2bd36b32..e04070e42 100644 --- a/src/variables.rs +++ b/src/variables.rs @@ -63,14 +63,12 @@ pub async fn input_variables( } fn get_descriptor_type<'a>( - mut desc: &'a Descriptor, + desc: &'a Descriptor, all: &'a Typedesc, ) -> Result, anyhow::Error> { - if let Descriptor::Scalar(s) = desc { - desc = all.get(s.base_type_pos)?; - } + let base = desc.normalize_to_base(&all.as_query_arg_context())?; - match desc { + match base { Descriptor::BaseScalar(s) => { let var_type: Arc = match *s.id { codec::STD_STR => Arc::new(variable::Str),