-
Notifications
You must be signed in to change notification settings - Fork 121
docs: add cursor performance security commands #519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
vitalii-dynamiq
wants to merge
2
commits into
main
Choose a base branch
from
cursor/curser-performance-security-commands-09bc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| Analyze the current code for performance issues specific to the Dynamiq framework. | ||
|
|
||
| Focus on these areas: | ||
|
|
||
| 1. **DAG Execution**: Look for sequential bottlenecks where nodes could run in parallel. Check for unnecessary `node.depends_on()` chains and excessive `reset_run_state()` calls. | ||
|
|
||
| 2. **Executor Configuration**: Review thread pool settings. Check if `ProcessExecutor` is used where `ThreadExecutor` would be better for I/O workloads. Look for missing `executor.shutdown()` calls. | ||
|
|
||
| 3. **Connection Management**: Find nodes creating clients in `execute()` instead of `init_components()`. Check for missing `_connection_manager` storage and connection objects being recreated per-request. | ||
|
|
||
| 4. **Caching**: Identify nodes with deterministic outputs that have `caching.enabled = False`. Look for large objects being cached causing serialization overhead. | ||
|
|
||
| 5. **Agent Performance**: Check for high `max_loops` values, missing `stop_sequences`, and `parallel_tool_calls_enabled=True` creating new ThreadPoolExecutor per loop. | ||
|
|
||
| 6. **Async Patterns**: Find blocking calls in async context - `time.sleep()` instead of `asyncio.sleep()`, `requests.*` instead of httpx, sync file I/O in async methods. | ||
|
|
||
| 7. **Memory**: Look for unbounded growth in `_intermediate_steps`, prompt message accumulation without summarization, and unnecessary deep copies in `clone()`. | ||
|
|
||
| For each issue found, provide: | ||
| - File path and line number | ||
| - Description of the problem | ||
| - Suggested fix | ||
|
|
||
| Prioritize critical issues that significantly impact performance. | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| Review the changed files before creating a PR. Check against the project's BUGBOT rules and report any issues that would be flagged. | ||
|
|
||
| **Check for blocking issues first:** | ||
|
|
||
| 1. **Security**: No `eval()`/`exec()`/`compile()` outside the Python tool sandbox. No hardcoded secrets - use `Field(default_factory=partial(get_env_var, "KEY"))`. | ||
|
|
||
| 2. **Pydantic**: No `@dataclass` - use `BaseModel`. All structured data should use Pydantic models. | ||
|
|
||
| 3. **Node patterns**: | ||
| - External service nodes must extend `ConnectionNode` | ||
| - `init_components()` must call `super().init_components()` and store `_connection_manager` | ||
| - Never create clients in `execute()` - use `init_components()` | ||
|
|
||
| 4. **Serialization**: | ||
| - `to_dict()` must support `for_tracing` and `include_secure_params` parameters | ||
| - Nested nodes must call `to_dict()` with the same parameters | ||
| - Add `client`, `vector_store`, `executor` to `to_dict_exclude_params` | ||
|
|
||
| 5. **Async**: No blocking calls (`time.sleep()`, `requests.*`, sync file I/O) in async methods. | ||
|
|
||
| **Then check for style issues:** | ||
|
|
||
| 6. **Types**: All functions need type annotations for parameters and return values. | ||
|
|
||
| 7. **Naming**: | ||
| - Boolean fields use `*_enabled`/`*_allowed` suffix, not `enable_*`/`allow_*` prefix | ||
| - Methods use clear prefixes: `get_*`, `is_*`, `has_*`, `create_*`, `validate_*` | ||
| - No single-letter variables except loop indices | ||
|
|
||
| 8. **Node fields**: Nodes need `input_schema`, `NodeGroup`, `name`, `description`, and `Field()` with descriptions. | ||
|
|
||
| 9. **Tests**: New nodes need tests. Bug fixes need regression tests. | ||
|
|
||
| For each issue, provide the file, line number, what's wrong, and how to fix it. | ||
|
|
||
| End with a summary: how many blocking issues vs style issues found. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| Perform a security audit of the current code, focusing on vulnerabilities specific to the Dynamiq AI orchestration framework. | ||
|
|
||
| Check for these issues in order of severity: | ||
|
|
||
| **CRITICAL:** | ||
|
|
||
| 1. **Hardcoded Secrets**: Search for API keys, passwords, or tokens as string literals. They should use `Field(default_factory=partial(get_env_var, "VAR_NAME"))` instead. | ||
|
|
||
| 2. **Dangerous Code Execution**: Find any `eval()`, `exec()`, or `compile()` usage outside of `dynamiq/nodes/tools/python.py`. All dynamic code must go through the RestrictedPython sandbox. | ||
|
|
||
| 3. **Credential Exposure**: Check `to_dict()` implementations - they must support `include_secure_params=False` and never log credentials. | ||
|
|
||
| **HIGH:** | ||
|
|
||
| 4. **Injection Vulnerabilities**: Look for string interpolation in Cypher/SQL queries. Find user input directly embedded in LLM prompts without sanitization. | ||
|
|
||
| 5. **Missing Input Validation**: Identify nodes without `input_schema` Pydantic models, especially those accepting user input. | ||
|
|
||
| 6. **Unsafe Deserialization**: Check for `pickle.loads()` or `jsonpickle.decode()` on untrusted data. Review YAML loading for unsafe type resolution. | ||
|
|
||
| 7. **Authentication Issues**: Find `verify_certs=False`, missing TLS configuration, or credentials in connection strings. | ||
|
|
||
| **MEDIUM:** | ||
|
|
||
| 8. **Path Traversal**: Check file operations for `../` handling and path validation against allowed directories. | ||
|
|
||
| 9. **Missing Tenant Isolation**: Review vector store and memory backends for multi-tenant data separation. | ||
|
|
||
| 10. **Dependency Vulnerabilities**: Note any `# nosec` annotations and check critical dependencies like RestrictedPython, litellm, jsonpickle. | ||
|
|
||
| For each finding, report: | ||
| - Severity level (CRITICAL/HIGH/MEDIUM) | ||
| - File path and line number | ||
| - Description of the vulnerability | ||
| - Recommended fix |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ProcessExecutoris not functional for now due the shared memory issues, missed queues and so on.