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
@@ -93,7 +93,7 @@ func WriteTaskJSON(workspace string, payload TaskPayload) error {
|
||||
if err := os.MkdirAll(gitDir, 0o700); err != nil {
|
||||
return fmt.Errorf("task.json: %w", err)
|
||||
}
|
||||
return os.WriteFile(filepath.Join(gitDir, "task.json"), data, 0o644)
|
||||
return os.WriteFile(filepath.Join(gitDir, "task.json"), data, 0o644) //nolint:gosec // G306: the task container reads its brief as another user.
|
||||
}
|
||||
|
||||
// Pool manages a set of Docker containers running archie-agent.
|
||||
@@ -699,7 +699,7 @@ func encodeRegistryAuth(credential string) (string, error) {
|
||||
if auth.Username == "" && auth.Password == "" && auth.IdentityToken == "" && auth.RegistryToken == "" {
|
||||
return "", errors.New("registry credential names no username, password, identity token or registry token")
|
||||
}
|
||||
payload, err := json.Marshal(auth)
|
||||
payload, err := json.Marshal(auth) //nolint:gosec // G117: the registry credential is meant for the image pull's auth header.
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("encode registry credential: %w", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user