Skip to content

Commit 13462a6

Browse files
authored
merge: Merge pull request #203 from arunaengine/fix/cors
Fix/cors
2 parents 433340e + a4e61af commit 13462a6

24 files changed

Lines changed: 495 additions & 282 deletions

File tree

Cargo.lock

Lines changed: 276 additions & 150 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ async-trait = "0.1.88"
2020
aws-config = "1.6.2"
2121
aws-sdk-s3 = "1.83.0"
2222
base64 = "0.22.1"
23-
cel-interpreter = "0.9.0"
24-
cel-parser = "0.8.0"
23+
cel-interpreter = "0.9.1"
24+
cel-parser = "0.8.1"
2525
chrono = "0.4.38"
2626
dashmap = {version = "6.1.0", features = ["serde"]}
2727
deadpool-postgres = "0.14.1"
@@ -35,7 +35,7 @@ lazy_static = "1.5.0"
3535
postgres-from-row = "=0.5.2"
3636
postgres-types = { version = "0.2.9", features = ["derive"] }
3737
prost-wkt-types = "0.5.1"
38-
rand = "0.8.5"
38+
rand = "0.9.2"
3939
reqsign = { version = "0.16.3"}
4040
reqwest = { version = "0.12.15", features = ["stream", "json"] }
4141
serde = { version = "1.0.219", features = ["derive"] }
@@ -46,5 +46,5 @@ tokio = { version = "1.44.2", features = ["full", "tracing"] }
4646
tokio-postgres = { version = "0.7.13", features = ["with-uuid-1", "with-serde_json-1", "with-chrono-0_4"] }
4747
tokio-stream = { version = "0.1.17", features = ["net"] }
4848
tonic = { version = "0.11.0", features = ["tls", "tls-roots"] }
49-
tower = { version = "0.4.13", features = ["retry"] }
49+
tower = { version = "0.5.2", features = ["retry"] }
5050
url = "2.5.4"

