Skip to content

feat(diagnostics): export a sanitized runtime support report - #182

Merged
RentnerKev merged 2 commits into
mainfrom
feat/runtime-support-report
Oct 6, 2026
Merged

RentnerKev merged 2 commits into
mainfrom
feat/runtime-support-report

Conversation

@RentnerKev

@RentnerKev RentnerKev commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Add an explicit local JSON support-report download to Proxy Hosts. Format 1 contains only versions, component availability, desired/applied revisions, activation time, host counts and aggregate certificate/job states with known error-code counters. Missing observations are marked as partial instead of being replaced with zeroes.

The server requires the existing proxy-host, redirect-host and certificate read permissions before reading sources. Fresh allowlisted fields, aggregate-only queries, bounded versions/counts, a 64 KiB export limit and no-store responses exclude domains, upstreams, credentials, raw configuration and source error messages. A separate authenticated controller endpoint reads only the configured Caddy binary version with a bounded, cached command. All eight locales and the format/privacy contract in root-level RUNTIME_SUPPORT_REPORT.md are documented.

The presentation uses the owning download hook and a handleDownload handler. Dedicated discriminated unions keep availability states correlated with their values. Runtime, environment and privacy explanations live in Markdown documentation, with the README linking the report contract.

Related issue

Closes #177

Type of change

  • New feature
  • Documentation

Testing

  • Full TypeScript unit/UI suite: 1,164 passed, eight opt-in Valkey tests skipped; focused allowlist, direct-endpoint authorization, partial-read, aggregate SQL and explicit-download tests.
  • Typecheck, normal and type-aware Oxlint, formatting, and production web build.
  • Locked offline Rust tests and Clippy with warnings denied; process timeout/output/environment, authentication and cache/concurrency tests.
  • Final focused report, endpoint, SQL, UI and repository-boundary checks after the naming/type/documentation changes: 43 passed, with typecheck, lint and formatting also passing.
  • Independent privacy/resource and RentnerRules review; support-specific revision reads use the read-only statement timeout.

Checklist

  • I tested the relevant functionality.
  • Existing tests pass.
  • I added or updated tests where appropriate.
  • This PR does not include secrets, credentials, production data, or private certificates/keys.
  • I updated documentation where necessary.
  • I linked the relevant issue.

Breaking changes

None. Older controllers produce partial version metadata and still allow report download.

Screenshots

Download interaction, focusability, busy/error/retry and partial feedback are covered by DOM tests. No live-system screenshot was taken.

@github-actions github-actions Bot added area: proxy Proxy host configuration and request forwarding. area: runtime Caddy and privileged controller runtime behavior. area: ui Web interface components, routes, styling, and localization. labels Oct 5, 2026
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: RentnerKev/RentnerProxy/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: beabb63d-304c-4805-8f4a-e3d7aa92577a
📥 Commits

Reviewing files that changed from the base of the PR and between c14e002 and bc3bc5a.

📒 Files selected for processing (35)
  • core/src/runtime/engine.rs
  • core/src/runtime/engine/version.rs
  • core/src/runtime/mod.rs
  • core/src/server/handlers.rs
  • core/src/server/handlers/proxy.rs
  • core/src/server/mod.rs
  • core/tests/private/caddy_version.rs
  • core/tests/private/mod.rs
  • core/tests/private/proxy_version.rs
  • docs/runtime-support-report.md
  • web/src/config/permissions.config.ts
  • web/src/config/runtime-support-report.config.ts
  • web/src/features/Admin/ProxyHostManagement/index.tsx
  • web/src/features/Admin/RuntimeDiagnostics/Hooks/useRuntimeSupportDownloadLogic.ts
  • web/src/features/Admin/RuntimeDiagnostics/Types/runtime-support-download.types.ts
  • web/src/features/Admin/RuntimeDiagnostics/index.tsx
  • web/src/features/Admin/RuntimeDiagnostics/middleware.ts
  • web/src/lib/Language/Locales/de.json
  • web/src/lib/Language/Locales/en.json
  • web/src/lib/Language/Locales/es.json
  • web/src/lib/Language/Locales/fr.json
  • web/src/lib/Language/Locales/it.json
  • web/src/lib/Language/Locales/nl.json
  • web/src/lib/Language/Locales/pl.json
  • web/src/lib/Language/Locales/pt.json
  • web/src/lib/RuntimeDiagnostics/Types/runtime-support-report.types.ts
  • web/src/lib/RuntimeDiagnostics/runtimeSupportReport.ts
  • web/src/server/Controller/transport.server.ts
  • web/src/server/RuntimeDiagnostics/support-report-data.ts
  • web/src/server/RuntimeDiagnostics/support-report.service.ts
  • web/src/tests/features/Admin/RuntimeDiagnostics/support-report-ui.test.tsx
  • web/src/tests/lib/RuntimeDiagnostics/runtime-support-report.fixture.ts
  • web/src/tests/lib/RuntimeDiagnostics/runtime-support-report.test.ts
  • web/src/tests/server/RuntimeDiagnostics/support-report-data.test.ts
  • web/src/tests/server/RuntimeDiagnostics/support-report.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.


