Skip to content

admin-ui: stop logging raw AxiosError on request failures - #97

Merged
bashrusakh merged 1 commit into
mainfrom
issue-96-eager-dingo
Oct 21, 2026
Merged

bashrusakh merged 1 commit into
mainfrom
issue-96-eager-dingo

Conversation

@bashrusakh

@bashrusakh bashrusakh commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Fixes #96

Summary

Admin-ui request catch blocks no longer print the raw axios error object. The shared request interceptor in admin-ui/src/utils/request.js attaches the session token to every request as config.headers['api-token'], and an axios error carries error.config — so logging the raw object printed the API token and the request body into devtools and into any console screenshot taken for support.

Each affected site now logs a bounded diagnostic instead of the object.

  • custom-client/index.vue — custom_build/list, custom_preset/list, custom_preset/delete, custom_build/delete (the four paths named in admin-ui: stop logging raw AxiosError (api-token) on list/delete failures #96), plus the image-upload and /config/all failures.
  • components/dashboard/ServerHealth.vue — /dashboard/health.
  • views/index/index.vue — /dashboard/stats.
  • views/server/config.vue — /config/all.
  • store/app.js — /config/admin.

The response interceptor already toasts a bounded message for these failures, so no signal is lost.

The preset custom_json parse failure is bounded to the error type only (e?.name), not the message: the V8 JSON.parse message quotes an excerpt of the offending input, and custom_json can carry permanent_password and key.

Why

Issue #96 (non-blocking P2 from the #95 review). A support screenshot of the console would capture the session token.

Validation

  • node --test tests/*.test.mjs — 88/88 pass (72 existing + 16 new) on Node 20.20.2, 22.23.0 and 24.17.0
  • npm run build — pass
  • git diff --check — clean
  • Regression test proven to discriminate: against the unmodified source it fails 12 of 16; reverting any single site to console.error(e) fails it again.

Regression test

New admin-ui/tests/admin-ui-request-error-logging.test.mjs drives the real implementations — it reads each source file, extracts the relevant slice by string boundaries, evaluates it in a node:vm context with a stubbed console, and calls it with a real axios.AxiosError whose config carries a canary token and canary body. It asserts the canaries never reach the console, that a bounded diagnostic remains, and that neighbouring behaviour (successful list, cancelled confirm, superseded request generation) is preserved.

.github/workflows/build.yml now runs node --test tests/*.test.mjs so every file in admin-ui/tests/ runs in CI. The glob form is used rather than node --test tests/ because the directory form is broken on Node 22+.

Scope

Admin UI only. No new dependencies. admin-ui/src/utils/request.js and admin-ui/src/api/ are unchanged — the token is still attached to requests, and the #95 preset-save path (reportCreateBuildFailure, saveCurrentAsPreset, the custom_preset/create wrapper) is byte-identical to main.

Manual verification

  1. Open /admin/ → Custom Client, and DevTools → Console.
  2. Stop the API (or block /custom_build/list in the Network panel) and reload.
  3. Expect a bounded message like Failed to load custom builds: Network Error — and no api-token or request body in the console output.
  4. Repeat for a preset delete.

Co-Authored-By: opencode opencode@opencode.ai

Summary by CodeRabbit

  • Security

    • Improved admin UI error logging to avoid exposing authentication tokens, request bodies, passwords, keys, and other sensitive request details.
  • Bug Fixes

    • Error logs now provide concise, bounded diagnostics while preserving existing error handling and user-facing behavior.
  • Tests

    • Added comprehensive regression coverage for safe error logging across dashboard, server, configuration, build, and preset operations.

The shared axios request interceptor attaches the session token to every
request as config.headers['api-token'], and an axios error object carries
error.config. Every request catch block that logged the raw error therefore
printed the API token (and config.data, the request body) into devtools and
into any console screenshot taken for support.

Log a bounded diagnostic instead of the raw object at the request failure
sites in the custom-client view (custom_build/list, custom_preset/list,
custom_preset/delete, custom_build/delete), the dashboard, server health,
server config and admin config loads. The response interceptor already
toasts a bounded message for these failures, so no signal is lost.

The preset custom_json parse failure is bounded to the error type only: the
V8 JSON.parse message quotes an excerpt of the offending input, and
custom_json can carry permanent_password and key.

Add a regression test that drives the real implementations with an axios
error carrying a canary token and body, and assert neither reaches the
console while a bounded diagnostic remains. Run every file in
admin-ui/tests/ in CI.

Co-Authored-By: opencode <opencode@opencode.ai>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ed19473d-b93a-4b7d-ac3b-c0329b11e602
📥 Commits

Reviewing files that changed from the base of the PR and between 6ae6c43 and e4e287a.

📒 Files selected for processing: 7
  • .github/workflows/build.yml
  • admin-ui/src/components/dashboard/ServerHealth.vue
  • admin-ui/src/store/app.js
  • admin-ui/src/views/custom-client/index.vue
  • admin-ui/src/views/index/index.vue
  • admin-ui/src/views/server/config.vue
  • admin-ui/tests/admin-ui-request-error-logging.test.mjs

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

The Admin UI now logs bounded diagnostics for request and parsing failures instead of logging raw error objects or input-derived parse messages. Regression tests cover secret leakage and existing failure behavior, and the build workflow runs all matching Node tests.

Changes: Admin UI Error Logging

Layer / File(s) Summary
Bounded error diagnostics
admin-ui/src/views/custom-client/index.vue, admin-ui/src/components/dashboard/ServerHealth.vue, admin-ui/src/store/app.js, admin-ui/src/views/index/index.vue, admin-ui/src/views/server/config.vue
Failure handlers log bounded error messages or error types rather than raw error objects. Preset JSON parse failures omit the input-derived parse message. Existing failure handling remains unchanged.
Logging regression tests and workflow
admin-ui/tests/admin-ui-request-error-logging.test.mjs, .github/workflows/build.yml
Regression tests check for leaked request secrets and raw error logging. They also verify successful list population, silent cancellation, stale-request suppression, and bounded diagnostics for non-Axios errors. The workflow now runs all matching Node test files.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to e4e28

This change stops the Admin UI from logging raw request errors that could expose session tokens and request bodies. It does not change user-visible behavior, and the supplied context shows no concrete merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. (5 skipped: 5 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preventing raw AxiosError objects from being logged in the Admin UI during request failures.
Linked Issues check Passed Issue #96 requirements are met. The four named handlers in admin-ui/src/views/custom-client/index.vue now log fixed labels plus e?.message || String(e) instead of raw errors. The handlers retain t…
Out of Scope Changes check Passed The added logging changes for image upload, /config/all, server health, dashboard stats, and admin configuration address the same raw AxiosError exposure and use the same bounded-diagnostic pattern.…
Full details: Linked Issues check

Explanation

Issue #96 requirements are met. The four named handlers in admin-ui/src/views/custom-client/index.vue now log fixed labels plus e?.message || String(e) instead of raw errors. The handlers retain their existing request, cancellation, generation, and state-update flow. The regression test uses real Axios errors with canary token and body values and checks that console calls receive only strings while a bounded diagnostic remains. The reported changes are limited to Admin UI files, add no dependencies, and preserve the existing interceptor and API calls. The PR also reports that the #95 preset-save path is unchanged.

Full details: Out of Scope Changes check

Explanation

The added logging changes for image upload, /config/all, server health, dashboard stats, and admin configuration address the same raw AxiosError exposure and use the same bounded-diagnostic pattern. The 655-line regression suite directly tests the affected handlers and preserves cancellation, successful list handling, and stale-request behavior. The CI glob change runs this required test suite. No unrelated product behavior, API contract, or dependency change is shown.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. (5 skipped: 5 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ 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
  • 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

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

@bashrusakh bashrusakh added the bug Something isn't working label Oct 21, 2026
@bashrusakh
bashrusakh merged commit 1880c76 into main Oct 21, 2026
11 checks passed
@bashrusakh
bashrusakh deleted the issue-96-eager-dingo branch October 21, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

admin-ui: stop logging raw AxiosError (api-token) on list/delete failures

1 participant