Skip to content

Commit

Permalink
Fix auth regression (#1413)
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Cloutier <[email protected]>
Co-authored-by: Tyler Cloutier <[email protected]>
  • Loading branch information
coolreader18 and cloutiertyler authored Jun 12, 2024
1 parent 2b7b19e commit 6e052cb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/client-api/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ impl SpacetimeCreds {
Err(e) => Err(e),
};
if let Ok(Query(creds)) = Query::<Self>::try_from_uri(&parts.uri) {
// TODO STABILITY: do we want to have the `?token=` query param just be the jwt, instead of this?
let creds_header: HeaderValue = format!("Basic {}", creds.token)
.try_into()
.map_err(|_| headers::Error::invalid())?;
let creds = <SpacetimeCreds as authorization::Credentials>::decode(&creds_header)
.ok_or_else(headers::Error::invalid)?;
return Ok(Some(creds));
}
res
Expand Down

3 comments on commit 6e052cb

@github-actions
Copy link

@github-actions github-actions bot commented on 6e052cb Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot test failed. Please check the workflow run for details.

@github-actions
Copy link

@github-actions github-actions bot commented on 6e052cb Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmarking failed. Please check the workflow run for details.

@github-actions
Copy link

@github-actions github-actions bot commented on 6e052cb Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Callgrind benchmark results

Callgrind Benchmark Report

These benchmarks were run using callgrind,
an instruction-level profiler. They allow comparisons between sqlite (sqlite), SpacetimeDB running through a module (stdb_module), and the underlying SpacetimeDB data storage engine (stdb_raw). Callgrind emulates a CPU to collect the below estimates.

Measurement changes larger than five percent are in bold.

In-memory benchmarks

callgrind: empty transaction

db total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw 5109 5109 0.00% 5143 5143 0.00%
sqlite 5676 5676 0.00% 6198 6198 0.00%

callgrind: filter

db schema indices count preload _column data_type total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str no_index 64 128 1 u64 78656 78656 0.00% 79034 79034 0.00%
stdb_raw u32_u64_str no_index 64 128 2 string 120921 120921 0.00% 121465 121465 0.00%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23344 23344 0.00% 23738 23738 0.00%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24399 24382 0.07% 24723 24698 0.10%
sqlite u32_u64_str no_index 64 128 2 string 143657 143657 0.00% 145215 145215 0.00%
sqlite u32_u64_str no_index 64 128 1 u64 122998 122998 0.00% 124326 124322 0.00%
sqlite u32_u64_str btree_each_column 64 128 2 string 133520 133520 0.00% 135268 135272 -0.00%
sqlite u32_u64_str btree_each_column 64 128 1 u64 130315 130315 0.00% 131905 131905 0.00%

callgrind: insert bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 64 128 888728 888543 0.02% 903506 903337 0.02%
stdb_raw u32_u64_str btree_each_column 64 128 1018031 1016957 0.11% 1039895 1038833 0.10%
sqlite u32_u64_str unique_0 64 128 396305 396299 0.00% 412637 412627 0.00%
sqlite u32_u64_str btree_each_column 64 128 969372 969372 0.00% 1002130 1002130 0.00%

callgrind: iterate

db schema indices count total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 151308 151308 0.00% 151354 151354 0.00%
stdb_raw u32_u64_str unique_0 64 15293 15293 0.00% 15327 15327 0.00%
sqlite u32_u64_str unique_0 1024 1046901 1046901 0.00% 1050471 1050471 0.00%
sqlite u32_u64_str unique_0 64 75041 75041 0.00% 76245 76245 0.00%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47438 47438 0.00% 49988 49988 0.00%
64 bsatn 25717 25717 0.00% 28029 28029 0.00%
16 bsatn 8118 8118 0.00% 9478 9478 0.00%
16 json 12142 12142 0.00% 13910 13910 0.00%

callgrind: update bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 1024 20647141 20647985 -0.00% 20930191 20930849 -0.00%
stdb_raw u32_u64_str unique_0 64 128 1303611 1303712 -0.01% 1357527 1357664 -0.01%
sqlite u32_u64_str unique_0 1024 1024 1802084 1802084 0.00% 1811254 1811254 0.00%
sqlite u32_u64_str unique_0 64 128 128620 128620 0.00% 131528 131528 0.00%
On-disk benchmarks

callgrind: empty transaction

db total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw 5119 5119 0.00% 5157 5157 0.00%
sqlite 5718 5718 0.00% 6262 6262 0.00%

callgrind: filter

db schema indices count preload _column data_type total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str no_index 64 128 1 u64 78666 78666 0.00% 79012 79012 0.00%
stdb_raw u32_u64_str no_index 64 128 2 string 120931 120931 0.00% 121519 121511 0.01%
stdb_raw u32_u64_str btree_each_column 64 128 1 u64 23354 23354 0.00% 23744 23748 -0.02%
stdb_raw u32_u64_str btree_each_column 64 128 2 string 24573 24572 0.00% 24957 24956 0.00%
sqlite u32_u64_str no_index 64 128 1 u64 124919 124919 0.00% 126587 126587 0.00%
sqlite u32_u64_str no_index 64 128 2 string 145578 145578 0.00% 147456 147452 0.00%
sqlite u32_u64_str btree_each_column 64 128 1 u64 132411 132411 0.00% 134379 134375 0.00%
sqlite u32_u64_str btree_each_column 64 128 2 string 135570 135585 -0.01% 137760 137779 -0.01%

callgrind: insert bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 64 128 840716 840341 0.04% 885572 885197 0.04%
stdb_raw u32_u64_str btree_each_column 64 128 966156 967260 -0.11% 1017732 1018736 -0.10%
sqlite u32_u64_str unique_0 64 128 413847 413847 0.00% 429691 429691 0.00%
sqlite u32_u64_str btree_each_column 64 128 1019947 1019947 0.00% 1051855 1051847 0.00%

callgrind: iterate

db schema indices count total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 151318 151318 0.00% 151352 151352 0.00%
stdb_raw u32_u64_str unique_0 64 15303 15303 0.00% 15337 15337 0.00%
sqlite u32_u64_str unique_0 1024 1049963 1049963 0.00% 1053755 1053755 0.00%
sqlite u32_u64_str unique_0 64 76813 76828 -0.02% 78177 78192 -0.02%

callgrind: serialize_product_value

count format total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
64 json 47438 47438 0.00% 49988 49988 0.00%
64 bsatn 25717 25717 0.00% 28029 28029 0.00%
16 bsatn 8118 8118 0.00% 9478 9478 0.00%
16 json 12142 12142 0.00% 13910 13910 0.00%

callgrind: update bulk

db schema indices count preload total reads + writes old total reads + writes Δrw estimated cycles old estimated cycles Δcycles
stdb_raw u32_u64_str unique_0 1024 1024 19413345 19407703 0.03% 19757529 19751087 0.03%
stdb_raw u32_u64_str unique_0 64 128 1258086 1258062 0.00% 1310428 1310448 -0.00%
sqlite u32_u64_str unique_0 1024 1024 1809880 1809880 0.00% 1818450 1818450 0.00%
sqlite u32_u64_str unique_0 64 128 132768 132768 0.00% 135792 135792 0.00%

Please sign in to comment.