📝 Walkthrough

Walkthrough

Adds an authenticated, permission-gated runtime support report download. The report gathers controller, runtime, configuration, certificate, and job observations; validates and bounds the JSON; and marks unavailable data. The proxy runtime also gains a cached Caddy version endpoint.

Changes

Runtime support report

Layer / File(s) Summary
Proxy version probe and endpoint
core/src/runtime/engine.rs, core/src/runtime/engine/version.rs, core/src/runtime/mod.rs, core/src/server/..., core/tests/private/..., web/src/server/Controller/transport.server.ts
Adds bounded Caddy version detection, a 60-second runtime cache, and an internal version endpoint. Tests cover parsing, command limits, caching, authorization, and concurrent lookups.
Report contract and validation
web/src/config/runtime-support-report.config.ts, web/src/config/permissions.config.ts, web/src/lib/RuntimeDiagnostics/..., web/src/tests/lib/RuntimeDiagnostics/..., docs/runtime-support-report.md
Defines the report format and required permissions. Validates observations and count aggregates, marks missing or invalid data unavailable, derives completeness, and enforces a serialized JSON size limit.
Report data collection and server response
web/src/server/RuntimeDiagnostics/..., web/src/features/Admin/RuntimeDiagnostics/middleware.ts, web/src/tests/server/RuntimeDiagnostics/...
Reads runtime revision and aggregate counts through read-only database transactions, gathers report inputs concurrently, and returns the report with no-store and nosniff headers. Tests cover authorization, queries, failures, and response behavior.
Admin download control and feedback
web/src/features/Admin/ProxyHostManagement/index.tsx, web/src/features/Admin/RuntimeDiagnostics/..., web/src/lib/Language/Locales/*.json, web/src/tests/features/Admin/RuntimeDiagnostics/support-report-ui.test.tsx
Adds a permission-aware local download control with progress and feedback states. Adds translations and tests for permissions, download behavior, partial reports, and failures.

Priority: ⬇️ Low

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Admin
  participant RuntimeSupportDownload
  participant exportRuntimeSupportReportHandler
  participant exportRuntimeSupportReportService
  participant Controller
  participant supportReportData
  participant Database
  Admin->>RuntimeSupportDownload: Activate download
  RuntimeSupportDownload->>exportRuntimeSupportReportHandler: Request report
  exportRuntimeSupportReportHandler->>exportRuntimeSupportReportService: Export request
  exportRuntimeSupportReportService->>Controller: Collect health and proxy version
  Controller-->>exportRuntimeSupportReportService: Return observations
  exportRuntimeSupportReportService->>supportReportData: Read revision and aggregate counts
  supportReportData->>Database: Run read-only aggregate queries
  Database-->>supportReportData: Return aggregate results
  supportReportData-->>exportRuntimeSupportReportService: Return report data
  exportRuntimeSupportReportService-->>exportRuntimeSupportReportHandler: Return serialized report
  exportRuntimeSupportReportHandler-->>RuntimeSupportDownload: Return JSON response
  RuntimeSupportDownload-->>Admin: Download report locally
Loading

Merge Risk: ⚪ Minimal · up to bc3bc

The support-report download is ready to merge after normal checks; no actionable issue remains identified.

Security Architecture Review

Security architecture risk: 🔵 Low · up to bc3bc

The download checks permissions before collecting data and returns freshly constructed, bounded fields rather than raw source payloads. No authorization bypass or material privacy flaw was identified in the inspected flow. Production exposure and behavior under heavy concurrent use remain unconfirmed.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — Reports cover all-instance counts, not user-owned subsets. This matches existing global host and certificate read scope under the same permissions; the report requires all three permissions. Existing proxy-host view access also reaches the runtime snapshot reader. No new tenant-boundary bypass was established by these comparisons.

Trust Boundaries and Controls

  • observed — The application boundary validates the session against an active user and current access permissions before export authorization. The subprocess boundary accepts only the configured binary path and fixed version argument; request input cannot select a command, arguments, or environment values.

Resilience and Maintainability Implications

  • observed — The version probe admits one non-queued operation per runtime, caches successes and unavailable results for 60 seconds, and does not hold the cache mutex across execution. The subprocess has a one-second timeout, 1 KiB output limit, and kill-on-drop cleanup. Return and cancellation release admission ownership; synchronous reaping after cancellation was not established.

Hardening Proposals

  • proposed — For deployments with frequent diagnostics requests, consider report-level admission and an overall collection deadline. Per-statement timeouts and an output-size cap do not themselves bound concurrent full-snapshot work or total export duration. This is a hardening proposal, not an observed denial-of-service finding.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 66 functions across 26 files. (9 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed [#177] The PR adds a versioned, explicit JSON download with bounded output and partial/unavailable markers. The report builder creates fields from fixed allowlists, validates versions, revisions, coun…
Out of Scope Changes check ✅ Passed The changed code supports [#177]. The controller version endpoint and runtime cache provide Caddy version metadata. Server readers, report construction, export UI, locales, tests, and documentation im…
Title check ✅ Passed The title clearly and concisely identifies the main change: exporting a sanitized runtime support report.
Description check ✅ Passed The description includes the required sections and gives clear details about the feature, related issue, change type, testing, checklist, breaking changes, and UI behavior. It is complete enough to as…
Full details: Docstring Coverage

Explanation

Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 66 functions across 26 files. (9 skipped: 9 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

🐳 RentnerProxy PR Preview

A test-only image for this pull request has been published successfully.

Images

Type Image
Moving preview for this PR ghcr.io/rentnerkev/rentnerproxy:pr-182
Exact tested build ghcr.io/rentnerkev/rentnerproxy:pr-182-2bfd76bb82f1

Image digest: sha256:5c1ea144e391fa38e23eef526241c512e308ebe0d1ecbb6a87986d3d1eee180b

Tested and built merge commit: 2bfd76bb82f1b36724248fa8a5aa0b22c5838089

Pull request head commit: 0e1b4647c16683e74f0339739a65c8bb90460e42

For reproducible testing and bug reports, prefer pr-182-2bfd76bb82f1. The pr-182 tag moves to the newest successful preview for this PR.


⚠️ Unreviewed development preview

This image contains unreviewed pull-request code. It may contain bugs, breaking changes, incomplete or incompatible migrations, configuration errors, and changes that damage data or runtime state.

Do not use this PR preview image with production data.

Before testing:

  1. Back up PostgreSQL.
  2. Back up the complete RentnerProxy controller/runtime state in /var/lib/rentnerproxy, including certificates, private keys, ACME state, active configuration, last-known-good state, and trusted CA material.
  3. Prefer a separate test database and separate Docker volumes.
  4. Use an isolated Docker Compose project and avoid production port bindings.

Docker

docker pull ghcr.io/rentnerkev/rentnerproxy:pr-182-2bfd76bb82f1

Docker Compose

In a separate test copy of docker-compose.yml, replace the service image with:

image: ghcr.io/rentnerkev/rentnerproxy:pr-182-2bfd76bb82f1

Then use an isolated Compose project:

docker compose --project-name rentnerproxy-pr-182 pull
docker compose --project-name rentnerproxy-pr-182 up -d

The repository Compose file binds ports 80, 81, and 443; change those bindings or stop the production stack before testing.

This preview is intended only for testing this pull request and is not a production release.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 6, 2026
@RentnerKev
RentnerKev merged commit dd9a90c into main Oct 6, 2026
27 checks passed
@RentnerKev
RentnerKev deleted the feat/runtime-support-report branch October 6, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: proxy Proxy host configuration and request forwarding. area: runtime Caddy and privileged controller runtime behavior. area: ui Web interface components, routes, styling, and localization. documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(diagnostics): export a sanitized runtime support report

1 participant