Commit Graph
225 Commits
Author SHA1 Message Date
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00
Noah Ross a94b8bdb4e Fix API Key Limit Race Condition Bypass (#5620)
The API key creation endpoint checks that a user has fewer than 25 keys
before creating a new one. The problem is that the count was read from
an eager-loaded collection (`$user->apiKeys->count()`) with no lock
held, so concurrent requests could both pass the check and each create a
key, pushing the user past the 25-key cap.

The fix wraps the count check and key creation in a single database
transaction with `lockForUpdate()` on the query. Only one request at a
time can evaluate and modify the count, closing the race window.

### Proof of Concept

Run this in the browser console while authenticated with a user that has
24 API keys:

```js
(async () => {
    const makeKey = (desc) => fetch('/api/client/account/api-keys', {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
        'X-Requested-With': 'XMLHttpRequest',
        'X-XSRF-TOKEN':
  decodeURIComponent(document.cookie.match(/XSRF-TOKEN=([^;]+)/)[1]),
      },
      body: JSON.stringify({ description: desc, allowed_ips: [] }),
    });

    const [r1, r2] = await Promise.all([makeKey('0024'), makeKey('0025')]);
    console.log('0024:', r1.status, (await r1.text()).slice(0, 200));
    console.log('0025:', r2.status, (await r2.text()).slice(0, 200));
})();
```

On the old code, both requests can return 200 (you may need to run this
a few times to hit the race window). After the fix, the second request
correctly returns a 400 error.
2026-05-23 11:16:18 -07:00
Dane Everitt 7ffcd63631 Attach a scope(s) to JWTs created by the panel (#5636)
Necessary for proper token identification on Wings.
2026-05-23 11:15:36 -07:00
Dane Everitt ec7231bd4a Lock resources more explicitly when creating databases or backups (#5613)
Addresses an issue where the concept of a lock was there, but no actual
lock was acquired.
2026-04-01 18:46:01 -07:00
Dane Everitt 56fe10fdd6 Throttle email address changes on accounts to limit enumeration (#5612)
This change applies a rate limit to account email changes to prevent
enumeration on the system. The throttle is applied at the account level.
Administrators can still update an account's email address manually to
bypass this restriction if/when necessary.
2026-04-01 17:54:30 -07:00
Daniel Barton 51bbd10a01 Fix: Compare to correct variable in startup variable activity log (#5605)
- Fixes issue where the panel would create activity logs even when the
value didn't change
- Log an empty string instead of displaying "null" when the variable is
empty

Closes #5604
2026-03-26 16:24:02 -07:00
Dane Everitt 0e74f3aade Improve SFTP session revocation to cover password changes and account deletion (#5568)
This expands upon previous work done to better disconnect users from
SFTP when different events occur within Pterodactyl. This new logic also
accounts for password changes and their account being deleted entirely
from the system.

These events now trigger background jobs that will reach out to every
node they are associated with to ensure they're disconnected if
currently connected.
2026-02-14 10:51:26 -08:00
Всеволод МельникandDaneEveritt 09caa0d499 Merge commit from fork
* Add throttling to resource creation endpoints

* Fix middleware registration for the throttlers

* Lock the server's resource models when adding new ones

* Throttle subusers even more

---------

Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2026-01-05 16:05:38 -08:00
Dane Everitt 2bd9d8badd Disconnect SFTP/Websocket when a user is removed as a subuser (#5472) 2025-12-26 17:51:25 -08:00
Dane Everitt a264791fd4 Update PHP and JS dependencies to latest versions and modernize codebase (#5446) 2025-12-20 15:55:13 -08:00
Matthew Penner 8ca098940a chore: update composer dependencies (#5198)
Signed-off-by: Matthew Penner <me@matthewp.io>
2024-10-21 19:18:20 -06:00
Robert Nisipeanu 85f1259709 fix(4752): check if description field present on request 2023-08-22 15:01:49 -10:00
Matthew Penner 1d38b4f0e2 Laravel 10 (#4706) 2023-02-23 12:30:16 -07:00
Devonte W b746c3ead1 fix(api/client): add validation for backup request body (#4704) 2023-02-23 12:23:12 -07:00
Matthew Penner 866b6df4b0 api(task): ensure sequence_id always starts at 1 2023-01-24 16:19:34 -07:00
Matthew Penner 2b14e46eec api: fix sequence_id being ignored in server task API
Closes #4434
2023-01-24 15:57:24 -07:00
Omar Kamel e43da311fe api(client): keep existing server description when empty (#4619) 2022-12-14 14:19:45 -07:00
Matthew Penner 039ad4abf0 api(server): log activity when server description is changed 2022-11-21 13:43:19 -07:00
Boy132 f2095e815e Allow users to change the server description (#4420) 2022-10-31 10:20:53 -06:00
Matthew PennerandDaneEveritt cbcf62086f Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2022-10-14 10:59:20 -06:00
Dane Everitt c748fa9842 fix: exclude any permissions not defined internally when updating or creating subusers (#4416) 2022-10-09 16:14:16 -06:00
Dane Everitt e0e0689846 feat: bump account key limit to 25 (#4417)
Closes #4394
2022-10-08 15:14:03 -06:00
DaneEveritt f8c48214a5 Track file uploads on Wings, not the panel 2022-07-24 17:13:17 -04:00
DaneEveritt 4a8c3c4a34 Add activity tracking for console/power actions 2022-07-04 18:11:53 -04:00
DaneEveritt dc90d8b505 Include the "user_uuid" claim on JWTs for easier Wings user tracking 2022-07-04 17:34:56 -04:00
DaneEveritt 0216e3fd5b Don't log activity if the email wasn't actually changed 2022-07-03 14:29:01 -04:00
DaneEveritt 2d836156d2 Update totp disable modal; require password for enable operation 2022-07-03 14:27:37 -04:00
DaneEveritt 4aa163b76f Hide IP addresses from activity logs not generated by the user themselves 2022-06-27 20:52:27 -04:00
DaneEveritt ca39830333 allow filtering servers by description; closes #4150 2022-06-26 13:26:12 -04:00
DaneEveritt cf01490883 Support hiding activity from admin accounts not associated with the server 2022-06-18 15:48:22 -04:00
DaneEveritt 4f3651b578 Fix typo with identifier 2022-06-18 12:16:54 -04:00
DaneEveritt 2f1c8ae91d Add basic server activity log view 2022-06-12 15:16:48 -04:00
DaneEveritt 0b4936ff1c Break out rows for activity; show metadata icon 2022-06-12 15:08:26 -04:00
DaneEveritt d1da46c5aa Fix incorrect API definitions 2022-06-05 18:28:08 -04:00
DaneEveritt 03a497fb8a Use a post request to delete SSH keys, some hashes use slashes which cause 404 errors; closes #4100 2022-05-30 17:28:42 -04:00
DaneEveritt 9300e1116d Fix failing tests 2022-05-29 20:39:51 -04:00
DaneEveritt a5521ecb79 Add support for returning transforming activity logs on the front-end 2022-05-29 20:34:48 -04:00
DaneEveritt 9b7af02690 Add activity logging to most of the endpoints 2022-05-29 19:26:28 -04:00
DaneEveritt 287fd60891 Log activity when modifying account details 2022-05-29 18:48:35 -04:00
DaneEveritt 2fc5a734f9 Update backup logic to use activity logs, not audit logs 2022-05-29 16:19:04 -04:00
DaneEveritt cbecfff6da Add activity logging for files 2022-05-29 13:56:39 -04:00
DaneEveritt c14c7b436e Pass along new fields to Wings instance when endpoint is used; closes #4048 2022-05-28 13:45:23 -04:00
DaneEveritt b051718afe Fix up API handling logic for keys and set a prefix on all keys 2022-05-22 19:03:51 -04:00
DaneEveritt 33bafe9277 Simplify transformer logic 2022-05-22 16:23:22 -04:00
DaneEveritt f7fc67344e Ensure tokens are found in the database using the expected logic 2022-05-22 16:05:58 -04:00
DaneEveritt e9c633fd03 Update transformers and controllers to no longer pull an API key attribute 2022-05-22 15:37:39 -04:00
DaneEveritt e313dff674 Massively simplify API binding logic
Changes the API internals to use normal Laravel binding which automatically supports nested-models and can determine their relationships. This removes a lot of confusingly complex internal logic and replaces it with standard Laravel code.

This also removes a deprecated "getModel" method and fully replaces it with a "parameter" method that does stricter type-checking.
2022-05-22 14:10:01 -04:00
DaneEveritt a9364061c1 Store keys in standard format; query with fingerprint not public key 2022-05-15 16:41:15 -04:00
DaneEveritt 6554164252 Add test coverage for the SSH key endpoints 2022-05-14 18:08:48 -04:00
DaneEveritt 97280a62a2 Add support for storing SSH keys on user accounts 2022-05-14 17:31:53 -04:00