-
-
Notifications
You must be signed in to change notification settings - Fork 282
Add changes from upstream #2293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c8983fd
Scope the remote node token to limit the servers it can manage for ba…
Boy132 c4bbd3b
Improve SFTP session revocation to cover password changes and account…
Boy132 bcab435
Improve security posture, update dependencies
Boy132 99168a0
bump rate limits until we can improve some bad endpoint calls
Boy132 dd9adc7
Fix: Compare to correct variable in startup variable activity log
Boy132 a06279d
Fix transfer status permission checks
Boy132 2cb63b5
Throttle email address changes on accounts to limit enumeration
Boy132 43fd7b3
Lock resources more explicitly when creating databases or backups
Boy132 77e94e3
fix phpstan
Boy132 e8d5ec3
fixes and cleanup
Boy132 8d86944
rabbit fixes
Boy132 a463277
fix tests
Boy132 20a4e10
fix mock in test
Boy132 2451018
fix activity log name
Boy132 8fc9c1e
use correct method name
Boy132 3dd6d04
move TwoFactorListener back
Boy132 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?php | ||
|
|
||
| namespace App\Events\User; | ||
|
|
||
| use App\Events\Event; | ||
| use App\Models\User; | ||
| use Illuminate\Queue\SerializesModels; | ||
|
|
||
| class Deleting extends Event | ||
| { | ||
| use SerializesModels; | ||
|
|
||
| /** | ||
| * Create a new event instance. | ||
| */ | ||
| public function __construct(public User $user) {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?php | ||
|
|
||
| namespace App\Events\User; | ||
|
|
||
| use App\Models\User; | ||
| use Illuminate\Foundation\Events\Dispatchable; | ||
|
|
||
| final class PasswordChanged | ||
| { | ||
| use Dispatchable; | ||
|
|
||
| public function __construct(public readonly User $user) {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| <?php | ||
|
|
||
| namespace App\Http\Middleware; | ||
|
|
||
| use Illuminate\Http\Request; | ||
| use Illuminate\Http\Response; | ||
|
|
||
| class SetSecurityHeaders | ||
| { | ||
| /** | ||
| * Ideally we move away from X-Frame-Options/X-XSS-Protection and implement a | ||
| * proper standard CSP, but I can guarantee that will break for a lot of folks | ||
| * using custom plugins and who knows what image embeds. | ||
| * | ||
| * We'll circle back to that at a later date when it can be more fully controlled | ||
| * by the admin to support those cases without too much trouble. | ||
| * | ||
| * @var array<string, string> | ||
| */ | ||
| protected static array $headers = [ | ||
| 'X-Frame-Options' => 'DENY', | ||
| 'X-Content-Type-Options' => 'nosniff', | ||
| 'X-XSS-Protection' => '1; mode=block', | ||
| 'Referrer-Policy' => 'no-referrer-when-downgrade', | ||
| ]; | ||
|
|
||
| /** | ||
| * Enforces some basic security headers on all responses returned by the software. | ||
| * If a header has already been set in another location within the code it will be | ||
| * skipped over here. | ||
| * | ||
| * @param (\Closure(mixed): Response) $next | ||
| */ | ||
| public function handle(Request $request, \Closure $next): mixed | ||
| { | ||
| $response = $next($request); | ||
|
|
||
| foreach (static::$headers as $key => $value) { | ||
| if (!$response->headers->has($key)) { | ||
| $response->headers->set($key, $value); | ||
| } | ||
| } | ||
|
|
||
| return $response; | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| <?php | ||
|
|
||
| namespace App\Jobs; | ||
|
|
||
| use App\Models\Node; | ||
| use App\Models\Server; | ||
| use App\Repositories\Daemon\DaemonServerRepository; | ||
| use Illuminate\Contracts\Queue\ShouldBeUnique; | ||
| use Illuminate\Contracts\Queue\ShouldQueue; | ||
| use Illuminate\Foundation\Queue\Queueable; | ||
| use Illuminate\Http\Client\ConnectionException; | ||
| use Illuminate\Queue\Attributes\DeleteWhenMissingModels; | ||
| use Illuminate\Queue\Attributes\WithoutRelations; | ||
|
|
||
| /** | ||
| * Revokes all SFTP access for a user on a given node or for a specific server. | ||
| */ | ||
| #[DeleteWhenMissingModels] | ||
| class RevokeSftpAccessJob implements ShouldBeUnique, ShouldQueue | ||
| { | ||
| use Queueable; | ||
|
|
||
| public int $tries = 3; | ||
|
|
||
| public int $maxExceptions = 1; | ||
|
|
||
| public function __construct( | ||
| public readonly string $user, | ||
| #[WithoutRelations] | ||
| public readonly Server|Node $target, | ||
| ) {} | ||
|
|
||
| public function uniqueId(): string | ||
| { | ||
| $target = $this->target instanceof Node ? "node:{$this->target->uuid}" : "server:{$this->target->uuid}"; | ||
|
|
||
| return "revoke-sftp:{$this->user}:{$target}"; | ||
| } | ||
|
|
||
| public function handle(DaemonServerRepository $repository): void | ||
| { | ||
| try { | ||
| if ($this->target instanceof Server) { | ||
| $repository->setServer($this->target)->deauthorize($this->user); | ||
| } else { | ||
| $repository->setNode($this->target)->deauthorize($this->user); | ||
| } | ||
| } catch (ConnectionException) { | ||
| // Keep retrying this job with a longer and longer backoff until we hit three | ||
| // attempts at which point we stop and will assume the node is fully offline | ||
| // and we are just wasting time. | ||
| $this->release($this->attempts() * 10); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.