Skip to content

fix: agent security and linting improvements#3831

Open
Piyush0049 wants to merge 1 commit into
docker:mainfrom
Piyush0049:fix/security-and-linting-updates
Open

fix: agent security and linting improvements#3831
Piyush0049 wants to merge 1 commit into
docker:mainfrom
Piyush0049:fix/security-and-linting-updates

Conversation

@Piyush0049

Copy link
Copy Markdown
Contributor

Description

This PR introduces critical fixes for agent stability and defense in depth security, alongside resolving native Windows linting warnings.

Key Changes

  • RAG Goroutine Leak: Added a cancellable child context and synchronization channel to the RAG ToolSet. This ensures the forwardEvents and StartFileWatcher goroutines are cleanly terminated when Stop() is called, preventing silent memory and file descriptor leaks across tool reloads.
  • Execve Environment Truncation: Added \x00 validation to static environment variables in script_shell.go. This prevents malicious or malformed config.yaml files from injecting NUL bytes that would silently truncate the process environment at the kernel execve boundary.
  • Linting Cleanups: Resolved native errorlint, noctx, and bodyclose warnings in Windows specific files (using errors.As, context.Background(), and explicit body closure) and safely managed gosec directives to ensure a perfectly clean golangci-lint run state.

Testing Instructions

  • Verified golangci-lint run reports 0 issues.
  • Verified task test passes successfully.

- Fix goroutine leak in RAG file watcher

- Prevent NUL byte truncation injection in script shell env vars

- Fix errorlint, noctx, and bodyclose linter warnings on Windows

- Restore and manage necessary gosec directives
@Piyush0049
Piyush0049 requested a review from a team as a code owner July 24, 2026 20:14
@aheritier aheritier added area/testing Test infrastructure, CI/CD, test runners, evaluation area/tools For features/issues/fixes related to the usage of built-in and MCP tools kind/fix PR fixes a bug (maps to fix:). Use on PRs only. labels Jul 24, 2026
@aheritier
aheritier requested a review from docker-agent July 25, 2026 11:11
@aheritier

Copy link
Copy Markdown
Contributor

Same here @Piyush0049

Please provide more details about the issue you are trying to solve. Is it something which happens often? What are the symptoms?

Right now the PR doesn't provide enough context to understand if you are fixing a bug or if these are just code reviews by an LLM which could easily hallucinate bugs.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing Test infrastructure, CI/CD, test runners, evaluation area/tools For features/issues/fixes related to the usage of built-in and MCP tools kind/fix PR fixes a bug (maps to fix:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants