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
@@ -117,7 +117,7 @@ func makeWriteExecutor(cwd string, mq *MutationQueue, rt *ReadTracker) Executor
|
||||
// file, a directory, a symlink, or any other non-regular entry returns false,
|
||||
// which lets new files skip the overwrite and read-before-write checks.
|
||||
func isRegularFile(path string) bool {
|
||||
info, err := os.Stat(path)
|
||||
info, err := os.Stat(path) //nolint:gosec // G703: callers confine path with isConfined first.
|
||||
return err == nil && info.Mode().IsRegular()
|
||||
}
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ func (p *Provider) writeMultimodalResult(toolName, summaryText string, media []p
|
||||
ext := extensionForMimeType(mimeType)
|
||||
name := fmt.Sprintf("%d%s", i, ext)
|
||||
path := filepath.Join(subdir, name)
|
||||
if err := os.WriteFile(path, raw, 0o644); err != nil {
|
||||
if err := os.WriteFile(path, raw, 0o644); err != nil { //nolint:gosec // G306: the agent reads tool media as another user.
|
||||
return tools.MultimodalResult{}, fmt.Errorf("MCP tool %s: write media block %d: %w", toolName, i, err)
|
||||
}
|
||||
files = append(files, path)
|
||||
|
||||
Reference in new issue
Block a user