Skip to content

Commit

Permalink
Let's move the fun values to the correct namespace
Browse files Browse the repository at this point in the history
Ref #289
  • Loading branch information
spaze committed Mar 15, 2024
1 parent 8edf5be commit ca0446b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
8 changes: 3 additions & 5 deletions site/app/Application/SanitizedPhpInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace MichalSpacekCz\Application;

use MichalSpacekCz\EasterEgg\PhpInfoCookieSanitization;
use MichalSpacekCz\Http\Cookies\CookieName;
use MichalSpacekCz\Http\Cookies\Cookies;
use Nette\Http\Session;
Expand All @@ -22,10 +23,7 @@ public function __construct(
public function getHtml(): string
{
// Session id is sanitized by default but let's be explicit here
$this->phpInfo->addSanitization(
$this->sessionHandler->getId(),
'SetecAstronomy31337Y0lo53ssi0nId⛄',
);
$this->phpInfo->addSanitization($this->sessionHandler->getId(), PhpInfoCookieSanitization::SESSION_ID);

// Sanitize these as well even though they're sent to sign-in URL only
$cookieNames = [
Expand All @@ -35,7 +33,7 @@ public function getHtml(): string
foreach ($cookieNames as $cookieName) {
$cookie = $this->cookies->getString($cookieName);
if ($cookie !== null) {
$this->phpInfo->addSanitization($cookie, 'TooManySecrets31337Y0loCookieVal☃️');
$this->phpInfo->addSanitization($cookie, PhpInfoCookieSanitization::COOKIE_VALUE);
}
}
return $this->phpInfo->getHtml();
Expand Down
13 changes: 13 additions & 0 deletions site/app/EasterEgg/PhpInfoCookieSanitization.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
declare(strict_types = 1);

namespace MichalSpacekCz\EasterEgg;

class PhpInfoCookieSanitization
{

public const string SESSION_ID = 'SetecAstronomy31337Y0lo53ssi0nId⛄';

public const string COOKIE_VALUE = 'TooManySecrets31337Y0loCookieVal☃️';

}

0 comments on commit ca0446b

Please sign in to comment.