=== SysLock – Lightweight Hardening & Update Quarantine ===
Contributors: jbg001
Tags: security, hardening, updates, checksum, permissions
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Surgical WordPress security: identity lock, 72-hour auto-update quarantine, and on-demand core checksum & POSIX permissions audit.

== Description ==

**SysLock** is a zero-bloat, set-and-forget security plugin built for site owners and maintainers who want essential hardening without heavy firewalls, frontend scripts, or external cloud accounts.

Activate it and it works immediately with sane defaults—no setup wizards, no dashboard clutter, and zero impact on frontend page load times.

= Core Protections =

- **Identity & Hijack Lock:** Blocks unauthorized user creation across the admin UI, REST API, XML-RPC, WP-CLI, and direct `wp_insert_user()` calls; prevents privilege escalation to the Administrator role; disables Application Passwords (note: this intentionally blocks the official WordPress mobile apps and external REST integrations that rely on them); and locks critical site options (`siteurl`, `home`, `default_role`, `users_can_register`) with explicit WP-CLI warnings when triggered from the terminal.
- **72-Hour Auto-Update Quarantine:** Intercepts automatic plugin and theme updates and holds them for a 72-hour stabilization buffer after first detection before allowing installation—preserving the original pending timestamp across rapid hotfix releases (`x.1` → `x.2`) so legitimate patches are not indefinitely delayed.
- **On-Demand Integrity, Permissions & Exposure Audit:** Verifies WordPress core files against official WordPress.org MD5 checksums, scans `wp-content/uploads` for hidden PHP executables, checks POSIX permission bitmasks on critical directories and `wp-config.php`, and flags publicly exposed backups, SQL dumps, `.git` folders, or debug logs.
- **Rate-Limited Email Alerts:** Sends plain-text notifications to the site administrator email whenever an unauthorized action is blocked (capped at 1 email per hour per event type) or if the plugin is temporarily deactivated.
- **WP-CLI Support:** Run audits directly from the terminal via `wp syslock audit`.

= Privacy & External Services =

SysLock stores only minimal operational state in the `wp_options` table (with `autoload` disabled) and sends no telemetry or tracking data.

When you manually trigger an audit, the plugin queries the official WordPress.org Checksums API (`https://api.wordpress.org/core/checksums/1.0/`) solely to retrieve the reference MD5 hashes for your current WordPress version and locale.

== Installation ==

1. Upload the `syslock` folder to `/wp-content/plugins/`, or install the ZIP package directly from **Plugins → Add New → Upload Plugin**.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Visit **Tools → SysLock** to review protection status, view quarantined updates, and run an on-demand security audit.

== Frequently Asked Questions ==

= How do I create a new user, change site URLs, or allow customer registrations when SysLock is active? =

Because SysLock blocks all new user insertions (including front-end registrations and checkouts) and locks `siteurl`/`home` while active, temporarily deactivate SysLock from **Plugins** (you will receive an email reminder to re-enable it when done), or define `define( 'SYSLOCK_UNLOCK', true );` in your `wp-config.php` file during maintenance.

= Does disabling Application Passwords affect mobile apps or integrations? =

Yes. While SysLock is locked, Application Passwords are disabled completely, which prevents the official WordPress mobile apps and external REST API integrations from authenticating. If you rely on Application Passwords, define `define( 'SYSLOCK_UNLOCK', true );` or keep SysLock unlocked during setup.

= Does temporarily deactivating SysLock reset the 72-hour update quarantine? =

No. Quarantine timestamps and recent blocked event logs are preserved across temporary deactivations so you do not lose stabilization progress during routine maintenance.

= Does SysLock modify file permissions automatically? =

No. The POSIX permissions check is strictly read-only and diagnostic—it never runs `chmod()` or alters your server filesystem.

= Does this plugin load any CSS or JavaScript on the public site? =

None at all. SysLock runs exclusively on targeted backend hooks and adds zero assets or database queries to frontend visitors.

== Screenshots ==

1. Clean native status screen under Tools → SysLock showing active protections, audit findings, quarantined updates, and recent blocked events.
2. Example of an on-demand audit catching world-writable POSIX permissions and an exposed SQL dump in the webroot.

== Changelog ==

= 1.0.1 =
- Hardened user creation lock by hooking `wp_pre_insert_user_data` so REST API, XML-RPC, WP-CLI, and direct `wp_insert_user()` calls are blocked consistently alongside the admin UI.
- Improved 72-hour quarantine timer to preserve the initial pending timestamp when a plugin or theme releases rapid follow-up hotfixes (`x.1` -> `x.2`), preventing indefinite delays.
- Added explicit `WP_CLI::warning()` notices when SysLock blocks protected option updates (`siteurl`, `home`, `default_role`, `users_can_register`) or user creation during CLI operations.
- Clarified documentation regarding Application Passwords impact on mobile apps/REST integrations and user creation lock behavior.

= 1.0.0 =
- Initial public release.
- Added Identity & Hijack Lock (users, admin roles, Application Passwords, and core URLs/registration options).
- Added 72-hour automatic update quarantine for plugins and themes.
- Added on-demand Core Checksum, uploads PHP scanner, POSIX permissions, and exposed archive/log auditor.
- Added WP-CLI command `wp syslock audit`.

== Upgrade Notice ==

= 1.0.1 =
Hardens core user creation blocking across all vectors, preserves initial quarantine timestamps across rapid hotfix releases, and adds WP-CLI warnings when option locks trigger.

= 1.0.0 =
Initial public release of SysLock.
