-
Notifications
You must be signed in to change notification settings - Fork 0
First agent pass #1
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
Open
valzargaming
wants to merge
21
commits into
master
Choose a base branch
from
first-agent-pass
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d331518
First pass
valzargaming bbf2dce
Fix namespacing and deprecations
valzargaming aa76365
Create cs.yml
valzargaming 4abcfbe
Update cs.yml
valzargaming b3ce546
Update cs.yml
valzargaming b153387
Update cs.yml
valzargaming fd4c012
Update composer.json
valzargaming 02c7e9b
Use Firebase for JWT tokens
valzargaming a501d3a
cs fixer
valzargaming 28742e5
private => protected
valzargaming 03679b9
Carbon timestamps
valzargaming 47ae25a
Container throws if the array key doesn't exist
valzargaming 376b2fe
Update DiscordServiceProvider.php
valzargaming 2e0cd4e
Discord Factory as a service
valzargaming 9585588
Fix setAccessible deprecation
valzargaming ab9418d
Add unit tests to github workflow
valzargaming 91883dc
Use pest for unit tests
valzargaming eba5057
Fix naming schema
valzargaming cb6334b
Repositories and Endpoints
valzargaming 926b4c6
Create Contracts.php
valzargaming 32ae985
Update repository methods for saving
valzargaming 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,29 @@ | ||
| name: Run CS on pull requests | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
|
|
||
| jobs: | ||
| cs: | ||
| name: Run composer cs | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| php-version: ['8.3'] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: composer install --prefer-dist --no-progress --no-suggest | ||
|
|
||
| - name: Run CS script | ||
| run: composer run-script cs | ||
|
|
||
| - name: Run unit tests | ||
| run: composer run-script unit |
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,32 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /* | ||
| * This file is a part of the In Absentia project. | ||
| * | ||
| * Copyright (c) 2026-present Valithor Obsidion <valithor@discordphp.org> | ||
| * | ||
| * This file is subject to the MIT license that is bundled | ||
| * with this source code in the LICENSE.md file. | ||
| */ | ||
|
|
||
| namespace BackendPhp\Account; | ||
|
|
||
| use Psr\Http\Message\ServerRequestInterface; | ||
| use React\Promise\PromiseInterface; | ||
|
|
||
| class Handler | ||
| { | ||
| protected Service $service; | ||
|
|
||
| public function __construct(Service $service) | ||
| { | ||
| $this->service = $service; | ||
| } | ||
|
|
||
| public function getAccount(ServerRequestInterface $request): PromiseInterface | ||
| { | ||
| return $this->service->getAccount($request->getAttribute('auth') ?? null); | ||
| } | ||
| } |
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,26 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /* | ||
| * This file is a part of the In Absentia project. | ||
| * | ||
| * Copyright (c) 2026-present Valithor Obsidion <valithor@discordphp.org> | ||
| * | ||
| * This file is subject to the MIT license that is bundled | ||
| * with this source code in the LICENSE.md file. | ||
| */ | ||
|
|
||
| namespace BackendPhp\Account; | ||
|
|
||
| use React\Promise\PromiseInterface; | ||
| use function React\Promise\resolve; | ||
|
|
||
| class Repository | ||
| { | ||
| public function findById(string $id): PromiseInterface | ||
| { | ||
| // Placeholder for async DB lookup. | ||
| return resolve(null); | ||
| } | ||
| } |
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,35 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /* | ||
| * This file is a part of the In Absentia project. | ||
| * | ||
| * Copyright (c) 2026-present Valithor Obsidion <valithor@discordphp.org> | ||
| * | ||
| * This file is subject to the MIT license that is bundled | ||
| * with this source code in the LICENSE.md file. | ||
| */ | ||
|
|
||
| namespace BackendPhp\Account; | ||
|
|
||
| use React\Promise\PromiseInterface; | ||
| use function React\Promise\resolve; | ||
|
|
||
| class Service | ||
| { | ||
| protected Repository $repo; | ||
|
|
||
| public function __construct(Repository $repo) | ||
| { | ||
| $this->repo = $repo; | ||
| } | ||
|
|
||
| public function getAccount(?array $auth): PromiseInterface | ||
| { | ||
| // Return account object for authenticated user | ||
| $res = ['id' => $auth['sub'] ?? null, 'banked' => 0]; | ||
|
|
||
| return resolve($res); | ||
| } | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Account\Service::getAccounttrusts thesubfield from theauthrequest attribute as the account identifier without ensuring that this value comes from a cryptographically verified token. Given the current token implementation, an attacker can forge a token with an arbitrarysuband, once persistence is added, retrieve or operate on another user's account data. Even after hardening token verification, this method should treatauthas untrusted input and re-check authorization (e.g., by loading the account and confirming ownership/permissions) before returning sensitive account information.