perf: remove path validation delay#43
Merged
Merged
Conversation
Path validation was wrapped in a timing-normalization decorator that added at least 50ms to every file-path validation. That delay is unnecessary for path validation because no secret-dependent comparison happens there, and it materially slows convert_file calls and any workflow that validates many paths.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
🔍 PR Analysis ResultsPR: #43 | Commit: 🎨 Code Formatting✅ All files properly formatted 🔧 Code Linting✅ No linting issues found 📝 Type Checking❌ Type checking issues found Click to see type issuesFix: Add proper type annotations and resolve type errors 🔒 Security Analysis✅ No security issues detected 📊 Test Coverage Analysis✅ Coverage 82.17636022514071% meets 80% requirement 🧹 Dead Code Analysis✅ Dead code analysis completed 📋 Summary
🔧 Quick Fix Commands:# Fix formatting and auto-fixable linting issues
ruff format .
ruff check . --fix
# Run tests with coverage
pytest tests/unit/ --cov=markitdown_mcp --cov-report=term-missing
# Check security
bandit -r markitdown_mcp/This analysis was automatically generated by the PR feedback workflow. |
Contributor
🔍 CI Quality Gates SummaryOverall Status: ✅ All Passed
🔗 Quick Links🛠️ Quick Fix Commands# Fix most issues automatically
ruff format .
ruff check . --fix
# Run tests locally
pytest tests/unit/ --cov=markitdown_mcp
# Check types
mypy markitdown_mcpLast updated: 2026-06-10 11:02:26 UTC |
Contributor
🔍 PR Quality SummaryCI Status✅ Security: success Metrics
Quality Checks
MCP Tools
🤖 Auto-generated by CI • Last updated: 2026-06-10 11:04 UTC |
trsdn
pushed a commit
that referenced
this pull request
Jun 10, 2026
## 🚀 Version Bump: v1.2.2 This PR bumps the package version after the merged fixes and performance cleanup. ### 📊 Release Summary - **Version Type**: patch - **New Version**: v1.2.2 - **Commits Included**: consolidated fixes from #44 and performance cleanup from #43 ### 📝 Changelog Preview ### 🐛 Bug Fixes - Resolve MCP protocol and file validation issues (#44) ### ⚡ Performance - Remove artificial path validation delay (#43) ### 🎯 What Happens Next 1. **Review**: Maintainers review this version bump 2. **Merge**: When merged, a git tag `v1.2.2` will be created 3. **Release**: The tag will trigger the automated release workflow 4. **Publish**: Package will be published to PyPI automatically ### ✅ Pre-Release Checklist - [x] Version number looks correct - [x] Changelog entries are accurate - [x] No breaking changes in patch release - [ ] All CI checks pass --- *This PR was originally created automatically by the version bump workflow and updated after #43 merged.*
4 tasks
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
Removes the timing-normalization wrapper from
validate_and_sanitize_path(). The wrapper added a minimum ~50ms delay to every path validation even though this code path does not compare secrets or perform authentication checks.Measured locally:
This improves
convert_filelatency and any workflow that validates many paths while preserving the existing path traversal, directory allow-list, dangerous path, and extension checks.10 performance improvements identified
infotodebugto reduce repeated conversion overhead and noisy stderr during batch operations.convert_directoryconversions with bounded concurrency instead of processing supported files serially.convert_directory; write synchronously after conversion or batch writes.list_supported_formatscall.read()+json.loads()validation with a streaming/depth-limited parser to reduce memory for large JSON files.Validation
ruff check markitdown_mcp/server.pypytest tests/unit/test_convert_file_tool.py tests/unit/test_convert_directory_tool.py tests/security/test_path_traversal.py --quiet— 62 passedpytest -m 'not performance and not slow and not security' --quiet— 190 passed, 2 skipped, 90 deselectedpytest tests/security/test_path_traversal.py --quiet— 18 passedNote: full
pytest --quietcurrently fails in unrelated existing performance/security tests: two memory-threshold tests intests/performance/test_memory_usage.pyand two JSON bomb generation failures intests/security/test_malicious_files.pyon Python 3.12 before the server handles the files.