components/data_proxy/Cargo.toml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ ahash = { workspace = true }
1414
anyhow = { workspace = true }
1515
aruna-rust-api = { workspace = true }
1616
async-channel = { workspace = true }
17-
async-stream = "0.3.5"
17+
async-stream = "0.3.6"
1818
async-trait = { workspace = true }
1919
aws-config = { workspace = true }
2020
aws-sdk-s3 = { workspace = true }
21-
aws-smithy-http = "0.62.1"
21+
aws-smithy-http = "0.62.3"
2222
base64 = { workspace = true }
2323
byteorder = "1.5.0"
2424
bytes = "1.10.1"
@@ -33,11 +33,11 @@ deadpool-postgres = { workspace = true }
3333
diesel-ulid = { workspace = true }
3434
digest = "0.10.7"
3535
dotenvy = { workspace = true }
36-
ed25519-dalek = { version = "2.1.1", features = ["pem"] }
36+
ed25519-dalek = { version = "2.2.0", features = ["pem"] }
3737
futures = { workspace = true }
38-
futures-channel = "0.3.30"
39-
futures-core = "0.3.30"
40-
futures-util = "0.3.30"
38+
futures-channel = "0.3.31"
39+
futures-core = "0.3.31"
40+
futures-util = "0.3.31"
4141
hex = { workspace = true }
4242
hmac = { workspace = true }
4343
http = "1.3.1"
@@ -46,37 +46,37 @@ jsonwebtoken = { workspace = true }
4646
lazy_static = { workspace = true }
4747
md-5 = "0.10.6"
4848
mime_guess = "2.0.5"
49-
nom = "7.1.3"
49+
nom = "8.0.0"
5050
pithos_lib = "0.6.2"
5151
postgres-from-row = { workspace = true }
5252
postgres-types = { workspace = true }
5353
postgres_array = "0.11.1"
5454
prost-wkt-types = { workspace = true }
5555
rand = { workspace = true }
56-
regex = "1.11.0"
57-
reqsign = "0.16.0"
56+
regex = "1.11.1"
57+
reqsign = "0.16.5"
5858
reqwest = { workspace = true }
59-
s3s = "0.10.0"
59+
s3s = "0.11.0"
6060
serde = { workspace = true }
6161
serde_json = { workspace = true }
6262
sha2 = { workspace = true }
6363
time = { workspace = true }
6464
tokio = { workspace = true }
6565
tokio-postgres = { workspace = true }
6666
tokio-stream = { workspace = true }
67-
toml = "0.8.22"
67+
toml = "0.9.5"
6868
tonic = { workspace = true }
6969
tower = { workspace = true }
70-
tower-http = { version = "0.5.2", features = ["cors"] }
70+
tower-http = { version = "0.6.6", features = ["cors"] }
7171
tracing = "0.1.41"
7272
tracing-subscriber = { version = "0.3.19", features = ["env-filter", "time"] }
7373
url = { workspace = true }
74-
zstd = "0.13.2"
75-
hyper-util = { version = "0.1.11", features = [
74+
zstd = "0.13.3"
75+
hyper-util = { version = "0.1.16", features = [
7676
"server",
7777
"http1",
7878
"http2",
7979
"tokio",
8080
"service",
8181
] }
82-
http-body-util = "0.1.2"
82+
http-body-util = "0.1.3"

components/data_proxy/src/caching/cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crossbeam_skiplist::SkipMap;
2222
use dashmap::DashMap;
2323
use diesel_ulid::DieselUlid;
2424
use jsonwebtoken::DecodingKey;
25-
use rand::{distributions::Alphanumeric, thread_rng, Rng};
25+
use rand::{distr::Alphanumeric, rng as thread_rng, Rng};
2626
use s3s::auth::SecretKey;
2727
use s3s::dto::Part;
2828
use std::collections::{HashMap, VecDeque};

components/data_proxy/src/caching/grpc_query_handler.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,8 @@ impl GrpcQueryHandler {
536536
let cors = match obj
537537
.key_values
538538
.iter()
539-
.filter(|e| e.key == "app.aruna-storage.org/cors")
539+
.find(|e| e.key == "app.aruna-storage.org/cors")
540540
.cloned()
541-
.next()
542541
{
543542
Some(cors) => cors,
544543
None => KeyValue {

components/data_proxy/src/data_backends/filesystem_backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use diesel_ulid::DieselUlid;
77
use digest::Digest;
88
use futures_util::StreamExt;
99
use md5::Md5;
10-
use rand::{distributions::Alphanumeric, thread_rng, Rng};
10+
use rand::{distr::Alphanumeric, rng as thread_rng, Rng};
1111
use std::path::Path;
1212
use tokio::io::{AsyncReadExt, AsyncWriteExt};
1313
use tokio::pin;

components/data_proxy/src/data_backends/location_handler.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use nom::{
1010
sequence::{preceded, terminated},
1111
IResult, Parser,
1212
};
13-
use rand::distributions::Alphanumeric;
14-
use rand::thread_rng;
13+
use rand::distr::Alphanumeric;
14+
use rand::rng as thread_rng;
1515
use rand::Rng;
1616

1717
use crate::CONFIG;
@@ -139,7 +139,7 @@ impl CompiledVariant {
139139
}
140140

141141
pub fn compile(input: &str) -> IResult<&str, Self> {
142-
alt((Self::compile_s3, Self::compile_filesystem))(input)
142+
alt((Self::compile_s3, Self::compile_filesystem)).parse(input)
143143
}
144144

145145
pub fn compile_s3(scheme: &str) -> IResult<&str, Self> {
@@ -228,10 +228,13 @@ impl CompiledVariant {
228228
tag("/").map(|_| Arguments::Slash),
229229
take_while(|c| c != '{' && c != '}' && c != '/')
230230
.map(|x: &str| Arguments::Text(x.to_string())),
231-
))(input)
231+
))
232+
.parse(input)
232233
}
233234

234235
pub fn compile_tags(input: &str) -> IResult<&str, Vec<Arguments>> {
235-
many_till(Self::compile_tag, eof)(input).map(|(x, (y, _))| (x, y))
236+
many_till(Self::compile_tag, eof)
237+
.parse(input)
238+
.map(|(x, (y, _))| (x, y))
236239
}
237240
}

components/data_proxy/src/data_backends/s3_backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ impl StorageBackend for S3Backend {
402402
self.check_and_create_bucket(target.bucket.clone()).await?;
403403
self.s3_client
404404
.copy_object()
405-
.copy_source(&[source.bucket, source.key].join("/"))
405+
.copy_source([source.bucket, source.key].join("/"))
406406
.bucket(target.bucket)
407407
.key(target.key)
408408
.send()

components/data_proxy/src/helpers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::collections::HashSet;
22

33
use anyhow::Result;
44
use http::Method;
5-
use rand::distributions::DistString;
5+
use rand::distr::SampleString as DistString;
66
use reqsign::{AwsCredential, AwsV4Signer};
77
use url::Url;
88

@@ -139,8 +139,8 @@ pub fn is_method_read(method: &Method) -> bool {
139139
}
140140

141141
pub fn random_string(len: usize) -> String {
142-
use rand::distributions::Alphanumeric;
143-
use rand::thread_rng;
142+
use rand::distr::Alphanumeric;
143+
use rand::rng as thread_rng;
144144
Alphanumeric
145145
.sample_string(&mut thread_rng(), len)
146146
.to_ascii_lowercase()

components/data_proxy/src/s3_frontend/auth.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
use crate::caching::cache::Cache;
22
use s3s::{
3-
auth::{S3Auth, S3AuthContext, SecretKey},
3+
access::{S3Access, S3AccessContext},
4+
auth::{S3Auth, SecretKey},
45
s3_error, S3Result,
56
};
67
use std::sync::Arc;
78
use tracing::debug;
89

910
/// Aruna authprovider
11+
#[derive(Clone)]
1012
pub struct AuthProvider {
1113
cache: Arc<Cache>,
1214
}
@@ -30,9 +32,12 @@ impl S3Auth for AuthProvider {
3032
.map_err(|_| s3_error!(AccessDenied, "Invalid access key"))?;
3133
Ok(secret)
3234
}
35+
}
3336

37+
#[async_trait::async_trait]
38+
impl S3Access for AuthProvider {
3439
#[tracing::instrument(level = "trace", skip(self, cx))]
35-
async fn check_access(&self, cx: &mut S3AuthContext<'_>) -> S3Result<()> {
40+
async fn check(&self, cx: &mut S3AccessContext<'_>) -> S3Result<()> {
3641
debug!(path = ?cx.s3_path());
3742

3843
match self.cache.auth.read().await.as_ref() {

0 commit comments

Comments
 (0)