Commit Graph
1106 Commits
Author SHA1 Message Date
robert dennis bdfdab5d3d allocation activity 2026-10-12 05:18:56 -04:00
robert dennis 84695d2f0a database activity 2026-10-12 05:18:56 -04:00
robert dennis a84924539a server settings activity 2026-10-12 05:18:56 -04:00
robert dennis 50904d0e6a power activity 2026-10-12 05:18:56 -04:00
robert dennis 66ae42a8dc ssh key rules 2026-10-12 05:18:56 -04:00
robert dennis f4f5e2356e wings report actions 2026-10-12 05:18:56 -04:00
robert dennis ca94f2f48b transfer actions 2026-10-12 05:18:56 -04:00
robert dennis ac7f9a889a backup actions 2026-10-12 05:18:56 -04:00
robert dennis 89d8cd8717 server startup action 2026-10-12 05:18:56 -04:00
robert dennis ac79b03483 server details action 2026-10-12 05:18:56 -04:00
robert dennis f4eee5e3f6 server build action 2026-10-12 05:18:56 -04:00
robert dennis b218339495 server create action 2026-10-12 05:18:56 -04:00
robert dennis 6cf48a6bb4 egg actions 2026-10-12 05:18:56 -04:00
robert dennis b362df4c5f api key actions 2026-10-12 05:18:56 -04:00
robert dennis 735308cdd3 database actions 2026-10-12 05:18:56 -04:00
robert dennis 25701a0d37 database host actions 2026-10-12 05:18:56 -04:00
robert dennis d006674f6d tag actions 2026-10-12 05:18:56 -04:00
robert dennis 01ff4a3d1e mount actions 2026-10-12 05:18:56 -04:00
robert dennis b91a8696b0 allocation actions 2026-10-12 05:18:56 -04:00
robert dennis e99328e03f node actions 2026-10-12 05:18:56 -04:00
robert dennis 25ec34fad4 user actions 2026-10-12 05:18:55 -04:00
robert dennis 66765eef2d location actions 2026-10-12 05:18:55 -04:00
robert dennis 492a5a4f40 schedule actions 2026-10-12 05:18:55 -04:00
robert dennis 56662280a2 openapi fixes 2026-10-12 05:18:55 -04:00
robert dennis 77ec6c14a4 account key actions 2026-10-12 05:18:55 -04:00
robert dennis 2e56c584f0 password reset action 2026-10-12 05:18:55 -04:00
robert dennis 1a4b6b1a4f startup variable action 2026-10-12 05:18:55 -04:00
robert dennis 48628b5288 extension error history 2026-10-12 05:18:55 -04:00
robert dennis 68e78abc20 server node filter 2026-10-12 05:18:55 -04:00
robert dennis b5430a32d3 bulk allocation delete 2026-10-12 05:18:55 -04:00
robert dennis d5b3f4fdce delete logging 2026-10-12 05:18:55 -04:00
robert dennis feebc11056 boolean inputs 2026-10-12 05:18:54 -04:00
robert dennis 288935d74d extension directory permissions 2026-10-09 17:34:17 -04:00
Sky Mulleyandrobert dennis 71dd1911a5 Implement native support for hooking into forms with extensions (#7256)
## Problem

Extensions can render content before and after most admin pages, but not
inside the forms on them. The only exception was
`panel.users.detail.form`, and it could only re-render or validate the
user's existing fields. An extension had no way to add a field of its
own, because the Panel's save requests had nowhere to carry the value
and nothing loaded it back.

## Changes

### Slots inside every admin form

The create and edit forms for users, nodes, servers, eggs, locations,
mounts and database hosts each render a slot inside the form, such as
`panel.servers.create.form` and `panel.servers.detail.details.form`. The
slot receives the native `form`, the form's `kind` (`admin.server`), and
`mode` (`'create'` or `'edit'`). Edit slots also receive the saved
`resource`. Contributed `form.AppField` controls share the form's
validation, pending state and submit action.

### Extension-owned fields

An extension registers fields in its provider:

```php
$this->registerFormFields('admin.user', ['plan' => ['required', 'in:free,pro']]);

$this->registerFormFields(
    'admin.node',
    ['region' => ['required', 'string', 'max:32']],
    fn (Node $node): array => ['region' => NodeRegion::for($node)],
    fn (Node $node, array $values) => NodeRegion::store($node, $values['region']),
);
```

The 14 create and update endpoints accept an optional `extensions: {
[extensionId]: { [field]: value } }` body field. Each extension's rules
are applied as `extensions.{id}.{field}`, and only when the request
includes that extension's values. The extension's `save` callback runs
in the same database transaction as the core change, so a failure rolls
both back.

Server creation is the exception. Wings reads the new server while
provisioning it, so extension values are saved after provisioning
succeeds, outside the transaction.

For Node updates when Wings is unreachable. `UpdateNode` saves the node
and then throws `ConfigurationNotPersistedException` as a warning. The
node controller defers that exception until the extension values are
saved, so the node update is no longer rolled back.

`GET /api/admin/extensions/forms/{form}/{id}` returns every extension's
current values. It requires the resource's read permission. Edit pages
fetch it before rendering the form, but only when an extension has
registered fields for that form; the bootstrap payload now lists them
per extension in `forms`.

For users and servers the callbacks are optional, and values are stored
in the extension's scoped settings (`settings()->forUser($user)`,
`forServer($server)`). Values are limited to strings, numbers, booleans,
`null`, or lists of strings and numbers, which keeps the OpenAPI schema
and generated types concrete.

