Skip to content

Gate Assets Manager frontend bundles behind manage_options #97

@mehul0810

Description

@mehul0810

Finding

The frontend enqueue guard currently treats any request with ?perform as eligible for Assets Manager scripts and styles. The overlay markup itself is capability-gated, but the public frontend bundles can still be forced onto anonymous page views by adding the query parameter.

Impact

Anonymous visitors and crawlers can trigger extra CSS/JS payload on otherwise normal frontend pages. That adds avoidable page weight and makes the public query flag behave inconsistently with the actual admin-only overlay.

Suggested implementation

  • Update the shared Assets Manager display guard to require current_user_can( 'manage_options' ).
  • Reuse the same guard for frontend script/style enqueues and overlay HTML rendering.
  • Preserve the existing ?perform workflow for authorized administrators.
  • Ensure the admin bar “Assets Manager” link continues to work for authorized users.

Acceptance criteria

  • Anonymous ?perform requests do not enqueue Assets Manager frontend bundles.
  • Authorized administrators still see and can use the Assets Manager overlay.
  • Existing admin bar and post-row Assets Manager links continue to work.
  • Add a lightweight smoke or integration test for unauthorized vs authorized enqueue behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: assets-managerAsset Manager behavior, compatibility, UI, persistence, or per-page controls.area: frontendPublic-facing frontend output, assets, feeds, headers, or visitor behavior.area: performancePerformance-sensitive behavior, page weight, caching, preloading, or resource hints.bugConfirmed or likely defect affecting runtime behavior, UX, compatibility, or data handling.priority: mediumUseful or user-impacting work that should be planned but is not blocking now.status: in-progressWork has a branch, PR, or active release branch implementation path.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions