Skip to content

dknauss/wp-sudo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

514 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

WP Sudo

WP Sudo adds action-gated reauthentication to WordPress so high-risk operations require fresh confirmation before they proceed.

License: GPL v2+ WordPress: 6.2+ PHP: 8.0+ PHPUnit Psalm Playwright Tests

Status: exploratory plugin, not yet production-ready. See docs/release-status.md for current stable-vs-main status and tests/MANUAL-TESTING.md if you want to help evaluate it.

Why WP Sudo exists

WordPress has roles, capabilities, and authentication, but it has no native way to say:

this action is consequential enough that a valid session alone should not be enough.

WP Sudo adds that missing layer on the covered paths it intercepts.

It is designed to reduce risk when an attacker has:

  • a stolen browser session cookie,
  • access to an unattended authenticated browser,
  • or a delegated request path that reaches a high-impact operation.

On those covered paths, a valid session without an active sudo window is not enough.

What WP Sudo covers

WP Sudo currently gates built-in operations across categories such as:

  • plugin and theme management,
  • user creation, deletion, and role changes,
  • file editor access,
  • critical option changes,
  • WordPress core updates,
  • export flows,
  • WP Sudo settings themselves,
  • selected Multisite network actions,
  • and connector credential writes saved through the REST settings endpoint.

For the canonical current rule totals and surface counts, see docs/current-metrics.md.

How it works

Browser requests

For wp-admin flows, WP Sudo redirects the user to a challenge screen. After successful reauthentication, the original request can continue.

AJAX and REST requests

These receive a sudo_required error instead of silently proceeding.

Non-interactive surfaces

WP Sudo supports configurable policies for:

  • WP-CLI
  • Cron
  • XML-RPC
  • REST Application Passwords
  • WPGraphQL (when active)

Each surface can be set to Disabled, Limited, or Unrestricted.

What WP Sudo does not do

WP Sudo is deliberately narrow. It is not:

  • a replacement for WordPress capabilities,
  • a firewall or exploit detector,
  • a fix for arbitrary broken access control inside third-party plugin code,
  • or a sandbox for malicious in-process code.

It is strongest when an attacker has a valid session but does not have an active sudo window and must cross one of the plugin's covered action paths.

Active sudo is per browser session, not site-wide.

Requirements

  • WordPress: 6.2+
  • PHP: 8.0+
  • Multisite: supported

For current release posture, supported lanes, and forward main notes, see docs/release-status.md.

Quick start

  1. Install and activate WP Sudo.
  2. Go to Settings β†’ Sudo.
  3. Choose a session duration.
  4. Review the default policies for non-interactive surfaces.
  5. Optionally install the bundled mu-plugin loader from the settings page for earlier hook registration.
  6. Test a covered action such as plugin activation or a protected settings change.

Recommended companion plugins

  • Two Factor β€” strongly recommended for password + second-factor challenge flows.
  • WP Activity Log or Stream β€” recommended if you want audit visibility from WP Sudo's action hooks.

Documentation

Start here

For developers and integrators

Verification and project status

Background and research

Development

Quick local checks:

composer install
composer test:unit
composer lint
composer analyse

For full setup, integration tests, E2E workflows, and contributor expectations, see CONTRIBUTING.md.

License

GPL-2.0-or-later.

About

Sudo for WordPress! πŸ₯ͺ Risky actions β€” activating plugins, deleting users, changing key settings β€” are gated by a required reauthentication step, regardless of user role. Time-bounded sessions, 2FA support, rate limiting, and configurable policies for REST, WP-CLI, Cron, WPGraphQL, & XML-RPC. No role escalation, no new permissions β€” just a gate. ⛩️

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors