Skip to content

Sync net-new v2.1.3 guards, instatic cleanup, Bun canary, and tags to dev - #361

Merged
7heMech merged 1 commit into
devfrom
sync/v2.1.3-to-dev
Dec 2, 2026
Merged

7heMech merged 1 commit into
devfrom
sync/v2.1.3-to-dev

Conversation

@7heMech

@7heMech 7heMech commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Ports the net-new changes that shipped in v2.1.3 (e8d010d4 on release/2.1, PR #360) onto dev while keeping all 2.2 code, docs, and dependencies intact.

Changes

  • System Tweaks guards:
    • addons/system-tweaks/file-manager-guard.php: allowlist non-backend /file-manager page paths, reject JS/HTML metacharacters and control bytes in both raw and urldecode() REQUEST_URI, and validate HTTP_HOST.
    • addons/system-tweaks/vhost-guard.php: fail-closed cross-site database-user edit guard on /site/<domain>/database/user/edit/<user> (302 /login for unauthenticated, empty, or pre-login sessions; 403 for unreadable, pending-2FA, missing, or mismatched-owner sessions; PHP 8.1/8.4/8.5-safe OPEN_READONLY SQLite options), plus site log viewer route validation on /site/<domain>/log-file-content and /site/<domain>/load-logfiles (GET/HEAD/POST only, service in nginx/php, strict logFile filename without trim()).
    • addons/system-tweaks/pool-guard.ts: use a callback replacer () => ... in withPanelSession.
    • Updated tests/integration/integration-file-manager-guard.ts, tests/integration/integration-vhost-guard.ts, tests/test-system-tweaks.test.ts, SECURITY.md (including the top [!NOTE] on upstream CloudPanel coordination), docs/system-tweaks.md, and docs/decisions/system-tweaks.md.
  • Instatic temp-file cleanup: unlink .tmp files inside catch in both writeEnvFile and publishSnapshot in addons/instatic/action.ts, and add the failed-publication cleanup test in tests/test-action-instatic.test.ts.
  • Toolchain: bump pinned Bun canary to 1.4.5-canary.20261202.1 and bun-types to 1.4.5-canary.20261202T141441 with exact x64/arm64 npm sha512 integrities in package.json, bun.lock, .github/actions/install-bun/action.yml, README.md, and docs/decisions/releases.md.
  • changed version tags: re-tag the two backported entries in addons/stager/addon.ts and addons/git/addon.ts from 2.2.0 to 2.1.3, keeping both lists newest-first.

Verification

  • bun install --frozen-lockfile
  • bun run typecheck (0 errors in 477 files)
  • NO_COLOR=1 TMPDIR=/tmp bun run test (2703 pass, 0 fail across 133 files)
  • bun run build
  • bun tests/integration/integration-vhost-guard.ts (PHP 8.1, 8.4, 8.5: 139/139 passed)
  • bun tests/integration/integration-file-manager-guard.ts (PHP 8.1, 8.4, 8.5: 127/127 passed)

Summary by CodeRabbit

  • Security
    • Strengthened safeguards for File Manager requests, including checks for unexpected paths and malformed host information.
    • Added protections for database-user edits and site log requests, including ownership and input validation checks.
  • Bug Fixes
    • Temporary files are now cleaned up when environment-file writing or snapshot publishing fails.
    • Fixed session code insertion so its contents are preserved literally.
  • Maintenance
    • Updated the project’s pinned Bun version.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

This pull request adds request checks to System Tweaks guards, adds temporary-file cleanup to Instatic, updates the pinned Bun canary, and corrects two addon changelog version attributions.

Changes: System Tweaks guards

Layer / File(s) Summary
Vhost route checks
addons/system-tweaks/vhost-guard.php, tests/integration/integration-vhost-guard.ts, docs/decisions/system-tweaks.md, docs/system-tweaks.md, SECURITY.md
The vhost guard checks session state and database-user ownership for edit requests. It restricts methods and parameters on site log routes and uses read-only SQLite options. Integration cases and documentation cover the checks.
File Manager page checks
addons/system-tweaks/file-manager-guard.php, tests/integration/integration-file-manager-guard.ts, tests/test-system-tweaks.test.ts, docs/decisions/system-tweaks.md, docs/system-tweaks.md, SECURITY.md
The guard rejects disallowed page paths, unsafe request characters, and malformed nonempty Host headers. Integration cases and documentation describe the checks. Tests also assert that the guard scripts do not contain panel-session.php.
Literal session-code replacement
addons/system-tweaks/pool-guard.ts
The pool guard now passes inlined panel session code to String.replace through a callback.

Instatic temporary-file cleanup

Layer / File(s) Summary
Cleanup after write and publish failures
addons/instatic/action.ts, tests/test-action-instatic.test.ts
The environment-file and snapshot publication paths remove temporary files when operations fail, then rethrow the error. A test checks that failed snapshot publication leaves no temporary archive.

Bun toolchain pin

Layer / File(s) Summary
Update the pinned Bun version
.github/actions/install-bun/action.yml, package.json, README.md, docs/decisions/releases.md
The install action uses Bun 1.4.5-canary.20261202.1 with updated x64 and ARM64 integrity values. Package metadata and documentation use the updated canary version.

Addon changelog version corrections

Layer / File(s) Summary
Correct changelog version attribution
addons/git/addon.ts, addons/stager/addon.ts
The Git Deploy authentication note and the Stager file-read restriction note move from version 2.2.0 to 2.1.3.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant Request
  participant VhostGuard as vhost-guard.php
  participant SessionReader as Shared session reader
  participant SQLite
  participant EditRoute as editDatabaseUser
  Request->>VhostGuard: Request database-user edit
  VhostGuard->>SessionReader: Read session
  SessionReader-->>VhostGuard: Session attributes and status
  VhostGuard->>SQLite: Query database-user owner
  SQLite-->>VhostGuard: Owning site
  VhostGuard->>EditRoute: Continue when the owner matches the requested domain
  VhostGuard-->>Request: Redirect to /login or refuse invalid access
Loading

Possibly related PRs

Merge Risk: Minimal · up to 3ad71 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names several changes: guard updates, instatic cleanup, Bun canary bump, and changelog tag moves. The raw summary and objectives cover all of these. The title is long and lists many items, s…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names several changes: guard updates, instatic cleanup, Bun canary bump, and changelog tag moves. The raw summary and objectives cover all of these. The title is long and lists many items, so it is broad. It still refers to real parts of the changeset, and the main change (syncing net-new v2.1.3 guards to dev) is present. The title is therefore related to the changeset, but it lists several items instead of one primary change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 56c861c and 3ad71e7.

Files ignored due to path filters: 1

  • bun.lock is excluded by !**/*.lock
Files selected for processing: 17

  • .github/actions/install-bun/action.yml
  • README.md
  • SECURITY.md
  • addons/git/addon.ts
  • addons/instatic/action.ts
  • addons/stager/addon.ts
  • addons/system-tweaks/file-manager-guard.php
  • addons/system-tweaks/pool-guard.ts
  • addons/system-tweaks/vhost-guard.php
  • docs/decisions/releases.md
  • docs/decisions/system-tweaks.md
  • docs/system-tweaks.md
  • package.json
  • tests/integration/integration-file-manager-guard.ts
  • tests/integration/integration-vhost-guard.ts
  • tests/test-action-instatic.test.ts
  • tests/test-system-tweaks.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@7heMech
7heMech merged commit 849d692 into dev Dec 2, 2026
6 checks passed
@7heMech
7heMech deleted the sync/v2.1.3-to-dev branch December 2, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant