Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
5ef1a56
build(deps): bump actions/setup-node from 6 to 7
dependabot[bot] Jul 16, 2026
b567403
build(deps): bump actions/setup-python from 6 to 7
dependabot[bot] Jul 23, 2026
8f28b80
build(deps): bump softprops/action-gh-release from 3.0.1 to 3.0.3
dependabot[bot] Sep 3, 2026
3dc4e16
feat: add flask to develop dependencies in pyproject.toml
Ajimaru Sep 4, 2026
5c7732a
feat: update dependabot configuration for monthly updates and improve…
Ajimaru Sep 4, 2026
a80e193
feat: add MAX_QUERY_LENGTH constant and enforce query length limit in…
Ajimaru Sep 4, 2026
d53400f
build(deps): bump softprops/action-gh-release from 3.0.1 to 3.0.3 (#27)
Ajimaru Sep 4, 2026
020a170
build(deps): bump actions/setup-node from 6 to 7 (#24)
Ajimaru Sep 4, 2026
c0f4358
build(deps): bump actions/setup-python from 6 to 7 (#26)
Ajimaru Sep 4, 2026
1032cc5
build(deps): bump codecov/codecov-action from 7.0.0 to 7.1.1 (#29)
dependabot[bot] Oct 1, 2026
1b19526
Refactor release workflow and pull request template for clarity (#30)
Ajimaru Oct 18, 2026
9c6cd7a
feat: enhance regex safety and performance with ReDoS mitigation (#31)
Ajimaru Oct 18, 2026
5815662
feat: implement download size limit and improve error handling for lo…
Ajimaru Oct 18, 2026
7048605
fix: disable JSX parsing in Babel config to prevent extraction issues…
Ajimaru Oct 18, 2026
17a7759
chore: bump version to 0.2.5 in _version.py and pyproject.toml
Ajimaru Oct 18, 2026
b8a6332
feat: implement linear-time ReDoS guard and add unit tests for regex …
Ajimaru Oct 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 31 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
version: 2
updates:
- package-ecosystem: "pip"
- package-ecosystem: github-actions
directory: "/"
target-branch: dev
schedule:
interval: "weekly"
target-branch: "dev"
interval: monthly
open-pull-requests-limit: 5
groups:
github-actions:
patterns:
- "*"

- package-ecosystem: "github-actions"
- package-ecosystem: pip
directory: "/"
target-branch: dev
schedule:
interval: "weekly"
target-branch: "dev"
interval: monthly
open-pull-requests-limit: 5
groups:
dev-dependencies:
dependency-type: development
patterns:
- "*"
# Major bumps are deliberately not listed here: they stay individual
# PRs, since those are the ones that actually break things.
production-dependencies:
dependency-type: production
patterns:
- "*"
update-types:
- minor
# Patch bumps are ignored to keep PR volume low; security fixes still
# arrive through Dependabot security alerts, which ignore this filter.
ignore:
- dependency-name: "*"
update-types:
- version-update:semver-patch
1 change: 0 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@
- [ ] Related issue(s)
- [ ] Tests added / updated
- [ ] Documentation updated
- [ ] `CHANGELOG.md` entry added
53 changes: 33 additions & 20 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-release-notes.json
# Configuration for GitHub auto-generated release notes
# Categories for GitHub's generated release notes.
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes

#
# A pull request is filed by its labels, and lands in the FIRST category below
# whose labels it carries — so the order is a priority rule, not cosmetic. A PR
# labelled both `bug` and `enhancement` shows up under New Features only, never
# twice. The order puts what users care about first and pushes dependency/CI
# noise to the bottom.
#
# The catch-all `*` at the end means an unlabelled PR is still listed instead of
# being dropped silently.
changelog:
categories:
- title: "Features"
labels:
- "enhancement"
- "feature"
- title: "Bug Fixes"
labels:
- "bug"
- "fix"
- title: "Documentation"
labels:
- "documentation"
- "docs"
- title: "CI / Tooling"
labels:
- "ci"
- "tooling"
- title: "⚠️ Breaking Changes"
labels: ["breaking", "breaking-change"]
- title: "🔒 Security"
labels: ["security"]
- title: "✨ New Features"
labels: ["enhancement", "feature"]
- title: "🐛 Bug Fixes"
labels: ["bug", "fix"]
- title: "⚡ Performance"
labels: ["performance"]
- title: "♻️ Refactoring"
labels: ["refactor"]
- title: "📚 Documentation"
labels: ["documentation", "docs"]
- title: "🧪 Tests"
labels: ["test"]
- title: "📦 Dependencies"
labels: ["dependencies", "depfu"]
- title: "🔧 CI / Tooling"
labels: ["ci", "tooling", "chore", "github_actions"]
- title: "🧩 Other Changes"
labels: ["*"]
exclude:
labels:
- "skip-changelog"
labels: ["skip-changelog"]
2 changes: 1 addition & 1 deletion .github/workflows/bandit-sarif.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- # Setup Python for Bandit scanning
name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: "pip"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

- # Setup Python version and pip cache
name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: pip
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
- # Upload coverage.xml to Codecov
name: Upload coverage to Codecov
if: ${{ matrix.run-coverage && github.repository == 'Ajimaru/OctoPrint-LogMonitor' }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand All @@ -117,7 +117,7 @@ jobs:
- # Setup Node.js for pre-commit hooks (ESLint/Prettier)
name: Set up Node.js for hooks
if: ${{ matrix.run-precommit && hashFiles('.pre-commit-config.yaml') != '' }}
uses: actions/setup-node@v6
uses: actions/setup-node@v7
with:
node-version: "20.19.0"
cache: "npm"
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
uses: actions/checkout@v7

- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- # Setup Python for MkDocs build
name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- # Setup Python 3.12 for i18n tools
name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: pip
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- # Setup Python and pip cache
name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: pip
Expand All @@ -54,7 +54,7 @@ jobs:
- # Setup Node.js for ESLint/Prettier hooks
name: Set up Node.js for hooks
if: ${{ hashFiles('.pre-commit-config.yaml') != '' }}
uses: actions/setup-node@v6
uses: actions/setup-node@v7
with:
node-version: "20.19.0"
cache: "npm"
Expand Down
128 changes: 59 additions & 69 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Release

on:
push:
tags:
- "v*"
tags: ["v*", "[0-9]*"]

permissions:
contents: write
Expand All @@ -18,7 +17,7 @@ jobs:
uses: actions/checkout@v7

- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: pip
Expand All @@ -29,17 +28,53 @@ jobs:
python -m pip install build

- name: Build sdist and wheel
run: python -m build

- name: Validate paths (prevent directory traversal)
run: |
for f in dist/*; do
rel="$(realpath --relative-to="$(pwd)" "$f")"
case "$rel" in
.*) echo "Suspicious path: $f ($rel)"; exit 1 ;;
esac
done

- name: Determine prerelease
id: prerelease
run: |
python -m build
TAG="${{ github.ref_name }}"
TAG_LOWER="$(printf '%s' "$TAG" | tr '[:upper:]' '[:lower:]')"
# Prerelease = a/b/rc/dev segment in the VERSION part of the tag
# (PEP 440 style, digit or separator before it, e.g. 0.2.2rc1 or
# 0.2.2.dev6). The match must end at the tag end or at the local
# part ("+hash"), so a commit hash that happens to end in e.g.
# "b1" can never flip the detection.
if echo "$TAG_LOWER" | grep -qE '(^|[-.0-9])(a|b|rc|dev)([.-]?[0-9]+)?($|\+)'; then
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
fi

- name: Create zip assets (versioned + latest)
- name: Stage release artifacts
shell: bash
run: |
set -euo pipefail

mkdir -p release_zips

# Keep the wheel's original, PEP 427-compliant filename
# ({name}-{version}-{pytag}-{abitag}-{platformtag}.whl). pip rejects
# any renamed wheel ("wrong number of parts"), so it must not be
# aliased — both the OctoPrint plugin manager and pip parse the name.
cp dist/*.whl dist/*.tar.gz release_zips/

# Also publish a source .zip (versioned + a stable -latest.zip). A zip
# has no strict filename parser, so the OctoPrint plugin manager can
# install it directly from a fixed "…-latest.zip" URL. Build it from
# the sdist tarball rather than the working tree so it matches the
# released source exactly.
version="${GITHUB_REF_NAME#v}"
zip_versioned="dist/OctoPrint-LogMonitor-${version}.zip"
zip_latest="dist/OctoPrint-LogMonitor-latest.zip"
zip_versioned="release_zips/OctoPrint-LogMonitor-${version}.zip"
zip_latest="release_zips/OctoPrint-LogMonitor-latest.zip"

shopt -s nullglob
sdist_candidates=(dist/*"${version}".tar.gz)
Expand All @@ -50,11 +85,6 @@ jobs:
fi
sdist="${sdist_candidates[0]}"

if [[ ! -f "$sdist" ]]; then
echo "Expected sdist not found: $sdist" >&2
exit 1
fi

python - "$sdist" "$zip_versioned" <<'PY'
import sys
import tarfile
Expand All @@ -72,8 +102,8 @@ jobs:
if not member.isfile():
continue

# Defensive: ensure tar member paths cannot become path traversal entries in the zip.
# Tar archives always use POSIX-style paths.
# Defensive: never let a tar member become a path-traversal
# entry in the zip. Tar archives always use POSIX paths.
member_path = PurePosixPath(member.name)
if (
member_path.is_absolute()
Expand All @@ -86,11 +116,10 @@ jobs:
extracted = tf.extractfile(member)
if extracted is None:
continue
data = extracted.read()

zi = zipfile.ZipInfo(str(member_path))
zi.external_attr = (member.mode & 0o777) << 16
zf.writestr(zi, data)
zf.writestr(zi, extracted.read())
PY

cp -f "$zip_versioned" "$zip_latest"
Expand All @@ -99,60 +128,21 @@ jobs:
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/*

- name: Generate release notes
uses: actions/github-script@v9
with:
script: |
const fs = require("fs");

const tag = process.env.GITHUB_REF_NAME;
const title = String(tag || "")
.replace(/^OctoPrint[-_\s]?LogMonitor[-_\s]?/i, "")
.trim() || tag;

const { owner, repo } = context.repo;
const response = await github.rest.repos.generateReleaseNotes({
owner,
repo,
tag_name: tag,
});

const assets = [
"wheel (.whl)",
"sdist (.tar.gz)",
"versioned zip (.zip)",
"OctoPrint-LogMonitor-latest.zip",
];

const body = [
title,
"",
response.data.body?.trim() || "",
"",
"Assets:",
...assets.map((a) => `- ${a}`),
"",
].join("\n");

fs.writeFileSync("release_notes.md", body, { encoding: "utf-8" });
fs.writeFileSync("release_title.txt", title, { encoding: "utf-8" });

- name: Read release title
id: release_title
run: |
title=$(cat release_title.txt)
echo "title=$title" >> "$GITHUB_OUTPUT"
path: release_zips/*

- name: Create GitHub Release
uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3
- name: Create GitHub release (draft)
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
with:
name: ${{ steps.release_title.outputs.title }}
draft: false
prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'a') || contains(github.ref_name, 'b') }}
body_path: release_notes.md
files: dist/*
files: |
release_zips/*
# Notes are grouped by PR label; the categories live in
# .github/release.yml.
generate_release_notes: true
# Always a draft: a release is published by hand once the notes and
# the attached artifacts have been eyeballed. Pushing a tag must
# never publish on its own.
draft: true
prerelease: ${{ steps.prerelease.outputs.is_prerelease }}

# Optional: Publish to PyPI
#
Expand Down
8 changes: 8 additions & 0 deletions babel.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ extensions=jinja2.ext.do, octoprint.util.jinja.trycatch

[javascript: */**.js]
extract_messages = gettext, ngettext
# Disable JSX/E4X parsing. This codebase has no JSX, but Babel's lexer reads
# the regex literal />/g (in escapeHtml()) as a JSX tag close. Tokenisation is
# then off by one from that point on: the rest of the file is swallowed into
# phantom strings and every gettext() call after it is silently dropped from
# the catalog. The value is left empty on purpose -- Babel reads config values
# as strings and only checks truthiness, so "false" or "0" would still enable
# it; only an empty value is falsy.
jsx =
Loading
Loading