Skip to content

Commit

Permalink
luci-base: harden cookie sysauth=
Browse files Browse the repository at this point in the history
A simple scan of the code indicates that currently no code in the repo
is accessing the sysauth= cookie

Closes #1555

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
  • Loading branch information
yousong committed May 13, 2018
1 parent 88a1f8f commit 2f0f456
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/luci-base/luasrc/dispatcher.lua
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,9 @@ function dispatch(request)
return
end

http.header("Set-Cookie", 'sysauth=%s; path=%s' %{ sid, build_url() })
http.header("Set-Cookie", 'sysauth=%s; path=%s; HttpOnly%s' %{
sid, build_url(), http.getenv("HTTPS") == "on" and "; secure" or ""
})
http.redirect(build_url(unpack(ctx.requestpath)))
end

Expand Down

0 comments on commit 2f0f456

Please sign in to comment.