Skip to content

fix(dashboard): harden config selector paths - #9656

Open
LIghtJUNction wants to merge 1 commit into
masterfrom
agent/harden-config-selector
Open

fix(dashboard): harden config selector paths#9656
LIghtJUNction wants to merge 1 commit into
masterfrom
agent/harden-config-selector

Conversation

@LIghtJUNction

@LIghtJUNction LIghtJUNction commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • reject __proto__, prototype, and constructor segments in dashboard config selectors
  • read only own properties while traversing selector paths
  • port the focused hardening from dev commit 99f57c9

Why

The selector setter accepted arbitrary path segments and could write through JavaScript prototype-related keys. The getter also traversed inherited properties. This keeps selector access limited to the intended configuration object.

Impact

This is a one-file defensive change with no API, dependency, or configuration changes. Normal selector paths keep the existing behavior.

Extracted as a small, reviewable part of the broader draft PR #6325.

Validation

  • pnpm run typecheck
  • pnpm run build
  • git diff --check

The production build completed successfully. Its existing Google Fonts download step logged a DNS warning in the restricted build environment but did not fail the build.

Summary by Sourcery

Harden dashboard configuration selector handling to avoid unsafe prototype path access while preserving existing behavior for normal selectors.

Bug Fixes:

  • Prevent selector getters from traversing non-own properties on configuration objects.
  • Block use of JavaScript prototype-related segments (such as proto, prototype, constructor) in selector paths for reads and writes.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 13, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
astrbot-docs fbbb681 Commit Preview URL

Branch Preview URL
Aug 13 2026, 06:24 AM

@LIghtJUNction
LIghtJUNction marked this pull request as ready for review August 13, 2026 07:22
Copilot AI lite review requested due to automatic review settings August 13, 2026 07:22
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. area:webui The bug / feature is about webui(dashboard) of astrbot. labels Aug 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Consider extracting the repeated ['__proto__', 'prototype', 'constructor'] list into a shared constant or helper function to avoid duplication and make future changes to disallowed keys easier.
  • You might want to guard Object.prototype.hasOwnProperty.call(current, key) with a more explicit object check (e.g., current !== null && typeof current === 'object') to avoid surprising behavior if current is ever a non-object value during traversal.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider extracting the repeated `['__proto__', 'prototype', 'constructor']` list into a shared constant or helper function to avoid duplication and make future changes to disallowed keys easier.
- You might want to guard `Object.prototype.hasOwnProperty.call(current, key)` with a more explicit object check (e.g., `current !== null && typeof current === 'object'`) to avoid surprising behavior if `current` is ever a non-object value during traversal.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:webui The bug / feature is about webui(dashboard) of astrbot. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants