mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-07 17:02:29 +01:00
fix (iframe): iframe cookie block rollout
This commit is contained in:
parent
a0540eecae
commit
919ee10a81
2 changed files with 30 additions and 25 deletions
6
Jenkinsfile
vendored
6
Jenkinsfile
vendored
|
|
@ -27,7 +27,7 @@ pipeline {
|
||||||
sh "npm install"
|
sh "npm install"
|
||||||
sh "make build_frontend"
|
sh "make build_frontend"
|
||||||
}
|
}
|
||||||
docker.image("golang:1.21-bookworm").inside("--user=root") {
|
docker.image("golang:1.23-bookworm").inside("--user=root") {
|
||||||
// prepare: todo - statically compile plg_image_c so we don't have to do this to pass the e2e tests
|
// prepare: todo - statically compile plg_image_c so we don't have to do this to pass the e2e tests
|
||||||
sh "sed -i 's|plg_image_c|plg_image_golang|' server/plugin/index.go"
|
sh "sed -i 's|plg_image_c|plg_image_golang|' server/plugin/index.go"
|
||||||
// build
|
// build
|
||||||
|
|
@ -42,7 +42,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
// smoke test
|
// smoke test
|
||||||
docker.image("golang:1.21-bookworm").inside("--user=root") {
|
docker.image("golang:1.23-bookworm").inside("--user=root") {
|
||||||
sh 'timeout 5 ./dist/filestash > access.log || code=$?; if [ $code -ne 124 ]; then exit $code; fi'
|
sh 'timeout 5 ./dist/filestash > access.log || code=$?; if [ $code -ne 124 ]; then exit $code; fi'
|
||||||
sh "cat access.log"
|
sh "cat access.log"
|
||||||
sh "cat access.log | grep -q \"\\[http\\] starting\""
|
sh "cat access.log | grep -q \"\\[http\\] starting\""
|
||||||
|
|
@ -63,7 +63,7 @@ pipeline {
|
||||||
// sh "cd public && npm run test"
|
// sh "cd public && npm run test"
|
||||||
}
|
}
|
||||||
// test backend
|
// test backend
|
||||||
docker.image("golang:1.21-bookworm").inside("--user=root") {
|
docker.image("golang:1.23-bookworm").inside("--user=root") {
|
||||||
sh "cp ./test/assets/* /tmp/"
|
sh "cp ./test/assets/* /tmp/"
|
||||||
sh "go generate ./test/unit_go/..."
|
sh "go generate ./test/unit_go/..."
|
||||||
sh "go get ./..."
|
sh "go get ./..."
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,7 @@ func SessionAuthenticate(ctx *App, res http.ResponseWriter, req *http.Request) {
|
||||||
if Config.Get("features.protection.iframe").String() != "" {
|
if Config.Get("features.protection.iframe").String() != "" {
|
||||||
c.Secure = true
|
c.Secure = true
|
||||||
c.SameSite = http.SameSiteNoneMode
|
c.SameSite = http.SameSiteNoneMode
|
||||||
|
c.Partitioned = true
|
||||||
if f := req.Header.Get("Referer"); f != "" && strings.HasPrefix(f, "https://") == false {
|
if f := req.Header.Get("Referer"); f != "" && strings.HasPrefix(f, "https://") == false {
|
||||||
Log.Warning("you are trying to access Filestash from a non secure origin ('%s') and with iframe enabled. Either use SSL or disable iframe from the admin console.", f)
|
Log.Warning("you are trying to access Filestash from a non secure origin ('%s') and with iframe enabled. Either use SSL or disable iframe from the admin console.", f)
|
||||||
}
|
}
|
||||||
|
|
@ -166,6 +167,7 @@ func SessionLogout(ctx *App, res http.ResponseWriter, req *http.Request) {
|
||||||
Value: "",
|
Value: "",
|
||||||
MaxAge: -1,
|
MaxAge: -1,
|
||||||
Path: COOKIE_PATH,
|
Path: COOKIE_PATH,
|
||||||
|
Partitioned: true,
|
||||||
})
|
})
|
||||||
index++
|
index++
|
||||||
}
|
}
|
||||||
|
|
@ -294,6 +296,7 @@ func SessionAuthMiddleware(ctx *App, res http.ResponseWriter, req *http.Request)
|
||||||
Path: COOKIE_PATH,
|
Path: COOKIE_PATH,
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
SameSite: http.SameSiteLaxMode,
|
SameSite: http.SameSiteLaxMode,
|
||||||
|
Partitioned: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if err := plugin.EntryPoint(idpParams, req, res); err != nil {
|
if err := plugin.EntryPoint(idpParams, req, res); err != nil {
|
||||||
|
|
@ -443,6 +446,7 @@ func SessionAuthMiddleware(ctx *App, res http.ResponseWriter, req *http.Request)
|
||||||
Path: COOKIE_PATH,
|
Path: COOKIE_PATH,
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
SameSite: http.SameSiteStrictMode,
|
SameSite: http.SameSiteStrictMode,
|
||||||
|
Partitioned: true,
|
||||||
})
|
})
|
||||||
http.SetCookie(res, &http.Cookie{
|
http.SetCookie(res, &http.Cookie{
|
||||||
Name: SSOCookieName,
|
Name: SSOCookieName,
|
||||||
|
|
@ -451,6 +455,7 @@ func SessionAuthMiddleware(ctx *App, res http.ResponseWriter, req *http.Request)
|
||||||
Path: COOKIE_PATH,
|
Path: COOKIE_PATH,
|
||||||
HttpOnly: true,
|
HttpOnly: true,
|
||||||
SameSite: http.SameSiteLaxMode,
|
SameSite: http.SameSiteLaxMode,
|
||||||
|
Partitioned: true,
|
||||||
})
|
})
|
||||||
redirectURI := templateBind["next"]
|
redirectURI := templateBind["next"]
|
||||||
if redirectURI == "" {
|
if redirectURI == "" {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue