Skip to content

Commit 0ca92dc

Browse files
authored
Update garde and other dependencies (#547)
* Update garde and other dependencies * flake.lock: Update Flake lock file updates: • Updated input 'crane': 'github:ipetkov/crane/480dff0be03dac0e51a8dfc26e882b0d123a450e' (2024-05-29) → 'github:ipetkov/crane/17d9e9dedd58dde2c562a4296934c6d6a0844534' (2024-06-09) • Updated input 'devenv': 'github:cachix/devenv/c3f9f053c077c6f88a3de5276d9178c62baa3fc3' (2024-06-01) → 'github:cachix/devenv/50e981f8a08cc06553ac591c658f347f6087d836' (2024-06-10) • Updated input 'nixpkgs': 'github:nixos/nixpkgs/ad57eef4ef0659193044870c731987a6df5cf56b' (2024-05-29) → 'github:nixos/nixpkgs/051f920625ab5aabe37c920346e3e69d7d34400e' (2024-06-07) • Updated input 'rust-overlay': 'github:oxalica/rust-overlay/ab69b67fac9a96709fbef0b899db308ca714a120' (2024-06-01) → 'github:oxalica/rust-overlay/abfe5b3126b1b7e9e4daafc1c6478d17f0b584e7' (2024-06-10)
1 parent 54af999 commit 0ca92dc

File tree

24 files changed

+192
-152
lines changed

24 files changed

+192
-152
lines changed

Cargo.lock

+71-71
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ resolver = "2"
7878
askama = { version = "0.12.1", default-features = false, features = [
7979
"with-axum",
8080
] }
81-
clap = { version = "4.5.4", features = ["derive", "wrap_help"] }
81+
clap = { version = "4.5.6", features = ["derive", "wrap_help"] }
8282
diesel = { version = "2.2.0", default-features = false, features = [
8383
"32-column-tables",
8484
"with-deprecated",
@@ -96,7 +96,7 @@ fred = { version = "9.0.3", features = [
9696
"i-scripts",
9797
"sha-1",
9898
] }
99-
garde = { version = "0.18.0", default-features = false, features = [
99+
garde = { version = "0.19.0", features = [
100100
"derive",
101101
"email",
102102
"email-idna",

crates/kitsune-config/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ isolang = { version = "2.4.0", features = ["serde"] }
1212
serde = { version = "1.0.203", features = ["derive"] }
1313
smol_str = { version = "0.2.2", features = ["serde"] }
1414
tokio = { version = "1.38.0", features = ["fs"] }
15-
toml = { version = "0.8.13", default-features = false, features = ["parse"] }
15+
toml = { version = "0.8.14", default-features = false, features = ["parse"] }
1616

1717
[lints]
1818
workspace = true

crates/kitsune-db/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ kitsune-language = { workspace = true }
2222
kitsune-type = { workspace = true }
2323
num-derive = "0.4.2"
2424
num-traits = "0.2.19"
25-
rustls = { version = "0.23.8", default-features = false, features = [
25+
rustls = { version = "0.23.9", default-features = false, features = [
2626
"logging",
2727
"ring",
2828
"std",

crates/kitsune-derive/impl/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license.workspace = true
99
proc-macro = true
1010

1111
[dependencies]
12-
proc-macro2 = "1.0.84"
12+
proc-macro2 = "1.0.85"
1313
quote = "1.0.36"
1414
syn = { version = "2.0.66", features = ["full"] }
1515

crates/kitsune-error/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,23 @@ impl Error {
9494
eyre::Report::msg(msg).into()
9595
}
9696

97+
#[inline]
9798
#[must_use]
9899
pub fn context(&self) -> &ErrorContext {
99100
&self.ctx
100101
}
101102

103+
#[inline]
102104
pub fn error(&self) -> &eyre::Report {
103105
&self.inner
104106
}
105107

108+
#[inline]
106109
pub fn into_error(self) -> eyre::Report {
107110
self.inner
108111
}
109112

113+
#[inline]
110114
#[must_use]
111115
pub fn with_context(self, ctx: ErrorContext) -> Self {
112116
Self { ctx, ..self }

crates/kitsune-oidc/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ kitsune-http-client = { workspace = true }
1717
moka = { workspace = true }
1818
oauth2 = { version = "5.0.0-alpha.4", default-features = false }
1919
once_cell = "1.19.0"
20-
openidconnect = { version = "4.0.0-alpha.1", default-features = false, features = [
20+
openidconnect = { version = "4.0.0-alpha.2", default-features = false, features = [
2121
# Accept these two, per specification invalid, cases to increase compatibility
2222
"accept-rfc3339-timestamps",
2323
"accept-string-booleans",

crates/kitsune-service/src/account.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl AccountService {
350350
&self,
351351
get_posts: GetPosts,
352352
) -> Result<impl Stream<Item = Result<Post>> + '_> {
353-
get_posts.validate(&LimitContext::default())?;
353+
get_posts.validate_with(&LimitContext::default())?;
354354

355355
let permission_check = PermissionCheck::builder()
356356
.fetching_account_id(get_posts.fetching_account_id)
@@ -432,7 +432,7 @@ impl AccountService {
432432
&self,
433433
get_follow_requests: GetFollowRequests,
434434
) -> Result<impl Stream<Item = Result<Account>> + '_> {
435-
get_follow_requests.validate(&LimitContext::default())?;
435+
get_follow_requests.validate_with(&LimitContext::default())?;
436436

437437
let mut query = accounts_follows::table
438438
.inner_join(accounts::table.on(accounts_follows::follower_id.eq(accounts::id)))
@@ -577,7 +577,7 @@ impl AccountService {
577577
A: Stream<Item = Result<Bytes>> + Send + Sync + 'static,
578578
H: Stream<Item = Result<Bytes>> + Send + Sync + 'static,
579579
{
580-
update.validate(&())?;
580+
update.validate()?;
581581

582582
let mut changeset = UpdateAccount::default();
583583

crates/kitsune-service/src/attachment.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl AttachmentService {
143143
}
144144

145145
pub async fn update(&self, update: Update) -> Result<MediaAttachment> {
146-
update.validate(&())?;
146+
update.validate()?;
147147

148148
let mut changeset = UpdateMediaAttachment::default();
149149
if let Some(ref description) = update.description {
@@ -171,7 +171,7 @@ impl AttachmentService {
171171
where
172172
S: Stream<Item = Result<Bytes>> + Send + Sync + 'static,
173173
{
174-
upload.validate(&())?;
174+
upload.validate()?;
175175

176176
// remove exif info from image uploads
177177
if is_image_type_with_supported_metadata(&upload.content_type) {

crates/kitsune-service/src/custom_emoji.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl CustomEmojiService {
137137
where
138138
S: Stream<Item = Result<Bytes>> + Send + Sync + 'static,
139139
{
140-
emoji_upload.validate(&())?;
140+
emoji_upload.validate()?;
141141

142142
let attachment_upload = Upload::builder()
143143
.content_type(emoji_upload.content_type)

crates/kitsune-service/src/notification.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ impl NotificationService {
7272
&self,
7373
get_notifications: GetNotifications,
7474
) -> Result<impl Stream<Item = Result<Notification>> + '_> {
75-
get_notifications.validate(&LimitContext::default())?;
75+
get_notifications.validate_with(&LimitContext::default())?;
7676

7777
let mut query = notifications::table
7878
.filter(

crates/kitsune-service/src/post/mod.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ impl PostService {
439439
/// This should never ever panic. If it does, create a bug report.
440440
#[allow(clippy::too_many_lines)]
441441
pub async fn create(&self, create_post: CreatePost) -> Result<Post> {
442-
create_post.validate(&PostValidationContext {
442+
create_post.validate_with(&PostValidationContext {
443443
character_limit: self.instance_service.character_limit(),
444444
})?;
445445

@@ -579,7 +579,7 @@ impl PostService {
579579
.get_post_with_access_guard(update_post.post_id, update_post.account_id, None)
580580
.await?;
581581

582-
update_post.validate(&PostValidationContext {
582+
update_post.validate_with(&PostValidationContext {
583583
character_limit: self.instance_service.character_limit(),
584584
})?;
585585

@@ -909,7 +909,7 @@ impl PostService {
909909
&self,
910910
get_favourites: GetAccountsInteractingWithPost,
911911
) -> Result<impl Stream<Item = Result<Account>> + '_> {
912-
get_favourites.validate(&LimitContext::default())?;
912+
get_favourites.validate_with(&LimitContext::default())?;
913913

914914
let mut query = posts_favourites::table
915915
.inner_join(accounts::table.on(posts_favourites::account_id.eq(accounts::id)))
@@ -947,7 +947,7 @@ impl PostService {
947947
&self,
948948
get_reblogs: GetAccountsInteractingWithPost,
949949
) -> Result<impl Stream<Item = Result<Account>> + '_> {
950-
get_reblogs.validate(&LimitContext::default())?;
950+
get_reblogs.validate_with(&LimitContext::default())?;
951951

952952
let permission_check = PermissionCheck::builder()
953953
.fetching_account_id(get_reblogs.fetching_account_id)
@@ -1166,17 +1166,17 @@ mod test {
11661166
.build();
11671167

11681168
assert!(create_post
1169-
.validate(&PostValidationContext {
1169+
.validate_with(&PostValidationContext {
11701170
character_limit: 20,
11711171
})
11721172
.is_ok());
11731173

11741174
assert!(create_post
1175-
.validate(&PostValidationContext { character_limit: 5 })
1175+
.validate_with(&PostValidationContext { character_limit: 5 })
11761176
.is_err());
11771177

11781178
assert!(create_post
1179-
.validate(&PostValidationContext { character_limit: 2 })
1179+
.validate_with(&PostValidationContext { character_limit: 2 })
11801180
.is_err());
11811181

11821182
let create_post = CreatePost::builder()
@@ -1185,7 +1185,7 @@ mod test {
11851185
.build();
11861186

11871187
assert!(create_post
1188-
.validate(&PostValidationContext {
1188+
.validate_with(&PostValidationContext {
11891189
character_limit: 25
11901190
})
11911191
.is_err());
@@ -1197,7 +1197,7 @@ mod test {
11971197
.build();
11981198

11991199
assert!(create_post
1200-
.validate(&PostValidationContext {
1200+
.validate_with(&PostValidationContext {
12011201
character_limit: 25
12021202
})
12031203
.is_ok());
@@ -1213,17 +1213,17 @@ mod test {
12131213
.build();
12141214

12151215
assert!(update_post
1216-
.validate(&PostValidationContext {
1216+
.validate_with(&PostValidationContext {
12171217
character_limit: 20,
12181218
})
12191219
.is_ok());
12201220

12211221
assert!(update_post
1222-
.validate(&PostValidationContext { character_limit: 5 })
1222+
.validate_with(&PostValidationContext { character_limit: 5 })
12231223
.is_err());
12241224

12251225
assert!(update_post
1226-
.validate(&PostValidationContext { character_limit: 2 })
1226+
.validate_with(&PostValidationContext { character_limit: 2 })
12271227
.is_err());
12281228
}
12291229
}

crates/kitsune-service/src/search.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl SearchService {
5252
}
5353

5454
pub async fn search(&self, search: Search<'_>) -> Result<Vec<SearchResult>> {
55-
search.validate(&())?;
55+
search.validate()?;
5656

5757
let mut results = Vec::new();
5858

crates/kitsune-service/src/timeline.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl TimelineService {
7474
&self,
7575
get_home: GetHome,
7676
) -> Result<impl Stream<Item = Result<Post>> + '_> {
77-
get_home.validate(&LimitContext::default())?;
77+
get_home.validate_with(&LimitContext::default())?;
7878

7979
let mut query = posts::table
8080
.filter(
@@ -136,7 +136,7 @@ impl TimelineService {
136136
&self,
137137
get_public: GetPublic,
138138
) -> Result<impl Stream<Item = Result<Post>> + '_> {
139-
get_public.validate(&LimitContext::default())?;
139+
get_public.validate_with(&LimitContext::default())?;
140140

141141
let permission_check = PermissionCheck::builder().include_unlisted(false).build();
142142

crates/kitsune-service/src/user.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl UserService {
127127
bail!(type = ErrorType::Forbidden.with_body("registrations closed"), "registrations closed");
128128
}
129129

130-
register.validate(&RegisterContext {
130+
register.validate_with(&RegisterContext {
131131
allow_non_ascii: self.allow_non_ascii_usernames,
132132
})?;
133133

@@ -266,7 +266,7 @@ mod test {
266266

267267
assert!(
268268
register
269-
.validate(&RegisterContext {
269+
.validate_with(&RegisterContext {
270270
allow_non_ascii: true
271271
})
272272
.is_ok(),
@@ -285,7 +285,7 @@ mod test {
285285

286286
assert!(
287287
register
288-
.validate(&RegisterContext {
288+
.validate_with(&RegisterContext {
289289
allow_non_ascii: true,
290290
})
291291
.is_err(),
@@ -303,7 +303,7 @@ mod test {
303303
.build();
304304

305305
assert!(register
306-
.validate(&RegisterContext {
306+
.validate_with(&RegisterContext {
307307
allow_non_ascii: false
308308
})
309309
.is_err());

crates/kitsune-wasm-mrf/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ kitsune-derive = { workspace = true }
2121
kitsune-error = { workspace = true }
2222
kitsune-type = { workspace = true }
2323
mrf-manifest = { workspace = true, features = ["decode"] }
24-
redb = { version = "2.1.0", features = ["logging"] }
24+
redb = { version = "2.1.1", features = ["logging"] }
2525
slab = "0.4.9"
2626
smol_str = "0.2.2"
2727
sonic-rs = { workspace = true }

crates/kitsune-wasm-mrf/src/cache.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,28 @@ impl Cache {
3434
let table = transaction.open_table(CACHE_TABLE)?;
3535

3636
let hash = blake3::hash(component_src);
37+
let hash_hex = hash.to_hex();
3738
let Some(precompiled) = table.get(hash.as_bytes())? else {
3839
return Ok(None);
3940
};
4041

41-
debug!(hash = %hash.to_hex(), "hit component cache");
42+
debug!(hash = %hash_hex, "hit component cache");
4243

4344
// SAFETY: The function is defined as unsafe since it is only doing very simple checks whether the precompiled component inside is actually valid
4445
// But since we source our cache from disk, we can assume that the files are fine. If they aren't, the user has tempered with them or they were otherwise corrupted.
4546
// If that's the case the user has bigger issues than a little memory unsafety here. And it's also nothing we can really protect against.
4647
#[allow(unsafe_code)]
47-
Ok(unsafe { Component::deserialize(engine, precompiled.value()).ok() })
48+
Ok(unsafe {
49+
Component::deserialize(engine, precompiled.value())
50+
.inspect_err(|error| {
51+
debug!(
52+
hash = %hash_hex,
53+
%error,
54+
"failed to deserialize component. pretending that we don't have a component in cache",
55+
);
56+
})
57+
.ok()
58+
})
4859
}
4960

5061
#[inline]

0 commit comments

Comments
 (0)