fix: Address mechanical review findings (security, performance, code hygiene)#52
Merged
fix: Address mechanical review findings (security, performance, code hygiene)#52
Conversation
…hygiene) - Fix Jinja2 SSTI vulnerability using SandboxedEnvironment (Item 1) - Remove unused cloudpickle dependency (Item 2) - Replace print() with structured logging, strip emoji (Item 3) - Replace list.pop(0) with deque.popleft() for O(1) BFS (Item 4) - Add edge adjacency indices for O(1) graph lookups (Item 5) - Narrow except Exception to specific types at 17 locations (Item 6)
Add *args to BaseTool.run() so subclasses can define specific parameters without violating the Liskov Substitution Principle.
- agent.py: Use lambda for sorted key to avoid list[Sized] inference - lineage_builder.py: Add type: ignore for union-attr, ensure str types - mcp/server.py: Add type: ignore for optional mcp imports, assert Server availability, annotate schema dict - multi_query.py: Remove unused type: ignore comment - orchestrators: Add type: ignore for optional dagster/prefect imports - query_parser.py: Use str() to ensure alias types after guard blocks - tools/governance.py: Suppress mixed-type dict append with type: ignore - visualizations.py: Replace hasattr with isinstance for type narrowing
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
Addresses 6 mechanical fixes identified during a staff engineer review of the clgraph codebase:
jinja2.TemplatewithSandboxedEnvironmentinmulti_query.pycloudpicklefrom core dependenciesprint()calls with structuredloggingmodule usage; strip emoji from log messageslist.pop(0)(O(n)) withcollections.deque.popleft()(O(1)) across 11 BFS traversals in 5 files_outgoing_index/_incoming_index) toColumnLineageGraphandPipelineLineageGraphfor O(1) edge lookups instead of O(E) linear scans; cache_build_column_dependencies()except Exceptioncatches to specific exception types (SqlglotError,KeyError,ValueError, etc.); add debug-level logging at boundary handlersFiles changed (15)
multi_query.pypyproject.toml/uv.lockpipeline.pyexecution.pyagent.pycolumn.pymodels.pylineage_builder.pyvisualizations.pytable.py__init__.pymcp/server.pytools/sql.pytests/test_validation_framework.pyTest plan
ruff checkandruff formatpassSandboxedEnvironmentblocks SSTI payloads like{{ ''.__class__.__mro__[1].__subclasses__() }}logging.basicConfig(level=logging.INFO)shows pipeline progress