fix(webui): mark cookies Secure behind a TLS proxy; run gosec in the gate (#1919)
Cookies took Secure from r.TLS, which is nil behind a proxy that terminates TLS, so sign-in cookies went out without it. Every dashboard cookie now goes through one builder that reads the scheme the way the origin check does. The worktree reset and the agent worker's chown walk use os.Root, so a symlink swapped in mid-walk can't point them outside the worktree. gosec runs in golangci-lint, tests included. G104, G115, G204 and G304 are excluded in config; each remaining finding is fixed or suppressed at the site with its reason.
This commit is contained in:
46 files changed
+199
-115
No files matched your search
@@ -21,9 +21,9 @@ func testProvisionRoles() provisionRoles {
|
||||
// plan that would leave the runtime role owning schema changes.
|
||||
func TestParseProvisionURLs(t *testing.T) {
|
||||
const (
|
||||
adminURL = "postgres://archie:admin@db.internal/archie"
|
||||
runtimeURL = "postgres://archie_runtime:runtime@db.internal/archie"
|
||||
migrationURL = "postgres://archie_migrator:migration@db.internal/archie"
|
||||
adminURL = "postgres://archie:admin@db.internal/archie" //nolint:gosec // G101: fake database URLs.
|
||||
runtimeURL = "postgres://archie_runtime:runtime@db.internal/archie" //nolint:gosec // G101: fake database URLs.
|
||||
migrationURL = "postgres://archie_migrator:migration@db.internal/archie" //nolint:gosec // G101: fake database URLs.
|
||||
)
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -75,7 +75,7 @@ func TestParseProvisionURLs(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "the same role cannot be runtime and migration",
|
||||
opts: ProvisionOptions{AdminURL: adminURL, RuntimeURL: runtimeURL, MigrationURL: "postgres://archie_runtime:other@db.internal/archie"},
|
||||
opts: ProvisionOptions{AdminURL: adminURL, RuntimeURL: runtimeURL, MigrationURL: "postgres://archie_runtime:other@db.internal/archie"}, //nolint:gosec // G101: a fake database URL.
|
||||
wantErr: "same role",
|
||||
},
|
||||
{
|
||||
@@ -85,7 +85,7 @@ func TestParseProvisionURLs(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "a non-PostgreSQL URL is refused",
|
||||
opts: ProvisionOptions{AdminURL: "mysql://archie:admin@db.internal/archie", RuntimeURL: runtimeURL, MigrationURL: migrationURL},
|
||||
opts: ProvisionOptions{AdminURL: "mysql://archie:admin@db.internal/archie", RuntimeURL: runtimeURL, MigrationURL: migrationURL}, //nolint:gosec // G101: a fake database URL.
|
||||
wantErr: "postgres:// URL",
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user