security: remove temp-file fallback for large responses (closes CodeQL #5)#17
Open
willwebster5 wants to merge 1 commit into
Open
security: remove temp-file fallback for large responses (closes CodeQL #5)#17willwebster5 wants to merge 1 commit into
willwebster5 wants to merge 1 commit into
Conversation
…sponseStore Closes CodeQL alert py/clear-text-storage-sensitive-data (#5). The legacy fallback in format_text_response wrote oversized tool responses to $TMPDIR/crowdstrike-mcp/*.txt, exposing MAC/IP/hostname PII on disk. Migrate the six tools that could overflow LARGE_RESPONSE_THRESHOLD to pass structured_data= (threat_graph list ops, rtr_check_command_status, spotlight vuln lists, hosts login/network history, cloud_risk_timeline full mode, identity_investigate_entity raw mode). Delete the fallback branch and helpers (_write_response_file, _cleanup_old_files, MCP_OUTPUT_DIR, set_current_tool); oversized responses without structured_data now return a developer warning instead of spilling bytes to disk. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
py/clear-text-storage-sensitive-data(#5) by removing the legacy temp-file fallback informat_text_response. The fallback wrote oversized tool output to$TMPDIR/crowdstrike-mcp/*.txt, spilling MAC/IP/hostname PII to disk with world-readable umask.LARGE_RESPONSE_THRESHOLD(20,000 chars) to passstructured_data=intoformat_text_response, so their payloads are stored in the existing in-memoryResponseStore(process-scoped, ring-buffered, never hits disk) and surfaced via theget_stored_responsetool instead ofcat/grepon a temp file._write_response_file,_cleanup_old_files,MCP_OUTPUT_DIR,set_current_tool, and relatedtempfile/datetimeimports fromutils.py. Large responses withoutstructured_datanow return a truncated summary with a loud developer warning — no disk I/O under any path.Scope of migration
threatgraph_get_vertices/edges/ran_on/summarymodules/threat_graph.pyrtr_check_command_statusmodules/rtr.pyspotlight_host_vulns/spotlight_vulnerabilities_combinedmodules/spotlight.pyhost_login_history/host_network_historymodules/hosts.pycloud_get_risk_timeline(full=True)modules/cloud_security.pyidentity_investigate_entity(include_raw=True)modules/idp.pyTest plan
pytest tests/— 404 passed (+8 new, incl. one per migrated tool and one asserting the fallback machinery is gone)ruff check src/ tests/cleanruff format --checkcleanmasterthreatgraph_get_edgeswith a high-fanout vertex) and confirm the response footer referencesget_stored_response(ref_id=...)rather than a temp file🤖 Generated with Claude Code