A `load` callback that throws, or returns an invalid value, is recorded
against the extension in the `form` phase. The frontend then hides that
extension's slot contributions on the edit page, so a save cannot
overwrite its stored values with defaults. Fields of a disabled or
failed extension are neither validated, saved nor loaded.

---------

Co-authored-by: robert dennis <31261583+robertdrakedennis@users.noreply.github.com>
2026-10-09 01:26:45 -04:00
robert dennis 135b298560 alpha cleanup 2026-10-08 19:17:30 -04:00
robert dennis e217e42360 complexity cleanup 2026-10-08 18:49:15 -04:00
robert dennis 56fb932a73 action cleanup 2026-10-08 17:40:00 -04:00
robert dennis bc50a8bbeb backend cleanup 2026-10-08 17:22:14 -04:00
Sky Mulley ff9527a2e9 fix tests to pass 2026-10-08 09:54:19 +01:00
Sandip Ghimire bb4e89826e fix(security): harden path validation, session revocation, and request handling (#7255)
# Security, Validation & Session Improvements

## Changes

* **Hardened IP/CIDR validation**
* Properly handles invalid IP addresses and CIDR ranges during API key
creation.
* Invalid IP/CIDR data now fails safely instead of causing a 500 error.

* **Improved reCAPTCHA error handling**
  * Handles network and verification failures gracefully.
  * Fixed undefined result notices and removed duplicate checks.

* **Added file permission activity logging**
* File permission (`chmod`) changes are now recorded in the activity
log.

* **Removed duplicate 2FA middleware**
* Cleaned up duplicate `RequireTwoFactorAuthentication` registration
from API routes.

* **Improved session revocation on password changes**
  * Password changes now invalidate other active sessions.
* Rotates the `remember_token` and removes stale database sessions where
applicable.
* Applies consistently across password resets and user password changes.

* **Reduced unnecessary public storage access**
* Disabled automatic public storage routes for the local filesystem disk
to reduce the attack surface.

* **Hardened file manager request validation**
  * Added strict validation for file permission modes.
  * Fixed optional `root` validation rules.
  * Added length limits for file paths, roots, and file/folder names.

* **Hardened mount source and target path validation**
* Prevents path traversal and subpath-based bypasses in mount source and
target validation.
  * Handles trailing slashes and normalized paths correctly.
* Prevents mounts from targeting protected subdirectories, such as
another server's volume directory.
2026-10-07 12:39:12 -04:00
Sky Mulley dd81db5d4d implement ability to set icon for extensions 2026-10-07 10:46:54 +01:00
Joshua Piper 66ce0f2a16 Fix 2 SFTP Lockout Ratelimit Bugs (#7257)
Fixes two SFTP lockout bugs:

- `ad374661f` moved the server lookup after the password check, so fake
server identifiers bypassed the rate limit.
- `24f340c9a` keyed the lockout on server + Wings IP, so anyone could
lock every user out of a server.

Unknown servers are now rejected before any credential check, and the
lockout is keyed on the normalised username + resolved server UUID.
2026-10-06 22:46:46 -04:00
robert dennis 7db75f2e4a install handling cleanup 2026-10-06 20:11:59 -04:00
robert dennis 8ebfdf8119 settings cleanup 2026-10-06 20:11:59 -04:00
DarkZmaj be0509dfb7 Apply the Rector changes reported on the current branch (#7251)
## Problem

`vendor/bin/rector --dry-run` reports three files that would change,
which fails the Static Analysis job of the Tests workflow.

## Reproduction

Run `vendor/bin/rector --dry-run --no-progress-bar` on a clean checkout
with PHP 8.4, as the workflow does. Rector lists `PasswordBroker.php`,
`PasswordBrokerManager.php` and `FileController.php`. With PHP 8.3 the
command reports nothing, because some rules depend on the running PHP
version.

## Root cause

Recent changes in these three files were merged without running Rector,
so they differ from the style the project enforces.

## Fix

Apply exactly the changes Rector prints:

* `PasswordBroker`: compare the callback with `instanceof Closure`
instead of `!== null`.
* `PasswordBrokerManager`: use `throw_unless` and `throw_if` with the
exception class string.
* `FileController`: name the caught exception
`$daemonConnectionException` after its type.

## Testing

* `vendor/bin/rector --dry-run` no longer reports changes locally, and
PHPStan and Pint still pass.
* The authentication integration tests and the server file integration
tests pass (86 tests).
* I could not run Rector under PHP 8.4 locally, so the Static Analysis
job of this pull request is the confirmation.

## Compatibility considerations

Behaviour is unchanged. The `instanceof Closure` check is stricter than
a null check only for callbacks that are not closures, and the parameter
is already typed as a nullable closure.
2026-10-06 15:16:49 +01:00
Sky Mulley 240aaf62ea properly handle file permissions regarding to creation and updating 2026-10-06 13:51:34 +01:00
Sky Mulley 76b49b1be1 improve reset password security 2026-10-06 13:13:39 +01:00
Sky Mulley c848794e13 hide recaptcha inputted secret key from settings 2026-10-06 12:57:00 +01:00
Sky Mulley ad374661f2 prevent ability to scrape usernames from panel by preventing timing differences between correct and wrong usernames 2026-10-06 12:53:25 +01:00
Anthony e52fdfd416 Fix extension translations staying cached after an extension update
Fixes #7245
2026-10-06 00:18:41 -05:00