1055 Commits

Author SHA1 Message Date
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
Carlton
33695c642d Fix transfer status permission checks (#5573) 2026-03-26 16:53:41 -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
Dane Everitt
7c9c56bf51 Scope the remote node token to limit the servers it can manage for backups/transfers (#5476)
Improves the security posture of things more by limiting the servers
that a node can even communicate about with the Panel.
2026-02-11 16:04:09 -08:00
Mackenzie Molloy
7576d0d08e Added support for viewing and deleting of any Application API Keys (#5176)
This PR closes Issue #5175.

For context, I am aware that Application API Keys are deprecated in
favour of Client API Keys however they are still operational within
Pterodactyl and thus, not fully removed.

Currently in Pterodactyl, as an Admin, you can only view your
Application API Keys on the Admin Panel. In this PR, I made it so all
Application Keys are visible and deletable. The key strings are
obfuscated if the key does not belong to the user viewing.


![image](https://github.com/user-attachments/assets/9edb2533-d99c-4ec3-80cc-25630fd48594)

The reason for adding this is primarily so other admin users can be
aware of and delete another admin user's Application API keys from the
UI. This functionality is useful in the event of a malicious user
compromising an admin account, creating some API Keys to continue their
attacks and the owner of the compromised admin account being unaware of
Application API Keys. In this instance, even after a password reset, the
attack could continue via the Application API without the admin
realising it.

I've tested the creation and deleting of keys along with using keys via
the Application API to ensure no breakages have occurred.

---------

Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2026-02-11 16:03:35 -08:00
Всеволод Мельник
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
Mackenzie Molloy
238d371352 Feature: Sort Users on Admin/Users by Administrators first (#5098) 2026-01-04 11:12:55 -08:00
Dane Everitt
032bf076d9 Ensure that TOTP tokens cannot be reused (#5481) 2025-12-30 12:27:11 -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
0917e60a3b Return correct error message when deleting self, add test coverage (#5456) 2025-12-24 16:13:31 -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
01fd763fe9 fix: add additional input validation
Signed-off-by: Matthew Penner <me@matthewp.io>
2025-06-18 12:21:26 -06: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
Matthew Penner
f8dfef04c4 api(remote): fix oops in BackupStatusController, yet again 2024-05-08 18:08:18 -06:00
Matthew Penner
7bfc265a7e api(remote): fix use of missing node_id field
Fixes #5088
2024-05-04 16:06:13 -06:00
Matthew Penner
b1fa3927c1 api(remote): fix oops in BackupStatusController 2024-04-11 10:42:18 -06:00
Matthew Penner
f671046947 admin: tweaks to validation and rendering 2024-04-10 18:13:25 -06:00
Matthew Penner
319ca683f8 api(remote): ensure requesting node is checked 2024-04-10 17:38:09 -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
4626118d77 app: fix remaining email config keys 2022-12-12 14:31:49 -07:00
Matthew Penner
6272bb6710 api(remote): cleanup 2022-12-01 11:52:22 -07:00
Matthew Penner
3c278a8c51 api(remote): check if transfer is present before trying to update status 2022-12-01 11:51:26 -07:00
Lance Pioch
a4f6870518 server: track reinstall failures differently from initial install failures (#4531) 2022-11-21 13:53:54 -07:00
Matthew Penner
039ad4abf0 api(server): log activity when server description is changed 2022-11-21 13:43:19 -07:00
Matthew Penner
df2402b54f Streaming Transfers (#4548) 2022-11-14 18:25:07 -07:00
Boy132
f2095e815e Allow users to change the server description (#4420) 2022-10-31 10:20:53 -06:00
Lance Pioch
548affba84 Fix linting (#4504) 2022-10-29 17:58:55 -06:00
Lance Pioch
e49ba65709 Fix config key names (#4464) 2022-10-23 18:51:20 -06:00
Matthew Penner
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
Matthew Penner
815e1e4c4d Ensure server is not in a conflicting state before initiating a transfer (#4403) 2022-10-04 19:57:24 -06:00
Matthew Penner
44598bf724 Support configuring storage class for S3 backup uploads (#4399)
Closes <https://github.com/pterodactyl/panel/issues/4072>
2022-10-04 19:39:25 -06:00
Matthew Penner
2dcc46ecd6 backups: support Cloudflare R2 by listing uploaded parts from Wings 2022-09-26 11:15:52 -06:00
Pascal Zarrad
1ca4b08b48 backups: add S3 part size configuration (#4382) 2022-09-25 14:38:49 -06:00
Matthew Penner
68e9100e57 admin(eggs): add force_outgoing_ip option (#4323)
Closes #3841
2022-09-25 13:24:54 -06:00
Matthew Penner
8e1a21563e server: add configuration for install notifications (#4331)
* server: track `installed_at`, only send install notification on first install
* server: add configuration for install notifications
2022-09-25 13:16:58 -06:00
DaneEveritt
2da8042b0f Fix clock() usage causing errors in prod environments 2022-07-24 20:43:14 -04:00
DaneEveritt
f8c48214a5 Track file uploads on Wings, not the panel 2022-07-24 17:13:17 -04:00
DaneEveritt
7558c0380e Don't log SFTP logins, it just is noisy 2022-07-10 14:30:11 -04:00
DaneEveritt
33ab762f5a Add support for tracking more SFTP specific events 2022-07-09 19:30:38 -04:00