Skip to content

Commit 66f7a3d

Browse files
AngelFQCclaude
andcommitted
Security: Remove exposed validation-token test endpoint
`ValidationTokenController::testGenerateToken()` exposed a route that minted a valid `ValidationToken` for any resource id with no authorization check, so any caller could forge tokens and drive the privileged validation actions they gate (e.g. unsubscribing arbitrary users from tickets). The method was a test-only helper, referenced nowhere and pointing at a route name that no longer exists, so it is removed entirely along with its now-unused `UrlGeneratorInterface` import. Token issuance remains confined to the authorized `ValidationTokenHelper` flow. Refs GHSA-9g35-w847-rpp8 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 00eb082 commit 66f7a3d

1 file changed

Lines changed: 0 additions & 16 deletions

File tree

src/CoreBundle/Controller/ValidationTokenController.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Symfony\Component\HttpFoundation\RequestStack;
2020
use Symfony\Component\HttpFoundation\Response;
2121
use Symfony\Component\Routing\Attribute\Route;
22-
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
2322
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
2423

2524
#[Route('/validate')]
@@ -71,21 +70,6 @@ public function validate(string $type, string $hash): Response
7170
]);
7271
}
7372

74-
#[Route('/test/generate-token/{type}/{resourceId}', name: 'test_generate_token')]
75-
public function testGenerateToken(string $type, int $resourceId): Response
76-
{
77-
$typeId = $this->validationTokenHelper->getTypeId($type);
78-
$token = new ValidationToken($typeId, $resourceId);
79-
$this->tokenRepository->save($token, true);
80-
81-
$validationLink = $this->generateUrl('validate_token', [
82-
'type' => $type,
83-
'hash' => $token->getHash(),
84-
], UrlGeneratorInterface::ABSOLUTE_URL);
85-
86-
return new Response("Generated token: {$token->getHash()}<br>Validation link: <a href='{$validationLink}'>{$validationLink}</a>");
87-
}
88-
8973
/**
9074
* Processes the action associated with the given token type.
9175
*/

0 commit comments

Comments
 (0)