@@ -790,7 +790,7 @@ impl HttpServer {
790
790
}
791
791
}
792
792
793
- fn check_authorized ( & self , req : & Request , mutation : Option < Mutation > ) -> bool {
793
+ fn check_authorized ( & self , req : & Request , mutation : Option < Mutation < ' _ > > ) -> bool {
794
794
let ( private_key, private_key_subject) = if mutation. is_some ( ) || self . auth_required {
795
795
match & self . token {
796
796
Token :: Plaintext ( token) => return Some ( token) == req. authorization . as_ref ( ) ,
@@ -832,7 +832,8 @@ impl HttpServer {
832
832
url : & ' a str ,
833
833
kip : & ' a str ,
834
834
}
835
- let footer: Footer = t ! ( serde_json:: from_slice( untrusted_token. untrusted_footer( ) ) . ok( ) ) ;
835
+ let footer: Footer < ' _ > =
836
+ t ! ( serde_json:: from_slice( untrusted_token. untrusted_footer( ) ) . ok( ) ) ;
836
837
if footer. kip != paserk_pub_key_id {
837
838
return false ;
838
839
}
@@ -846,7 +847,6 @@ impl HttpServer {
846
847
if footer. url != "https://github.com/rust-lang/crates.io-index"
847
848
&& footer. url != & format ! ( "sparse+http://{}/index/" , self . addr. to_string( ) )
848
849
{
849
- dbg ! ( footer. url) ;
850
850
return false ;
851
851
}
852
852
@@ -862,20 +862,18 @@ impl HttpServer {
862
862
_challenge : Option < & ' a str > , // todo: PASETO with challenges
863
863
v : Option < u8 > ,
864
864
}
865
- let message: Message = t ! ( serde_json:: from_str( trusted_token. payload( ) ) . ok( ) ) ;
865
+ let message: Message < ' _ > = t ! ( serde_json:: from_str( trusted_token. payload( ) ) . ok( ) ) ;
866
866
let token_time = t ! ( OffsetDateTime :: parse( message. iat, & Rfc3339 ) . ok( ) ) ;
867
867
let now = OffsetDateTime :: now_utc ( ) ;
868
868
if ( now - token_time) > Duration :: MINUTE {
869
869
return false ;
870
870
}
871
871
if private_key_subject. as_deref ( ) != message. sub {
872
- dbg ! ( message. sub) ;
873
872
return false ;
874
873
}
875
874
// - If the claim v is set, that it has the value of 1.
876
875
if let Some ( v) = message. v {
877
876
if v != 1 {
878
- dbg ! ( message. v) ;
879
877
return false ;
880
878
}
881
879
}
@@ -885,22 +883,18 @@ impl HttpServer {
885
883
if let Some ( mutation) = mutation {
886
884
// - That the operation matches the mutation field and is one of publish, yank, or unyank.
887
885
if message. mutation != Some ( mutation. mutation ) {
888
- dbg ! ( message. mutation) ;
889
886
return false ;
890
887
}
891
888
// - That the package, and version match the request.
892
889
if message. name != mutation. name {
893
- dbg ! ( message. name) ;
894
890
return false ;
895
891
}
896
892
if message. vers != mutation. vers {
897
- dbg ! ( message. vers) ;
898
893
return false ;
899
894
}
900
895
// - If the mutation is publish, that the version has not already been published, and that the hash matches the request.
901
896
if mutation. mutation == "publish" {
902
897
if message. cksum != mutation. cksum {
903
- dbg ! ( message. cksum) ;
904
898
return false ;
905
899
}
906
900
}
0 commit comments