protondrive: fix signature verification logic by accounting for legacy signing scheme (#7278)

This commit is contained in:
Chun-Hung Tseng 2023-09-08 16:00:34 +08:00 committed by GitHub
parent 63ab250817
commit 578c75cb1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 13 deletions

View File

@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
"log"
"path"
"strings"
"time"
@ -264,12 +263,12 @@ func clearConfigMap(m configmap.Mapper) {
}
func authHandler(auth proton.Auth) {
// log.Println("authHandler called")
// fs.Debugf("authHandler called")
setConfigMap(_mapper, auth.UID, auth.AccessToken, auth.RefreshToken, _saltedKeyPass)
}
func deAuthHandler() {
// log.Println("deAuthHandler called")
// fs.Debugf("deAuthHandler called")
clearConfigMap(_mapper)
}
@ -786,9 +785,7 @@ func (o *Object) Hash(ctx context.Context, t hash.Type) (string, error) {
return *o.digests, nil
}
// sha1 not cached
log.Println("sha1 not cached")
// we fetch and try to obtain the sha1 of the link
// sha1 not cached: we fetch and try to obtain the sha1 of the link
fileSystemAttrs, err := o.fs.protonDrive.GetActiveRevisionAttrsByID(ctx, o.ID())
if err != nil {
return "", err
@ -810,7 +807,7 @@ func (o *Object) Size() int64 {
return *o.originalSize
}
fs.Errorf(o, "Original size should exist")
fs.Debugf(o, "Original file size missing")
}
return o.size
}

4
go.mod
View File

@ -28,8 +28,8 @@ require (
github.com/go-chi/chi/v5 v5.0.10
github.com/google/uuid v1.3.1
github.com/hanwen/go-fuse/v2 v2.3.0
github.com/henrybear327/Proton-API-Bridge v0.0.0-20230906013317-762502d1fb60
github.com/henrybear327/go-proton-api v0.0.0-20230905230058-67e3daa437a2
github.com/henrybear327/Proton-API-Bridge v0.0.0-20230908065933-5bfa15b567db
github.com/henrybear327/go-proton-api v0.0.0-20230907193451-e563407504ce
github.com/hirochachacha/go-smb2 v1.1.0
github.com/iguanesolutions/go-systemd/v5 v5.1.1
github.com/jcmturner/gokrb5/v8 v8.4.4

8
go.sum
View File

@ -296,10 +296,10 @@ github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/C
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/henrybear327/Proton-API-Bridge v0.0.0-20230906013317-762502d1fb60 h1:EqMPJXqpoFGqkMd2RFMPpo/hRBYI9j2nGoAHXaC932Q=
github.com/henrybear327/Proton-API-Bridge v0.0.0-20230906013317-762502d1fb60/go.mod h1:79lPvh2duLpDDfXN5XThz6QBa3cfKljDChWDpNSC1jY=
github.com/henrybear327/go-proton-api v0.0.0-20230905230058-67e3daa437a2 h1:6qH4QnxEDNwWrKG/qqikGGg5SzUJezYSJyB36Glu3No=
github.com/henrybear327/go-proton-api v0.0.0-20230905230058-67e3daa437a2/go.mod h1:w63MZuzufKcIZ93pwRgiOtxMXYafI8H74D77AxytOBc=
github.com/henrybear327/Proton-API-Bridge v0.0.0-20230908065933-5bfa15b567db h1:EpttN0oeR6BvUPis9+4iSyxIacMHXlaHrD/+IvyKPlc=
github.com/henrybear327/Proton-API-Bridge v0.0.0-20230908065933-5bfa15b567db/go.mod h1:gunH16hf6U74W2b9CGDaWRadiLICsoJ6KRkSt53zLts=
github.com/henrybear327/go-proton-api v0.0.0-20230907193451-e563407504ce h1:n1URi7VYiwX/3akX51keQXi6Huy4lJdVc4biJHYk3iw=
github.com/henrybear327/go-proton-api v0.0.0-20230907193451-e563407504ce/go.mod h1:w63MZuzufKcIZ93pwRgiOtxMXYafI8H74D77AxytOBc=
github.com/hirochachacha/go-smb2 v1.1.0 h1:b6hs9qKIql9eVXAiN0M2wSFY5xnhbHAQoCwRKbaRTZI=
github.com/hirochachacha/go-smb2 v1.1.0/go.mod h1:8F1A4d5EZzrGu5R7PU163UcMRDJQl4FtcxjBfsY8TZE=
github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo=