Repository navigation
Conversation
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 6 to 7. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@v6...v7) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6 to 7. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](actions/setup-python@v6...v7) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 3.0.1 to 3.0.3. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](softprops/action-gh-release@718ea10...efb3536) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-version: 3.0.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 7.0.0 to 7.1.1. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@fb8b358...303a32d) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-version: 7.1.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
refactor: update release workflow and pull request template for clarity and organization Co-authored-by: Ajimaru <Ajimaru@users.noreply.github.com>
# Description This pull request introduces robust protections against Regular Expression Denial of Service (ReDoS) in the log search feature, ensuring that user-supplied search patterns cannot hang or exhaust server resources. It does so by enforcing per-pattern execution timeouts (using the `regex` module), bounding the total number of lines scanned per request, and safely handling invalid or dangerous patterns. The changes also include comprehensive regression tests for these protections. The most important changes are: **ReDoS Mitigation and Search Safety** * Introduced the `regex` module as a dependency to enable per-call regex execution timeouts, preventing user-supplied patterns from causing catastrophic backtracking and CPU exhaustion. Fall-back heuristics are used if the module is unavailable. (`pyproject.toml`, `octoprint_logmonitor/security.py`) [[1]](diffhunk://#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711L18-R27) [[2]](diffhunk://#diff-41a8e5a5fa5019f8f91d8233685c7a44fdb88c202fd58fd8f39dde68cfdafd64L12-R26) [[3]](diffhunk://#diff-41a8e5a5fa5019f8f91d8233685c7a44fdb88c202fd58fd8f39dde68cfdafd64L29-R60) [[4]](diffhunk://#diff-41a8e5a5fa5019f8f91d8233685c7a44fdb88c202fd58fd8f39dde68cfdafd64R338-R453) * Added a hard limit (`MAX_SCAN_LINES`) on the number of log lines scanned per search request to bound total resource usage, with the search response indicating when this limit is reached. (`octoprint_logmonitor/security.py`, `octoprint_logmonitor/log_searcher.py`) [[1]](diffhunk://#diff-41a8e5a5fa5019f8f91d8233685c7a44fdb88c202fd58fd8f39dde68cfdafd64L29-R60) [[2]](diffhunk://#diff-e906023f371a948050e1f66ec8a75239636761f1ed4fc4ddc5c5158d7524f8acR173-R187) [[3]](diffhunk://#diff-e906023f371a948050e1f66ec8a75239636761f1ed4fc4ddc5c5158d7524f8acL207-R261) **Pattern Compilation and Error Handling** * Centralized pattern compilation and execution in new utility functions (`compile_search_pattern`, `search_with_timeout`), which enforce timeouts, detect unsafe patterns, and handle syntax errors consistently. Errors are now reported to the client in a structured way, never causing server exceptions. (`octoprint_logmonitor/security.py`, `octoprint_logmonitor/log_searcher.py`) [[1]](diffhunk://#diff-41a8e5a5fa5019f8f91d8233685c7a44fdb88c202fd58fd8f39dde68cfdafd64R338-R453) [[2]](diffhunk://#diff-e906023f371a948050e1f66ec8a75239636761f1ed4fc4ddc5c5158d7524f8acL16-R24) [[3]](diffhunk://#diff-e906023f371a948050e1f66ec8a75239636761f1ed4fc4ddc5c5158d7524f8acL125-R148) [[4]](diffhunk://#diff-e906023f371a948050e1f66ec8a75239636761f1ed4fc4ddc5c5158d7524f8acL260-R313) **Testing** * Added a dedicated test suite (`TestRegexDoSProtection`) with regression tests to verify that dangerous patterns are safely rejected or timed out, legitimate searches still work, and line scan limits are enforced. (`tests/test_log_searcher.py`) These changes significantly harden the log search endpoint against resource exhaustion attacks while preserving correct and predictable behavior for legitimate queries. ## Related Issues ## Type of Change - [ ] Bugfix - [x] Feature - [ ] Docs - [ ] Refactor - [ ] Security ## Checklist - [x] Description of change - [ ] Related issue(s) - [x] Tests added / updated - [ ] Documentation updated Co-authored-by: Ajimaru <Ajimaru@users.noreply.github.com>
…g file downloads (#32) # Description This pull request addresses a critical bug with log file downloads, improves memory safety, and enhances the user experience when downloading logs. The main changes include ensuring the downloaded file size matches the advertised Content-Length to prevent server errors, enforcing a memory-safe download size limit, and improving the frontend download flow with better error handling and UI feedback. Additional updates include new regression tests and translation catalog updates. **Bug fixes and backend improvements:** * The log download endpoint now reads the entire file into memory before sending it, ensuring the `Content-Length` header matches the actual body size even if the log file grows during the request. This prevents Tornado server errors caused by mismatched content lengths. (`octoprint_logmonitor/__init__.py`) * Introduced a strict maximum download size (`MAX_DOWNLOAD_BYTES`, default 64 MiB) to prevent excessive memory use, especially important for devices with limited RAM. Files exceeding this limit are refused with a clear error message. (`octoprint_logmonitor/security.py`, `octoprint_logmonitor/__init__.py`) [[1]](diffhunk://#diff-41a8e5a5fa5019f8f91d8233685c7a44fdb88c202fd58fd8f39dde68cfdafd64R36-R42) [[2]](diffhunk://#diff-cde56103e85d941d453102d07311ee781e056a66958f75ef17ea16c28ad037c6R25) **Frontend and user experience:** * The download button is now disabled while a download is in progress to prevent repeated requests for large files. The download is performed via AJAX, with improved error handling and user notifications if the download fails. (`octoprint_logmonitor/static/js/logmonitor.js`, `octoprint_logmonitor/templates/logmonitor_tab.jinja2`) [[1]](diffhunk://#diff-a94d011c290f077261d7f9a1f2aaf45c80428a437bd72d48f53db463b9acbcc5R141-R143) [[2]](diffhunk://#diff-a94d011c290f077261d7f9a1f2aaf45c80428a437bd72d48f53db463b9acbcc5R968-R1037) [[3]](diffhunk://#diff-dc6958562dfd60a69726029c5c278b4c10dfcfbd05af6bf72d914938fed5a60eL32-R32) **Testing and regression coverage:** * Added regression tests to ensure that the file download endpoint correctly synchronizes `Content-Length` and the actual body size, and that the download size limit is enforced as intended. (`tests/test_integration_api.py`) **Translation and catalog maintenance:** * Updated translation catalogs and message extraction to reflect changes in the JavaScript code, including line number updates and Babel version bumps. (`translations/messages.pot`, `translations/de/LC_MESSAGES/messages.po`) [[1]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L10-R10) [[2]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L19-R32) [[3]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L229-R237) [[4]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L287-R287) [[5]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L307-R311) [[6]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L395-R395) [[7]](diffhunk://#diff-23223ffa0d428b33548d614c397707d7b03d1ccd39dff7cd8809fa6e62af39a2L11-R31) [[8]](diffhunk://#diff-23223ffa0d428b33548d614c397707d7b03d1ccd39dff7cd8809fa6e62af39a2L222-R230) [[9]](diffhunk://#diff-23223ffa0d428b33548d614c397707d7b03d1ccd39dff7cd8809fa6e62af39a2L278-R278) [[10]](diffhunk://#diff-23223ffa0d428b33548d614c397707d7b03d1ccd39dff7cd8809fa6e62af39a2L298-R302) [[11]](diffhunk://#diff-23223ffa0d428b33548d614c397707d7b03d1ccd39dff7cd8809fa6e62af39a2L382-R382) These changes together make log downloads more robust, safer for low-memory environments, and more user-friendly. ## Type of Change - [x] Bugfix - [x] Feature - [ ] Docs - [ ] Refactor - [ ] Security ## Checklist - [x] Description of change - [ ] Related issue(s) - [x] Tests added / updated - [ ] Documentation updated Co-authored-by: Ajimaru <Ajimaru@users.noreply.github.com>
…#33) # Description This pull request addresses a silent bug in JavaScript translation string extraction caused by Babel's JSX lexer, ensures all gettext() calls are correctly extracted, and adds regression tests to prevent future issues. It also updates translation templates and the German translation catalog to include a previously missing string and improve formatting. **Internationalization extraction and configuration:** * Disabled JSX parsing in the JavaScript extractor section of `babel.cfg` to prevent Babel from misinterpreting regex literals as JSX, which caused all subsequent gettext() calls to be dropped from the catalog. * Added regression tests in `tests/test_i18n_extraction.py` to ensure the Babel configuration reliably extracts all translation strings, especially those after problematic code patterns. **Translation updates:** * Updated `octoprint_logmonitor/static/js/logmonitor.js` to wrap the "Failed to download log file" message in `gettext()`, making it translatable. * Updated `translations/messages.pot` and `translations/de/LC_MESSAGES/messages.po` to include the new "Failed to download log file" string and to improve formatting and consistency in several multi-line messages. [[1]](diffhunk://#diff-23223ffa0d428b33548d614c397707d7b03d1ccd39dff7cd8809fa6e62af39a2R146-R149) [[2]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2R154-R157) [[3]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L68-R69) [[4]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L270-R276) [[5]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L359-R366) [[6]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L371-R380) [[7]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L401-R410) [[8]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L427-R444) [[9]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L444-L450) **Translation template metadata:** * Updated the POT-Creation-Date in translation template files to reflect the latest extraction. [[1]](diffhunk://#diff-23223ffa0d428b33548d614c397707d7b03d1ccd39dff7cd8809fa6e62af39a2L11-R11) [[2]](diffhunk://#diff-7bbaceb3b8b7a78ec382ae40085e5ceded5173447987067b676afaacce2560c2L10-R18) ## Type of Change - [x] Bugfix - [ ] Feature - [ ] Docs - [ ] Refactor - [ ] Security ## Checklist - [x] Description of change - [ ] Related issue(s) - [x] Tests added / updated - [ ] Documentation updated Co-authored-by: Ajimaru <Ajimaru@users.noreply.github.com>
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| ErrorProne | 1 high |
🟢 Metrics 36 complexity · 0 duplication
Metric Results Complexity 36 Duplication 0
🟢 Coverage 84.95% diff coverage · +0.02% coverage variation
Metric Results Coverage variation ✅ +0.02% coverage variation (-1.00%) Diff coverage ✅ 84.95% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (5ac8e1b) Report Missing Report Missing Report Missing Head commit (b8a6332) 2510 (+1336) 2070 (+1102) 82.47% (+0.02%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#34) 93 79 84.95% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
…safety (#35) # Description This pull request replaces the regular expression-based heuristic for detecting potentially catastrophic regular expressions (ReDoS risks) with a custom linear-time scan, addressing a CodeQL alert about the previous approach being itself vulnerable to ReDoS. It also introduces comprehensive tests to verify the new implementation’s correctness and performance. **Heuristic replacement for ReDoS detection:** * Replaces the regex-based `_NESTED_QUANTIFIER_RE` with a new linear-time scan in `_looks_catastrophic`, which analyzes patterns for nested quantifiers and alternations without risking quadratic runtime. This avoids the previous vulnerability where the ReDoS guard could itself be attacked. [[1]](diffhunk://#diff-41a8e5a5fa5019f8f91d8233685c7a44fdb88c202fd58fd8f39dde68cfdafd64L351-R352) [[2]](diffhunk://#diff-41a8e5a5fa5019f8f91d8233685c7a44fdb88c202fd58fd8f39dde68cfdafd64L377-R441) * Adds `_QUANTIFIER_CHARS` as a set of quantifier characters to simplify detection logic in the scan. **Testing and validation:** * Exposes `_looks_catastrophic` for testing and adds a new `TestCatastrophicPatternHeuristic` test class that: - Verifies classic catastrophic patterns are correctly rejected. - Ensures legitimate patterns are accepted. - Confirms that quantifiers inside character classes and escaped parentheses are handled safely. - Checks that the scan runs in linear time even on large inputs. - Ensures malformed patterns do not cause crashes. [[1]](diffhunk://#diff-8793908c3adeba22dbedcdf620d3d4456cc1e7e0df9d1e69a62f01646dab3ddeR24) [[2]](diffhunk://#diff-8793908c3adeba22dbedcdf620d3d4456cc1e7e0df9d1e69a62f01646dab3ddeR441-R513) ## Type of Change - [ ] Bugfix - [x] Feature - [ ] Docs - [ ] Refactor - [ ] Security ## Checklist - [x] Description of change - [ ] Related issue(s) - [x] Tests added / updated - [ ] Documentation updated Co-authored-by: Ajimaru <Ajimaru@users.noreply.github.com>
Description
This pull request introduces several improvements and fixes across CI/CD workflows, dependency management, release automation, and core plugin logic. The main focus areas are enhanced release safety, improved dependency update grouping, stricter file size checks for log downloads, and updates to GitHub Actions for better maintainability.
Release workflow and artifact safety:
.github/workflows/release.yml) now validates paths to prevent directory traversal, reliably detects prerelease versions, and always creates releases as drafts for manual review. Artifacts are staged in a dedicated directory, and wheels retain their original filenames to ensure compatibility with pip and the OctoPrint plugin manager. [1] [2] [3]v*and numeric tags, and prerelease detection is more robust. [1] [2]Dependency and CI management:
dependabot.ymlconfiguration now groups dependency updates by type (development, production, GitHub Actions), limits open PRs, and ignores patch updates to reduce PR noise.actions/setup-pythonandactions/setup-nodefor improved reliability and support. [1] [2] [3] [4] [5] [6] [7] [8]Release notes and changelog improvements:
CHANGELOG.mdentry, reflecting the move to automated release notes.Core plugin enhancements:
0.2.5.Tooling and extraction:
babel.cfgdisables JSX parsing for JavaScript message extraction, preventing extraction errors in non-JSX codebases.These changes collectively improve the project's automation, safety, maintainability, and user experience.
Type of Change
Checklist