Skip to content

Commit

Permalink
fix: invalid signature for escapes path
Browse files Browse the repository at this point in the history
  • Loading branch information
hUwUtao committed Oct 1, 2024
1 parent 0324799 commit 173b5ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Cargo.lock
.vscode
/.idea

storage
2 changes: 1 addition & 1 deletion src/bin/s3-server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct Args {
// help = "Path to the PEM file for token verification"
// )]
// public_key: PathBuf,
#[structopt(long, default_value = ".")]
#[structopt(long, default_value = "./storage")]
fs_root: PathBuf,

#[structopt(long, default_value = "localhost")]
Expand Down
8 changes: 5 additions & 3 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ use futures::future::BoxFuture;
use futures::stream::{Stream, StreamExt};
use hyper::body::Bytes;

use tracing::info;
use tracing::warn;
use tracing::{debug, error};

/// S3 service
Expand Down Expand Up @@ -549,7 +551,7 @@ async fn check_header_auth(

let signature = {
let method = ctx.req.method();
let uri_path = ctx.req.uri().path();
let uri_path = decode_uri_path(ctx.req)?.into_owned();
let query_strings: &[(String, String)] =
ctx.query_strings.as_ref().map_or(&[], AsRef::as_ref);

Expand All @@ -561,7 +563,7 @@ async fn check_header_auth(
let canonical_request = if is_stream {
signature_v4::create_canonical_request(
method,
uri_path,
&uri_path,
query_strings,
&headers,
signature_v4::Payload::MultipleChunks,
Expand All @@ -582,7 +584,7 @@ async fn check_header_auth(

let ans = signature_v4::create_canonical_request(
method,
uri_path,
&uri_path,
query_strings,
&headers,
payload,
Expand Down

0 comments on commit 173b5ad

Please sign in to comment.