Fix bandit B108 false positive warnings in agent examples #4107
+3
−3
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.
Suppresses false positive bandit B108 security warnings in the CrewAI and Haystack agent framework integration examples. These warnings were flagging hardcoded
/tmppaths, but the code is actually secure.Changes
Added
# nosec B108suppression comments with explanations to:examples/agent_framework_integrations/crewai/run.py(lines 23, 25)examples/agent_framework_integrations/haystack/run.py(line 21)Why This is Safe
The flagged code sets Docker environment variables (
HOMEandXDG_DATA_HOME) to/tmppaths for containerized execution. This is not the insecure temp file operation that bandit's B108 rule is designed to catch. In Docker containers,/tmpis the standard location for ephemeral storage, and there's no security risk from:Testing
Verified with targeted bandit scan:
Result: No issues identified (3 potential issues correctly skipped via nosec)
Note
These are example/demo files demonstrating integration patterns, not production security-critical code.