fix: agent security and linting improvements#3831
Open
Piyush0049 wants to merge 1 commit into
Open
Conversation
- 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
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces critical fixes for agent stability and defense in depth security, alongside resolving native Windows linting warnings.
Key Changes
forwardEventsandStartFileWatchergoroutines are cleanly terminated whenStop()is called, preventing silent memory and file descriptor leaks across tool reloads.\x00validation to static environment variables inscript_shell.go. This prevents malicious or malformedconfig.yamlfiles from injecting NUL bytes that would silently truncate the process environment at the kernelexecveboundary.errorlint,noctx, andbodyclosewarnings in Windows specific files (usingerrors.As,context.Background(), and explicit body closure) and safely managedgosecdirectives to ensure a perfectly cleangolangci-lint runstate.Testing Instructions
golangci-lint runreports 0 issues.task testpasses successfully.