From 11d3a1118a816703c51deade1681975d5ecfc2f5 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 20 Oct 2025 21:52:33 +1300 Subject: [PATCH 01/12] Fix autoload --- tests/Auth/Algorithms/Argon2Test.php | 2 +- tests/Auth/Algorithms/BcryptTest.php | 2 +- tests/Auth/Algorithms/MD5Test.php | 2 +- tests/Auth/Algorithms/PHPassTest.php | 2 +- tests/Auth/Algorithms/PlaintextTest.php | 2 +- tests/Auth/Algorithms/ScryptModifiedTest.php | 2 +- tests/Auth/Algorithms/ScryptTest.php | 2 +- tests/Auth/Algorithms/ShaTest.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/Auth/Algorithms/Argon2Test.php b/tests/Auth/Algorithms/Argon2Test.php index b9d46d4..043115d 100644 --- a/tests/Auth/Algorithms/Argon2Test.php +++ b/tests/Auth/Algorithms/Argon2Test.php @@ -1,6 +1,6 @@ Date: Mon, 20 Oct 2025 21:53:04 +1300 Subject: [PATCH 02/12] Fix option keys --- src/Auth/Hashes/Argon2.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Auth/Hashes/Argon2.php b/src/Auth/Hashes/Argon2.php index 8e3f435..9eca61a 100644 --- a/src/Auth/Hashes/Argon2.php +++ b/src/Auth/Hashes/Argon2.php @@ -12,8 +12,8 @@ class Argon2 extends Hash public function __construct() { $this->setOption('type', $this->getName()); - $this->setOption('memoryCost', 65536); - $this->setOption('timeCost', 4); + $this->setOption('memory_cost', 65536); + $this->setOption('time_cost', 4); $this->setOption('threads', 3); } @@ -43,7 +43,7 @@ public function verify(string $value, string $hash): bool */ public function setMemoryCost(int $cost): self { - $this->setOption('memoryCost', $cost); + $this->setOption('memory_cost', $cost); return $this; } @@ -58,7 +58,7 @@ public function setMemoryCost(int $cost): self */ public function setTimeCost(int $cost): self { - $this->setOption('timeCost', $cost); + $this->setOption('time_cost', $cost); return $this; } From ef168027b92ab4bf187e99ff9ec037dcb15e50dd Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 20 Oct 2025 21:53:16 +1300 Subject: [PATCH 03/12] Add options tests --- tests/Auth/Algorithms/Argon2Test.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Auth/Algorithms/Argon2Test.php b/tests/Auth/Algorithms/Argon2Test.php index 043115d..83ac931 100644 --- a/tests/Auth/Algorithms/Argon2Test.php +++ b/tests/Auth/Algorithms/Argon2Test.php @@ -18,10 +18,12 @@ public function testHash(): void { $password = 'test123'; $hash = $this->argon2->hash($password); - $this->assertNotEmpty($hash); $this->assertIsString($hash); $this->assertStringStartsWith('$argon2id$', $hash); + $this->assertStringContainsString('m='.$this->argon2->getOption('memory_cost'), $hash); + $this->assertStringContainsString('t='.$this->argon2->getOption('time_cost'), $hash); + $this->assertStringContainsString('p='.$this->argon2->getOption('threads'), $hash); $this->assertTrue($this->argon2->verify($password, $hash)); $this->assertFalse($this->argon2->verify('wrongpassword', $hash)); } @@ -34,6 +36,7 @@ public function testValidMemoryCost(): void // Test that the new memory cost is being used by verifying a hash $password = 'test123'; $hash = $this->argon2->hash($password); + $this->assertStringContainsString('m='.$cost, $hash); $this->assertTrue($this->argon2->verify($password, $hash)); } @@ -45,6 +48,7 @@ public function testValidTimeCost(): void // Test that the new time cost is being used by verifying a hash $password = 'test123'; $hash = $this->argon2->hash($password); + $this->assertStringContainsString('t='.$cost, $hash); $this->assertTrue($this->argon2->verify($password, $hash)); } @@ -56,6 +60,7 @@ public function testValidThreads(): void // Test that the new thread count is being used by verifying a hash $password = 'test123'; $hash = $this->argon2->hash($password); + $this->assertStringContainsString('p='.$threads, $hash); $this->assertTrue($this->argon2->verify($password, $hash)); } From eeb6eb47387dcd4a7bd3d58f36652523cddf08d5 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 20 Oct 2025 22:24:15 +1300 Subject: [PATCH 04/12] Fix codeql --- .github/workflows/code-ql-analysis.yml | 4 ++-- composer.json | 4 ++-- pint.json | 16 +++++++++++++++ src/Auth/Hash.php | 25 +++++++---------------- src/Auth/Hashes/Argon2.php | 15 ++++++-------- src/Auth/Hashes/Bcrypt.php | 5 ++--- src/Auth/Hashes/PHPass.php | 12 +++++------ src/Auth/Hashes/Scrypt.php | 24 +++++++++------------- src/Auth/Hashes/ScryptModified.php | 15 ++++++-------- src/Auth/Hashes/Sha.php | 5 ++--- src/Auth/Proof.php | 19 +---------------- src/Auth/Proofs/Code.php | 11 +--------- src/Auth/Proofs/Password.php | 25 ++++++----------------- src/Auth/Proofs/Phrase.php | 2 -- src/Auth/Proofs/Token.php | 11 +--------- src/Auth/Store.php | 28 ++++---------------------- 16 files changed, 72 insertions(+), 149 deletions(-) create mode 100644 pint.json diff --git a/.github/workflows/code-ql-analysis.yml b/.github/workflows/code-ql-analysis.yml index 3417c30..2d75229 100644 --- a/.github/workflows/code-ql-analysis.yml +++ b/.github/workflows/code-ql-analysis.yml @@ -8,7 +8,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 @@ -16,5 +16,5 @@ jobs: - name: Run CodeQL run: | - docker run --rm -v $PWD:/app composer:2.6 sh -c \ + docker run --rm -v $PWD:/app composer:2 sh -c \ "composer install --profile --ignore-platform-reqs && composer check" \ No newline at end of file diff --git a/composer.json b/composer.json index 13831e5..76ea733 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,8 @@ }, "scripts": { "check": "./vendor/bin/phpstan analyse --level max src tests", - "lint": "./vendor/bin/pint --test", - "format": "./vendor/bin/pint" + "lint": "./vendor/bin/pint --config pint.json --test", + "format": "./vendor/bin/pint --config pint.json" }, "require": { "php": ">=8.0", diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..e0bbb80 --- /dev/null +++ b/pint.json @@ -0,0 +1,16 @@ +{ + "preset": "psr12", + "rules": { + "array_indentation": true, + "single_import_per_statement": true, + "simplified_null_return": true, + "ordered_imports": { + "sort_algorithm": "alpha", + "imports_order": [ + "const", + "class", + "function" + ] + } + } +} diff --git a/src/Auth/Hash.php b/src/Auth/Hash.php index b86481a..1ea62ee 100644 --- a/src/Auth/Hash.php +++ b/src/Auth/Hash.php @@ -12,11 +12,10 @@ abstract class Hash /** * Set hashing options * - * @param string $key The option key to set - * @param mixed $value The value to set for the option - * @return self + * @param string $key The option key to set + * @param mixed $value The value to set for the option */ - public function setOption(string $key, mixed $value): self + public function setOption(string $key, mixed $value): static { $this->options[$key] = $value; @@ -26,10 +25,9 @@ public function setOption(string $key, mixed $value): self /** * Set multiple hashing options at once * - * @param array $options Array of options to set - * @return self + * @param array $options Array of options to set */ - public function setOptions(array $options): self + public function setOptions(array $options): static { foreach ($options as $key => $value) { $this->setOption($key, $value); @@ -41,8 +39,8 @@ public function setOptions(array $options): self /** * Get a specific option value * - * @param string $key The option key to retrieve - * @param mixed $default Default value if option doesn't exist + * @param string $key The option key to retrieve + * @param mixed $default Default value if option doesn't exist * @return mixed The option value or default if not found */ public function getOption(string $key, mixed $default = null): mixed @@ -62,25 +60,16 @@ public function getOptions(): array /** * Hash a value - * - * @param string $value - * @return string */ abstract public function hash(string $value): string; /** * Verify a value against a hash - * - * @param string $value - * @param string $hash - * @return bool */ abstract public function verify(string $value, string $hash): bool; /** * Get the name of the hash algorithm - * - * @return string */ abstract public function getName(): string; } diff --git a/src/Auth/Hashes/Argon2.php b/src/Auth/Hashes/Argon2.php index 9eca61a..f7794df 100644 --- a/src/Auth/Hashes/Argon2.php +++ b/src/Auth/Hashes/Argon2.php @@ -36,12 +36,11 @@ public function verify(string $value, string $hash): bool /** * Set memory cost * - * @param int $cost Memory cost in KiB - * @return self + * @param int $cost Memory cost in KiB * * @throws \InvalidArgumentException */ - public function setMemoryCost(int $cost): self + public function setMemoryCost(int $cost): static { $this->setOption('memory_cost', $cost); @@ -51,12 +50,11 @@ public function setMemoryCost(int $cost): self /** * Set time cost * - * @param int $cost Number of iterations - * @return self + * @param int $cost Number of iterations * * @throws \InvalidArgumentException */ - public function setTimeCost(int $cost): self + public function setTimeCost(int $cost): static { $this->setOption('time_cost', $cost); @@ -66,12 +64,11 @@ public function setTimeCost(int $cost): self /** * Set number of threads * - * @param int $threads Number of threads to use - * @return self + * @param int $threads Number of threads to use * * @throws \InvalidArgumentException */ - public function setThreads(int $threads): self + public function setThreads(int $threads): static { $this->setOption('threads', $threads); diff --git a/src/Auth/Hashes/Bcrypt.php b/src/Auth/Hashes/Bcrypt.php index b7fc6be..74ecf97 100644 --- a/src/Auth/Hashes/Bcrypt.php +++ b/src/Auth/Hashes/Bcrypt.php @@ -34,12 +34,11 @@ public function verify(string $value, string $hash): bool /** * Set cost parameter * - * @param int $cost Cost parameter between 4 and 31 - * @return self + * @param int $cost Cost parameter between 4 and 31 * * @throws \InvalidArgumentException */ - public function setCost(int $cost): self + public function setCost(int $cost): static { if ($cost < 4 || $cost > 31) { throw new \InvalidArgumentException('Cost must be between 4 and 31'); diff --git a/src/Auth/Hashes/PHPass.php b/src/Auth/Hashes/PHPass.php index fa95790..7a2d157 100644 --- a/src/Auth/Hashes/PHPass.php +++ b/src/Auth/Hashes/PHPass.php @@ -73,7 +73,7 @@ public function verify(string $value, string $hash): bool */ protected function getRandomBytes(int $count): string { - if (! is_int($count) || $count < 1) { + if ($count < 1) { throw new \Exception('Argument count must be a positive integer'); } @@ -106,7 +106,7 @@ protected function getRandomBytes(int $count): string */ protected function encode64(string $input, int $count): string { - if (! is_int($count) || $count < 1) { + if ($count < 1) { throw new \Exception('Argument count must be a positive integer'); } @@ -226,8 +226,8 @@ private function cryptPrivate(string $password, string $setting): string /** * Set iteration count (log2) * - * @param int $count Iteration count (log2) between 4 and 31 - * @return self + * @param int $count Iteration count (log2) between 4 and 31 + * @return static * * @throws \InvalidArgumentException */ @@ -245,8 +245,8 @@ public function setIterationCount(int $count): PHPass /** * Set portable hashes mode * - * @param bool $portable Whether to use portable hashes - * @return self + * @param bool $portable Whether to use portable hashes + * @return static */ public function setPortableHashes(bool $portable): PHPass { diff --git a/src/Auth/Hashes/Scrypt.php b/src/Auth/Hashes/Scrypt.php index 33252b9..4f038c0 100644 --- a/src/Auth/Hashes/Scrypt.php +++ b/src/Auth/Hashes/Scrypt.php @@ -49,8 +49,8 @@ public function verify(string $value, string $hash): bool /** * Set CPU cost parameter * - * @param int $cost CPU cost parameter N. Must be larger than 1 and a power of 2 - * @return self + * @param int $cost CPU cost parameter N. Must be larger than 1 and a power of 2 + * @return static * * @throws \InvalidArgumentException */ @@ -68,12 +68,11 @@ public function setCpuCost(int $cost): self /** * Set memory cost parameter * - * @param int $cost Memory cost parameter r - * @return self + * @param int $cost Memory cost parameter r * * @throws \InvalidArgumentException */ - public function setMemoryCost(int $cost): self + public function setMemoryCost(int $cost): static { if ($cost < 1) { throw new \InvalidArgumentException('Memory cost must be >= 1'); @@ -87,12 +86,11 @@ public function setMemoryCost(int $cost): self /** * Set parallelization parameter * - * @param int $cost Parallelization parameter p - * @return self + * @param int $cost Parallelization parameter p * * @throws \InvalidArgumentException */ - public function setParallelCost(int $cost): self + public function setParallelCost(int $cost): static { if ($cost < 1) { throw new \InvalidArgumentException('Parallel cost must be >= 1'); @@ -106,12 +104,11 @@ public function setParallelCost(int $cost): self /** * Set output length * - * @param int $length Desired output length in bytes - * @return self + * @param int $length Desired output length in bytes * * @throws \InvalidArgumentException */ - public function setLength(int $length): self + public function setLength(int $length): static { if ($length < 16) { throw new \InvalidArgumentException('Length must be >= 16 bytes'); @@ -125,12 +122,11 @@ public function setLength(int $length): self /** * Set salt value * - * @param string $salt Salt value for the hash - * @return self + * @param string $salt Salt value for the hash * * @throws \InvalidArgumentException */ - public function setSalt(string $salt): self + public function setSalt(string $salt): static { if (empty($salt)) { throw new \InvalidArgumentException('Salt cannot be empty'); diff --git a/src/Auth/Hashes/ScryptModified.php b/src/Auth/Hashes/ScryptModified.php index 45938d4..2e3f896 100644 --- a/src/Auth/Hashes/ScryptModified.php +++ b/src/Auth/Hashes/ScryptModified.php @@ -105,12 +105,11 @@ private function hashKeys(string $signerKeyBytes, string $derivedKeyBytes): stri /** * Set salt value * - * @param string $salt Base64 encoded salt value - * @return self + * @param string $salt Base64 encoded salt value * * @throws \InvalidArgumentException */ - public function setSalt(string $salt): self + public function setSalt(string $salt): static { if (empty($salt)) { throw new \InvalidArgumentException('Salt cannot be empty'); @@ -128,12 +127,11 @@ public function setSalt(string $salt): self /** * Set salt separator * - * @param string $separator Base64 encoded salt separator - * @return self + * @param string $separator Base64 encoded salt separator * * @throws \InvalidArgumentException */ - public function setSaltSeparator(string $separator): self + public function setSaltSeparator(string $separator): static { if (! preg_match('/^[A-Za-z0-9+\/]+={0,2}$/', $separator)) { throw new \InvalidArgumentException('Salt separator must be base64 encoded'); @@ -147,12 +145,11 @@ public function setSaltSeparator(string $separator): self /** * Set signer key * - * @param string $key Base64 encoded signer key - * @return self + * @param string $key Base64 encoded signer key * * @throws \InvalidArgumentException */ - public function setSignerKey(string $key): self + public function setSignerKey(string $key): static { if (empty($key)) { throw new \InvalidArgumentException('Signer key cannot be empty'); diff --git a/src/Auth/Hashes/Sha.php b/src/Auth/Hashes/Sha.php index 90db2f6..fd68d2b 100644 --- a/src/Auth/Hashes/Sha.php +++ b/src/Auth/Hashes/Sha.php @@ -50,12 +50,11 @@ public function __construct() /** * Set SHA version * - * @param string $version SHA version to use - * @return self + * @param string $version SHA version to use * * @throws \InvalidArgumentException */ - public function setVersion(string $version): self + public function setVersion(string $version): static { if (! in_array($version, self::VALID_VERSIONS, true)) { throw new \InvalidArgumentException('Invalid SHA version. Valid versions are: '.implode(', ', self::VALID_VERSIONS)); diff --git a/src/Auth/Proof.php b/src/Auth/Proof.php index 897f52c..f3948eb 100644 --- a/src/Auth/Proof.php +++ b/src/Auth/Proof.php @@ -6,9 +6,6 @@ abstract class Proof { - /** - * @var Hash - */ protected Hash $hash; public function __construct() @@ -18,11 +15,8 @@ public function __construct() /** * Set custom hash - * - * @param Hash $hash - * @return self */ - public function setHash(Hash $hash): self + public function setHash(Hash $hash): static { $this->hash = $hash; @@ -31,8 +25,6 @@ public function setHash(Hash $hash): self /** * Get current hash - * - * @return Hash */ public function getHash(): Hash { @@ -41,16 +33,11 @@ public function getHash(): Hash /** * Generate a proof - * - * @return string */ abstract public function generate(): string; /** * Hash a proof - * - * @param string $proof - * @return string */ public function hash(string $proof): string { @@ -59,10 +46,6 @@ public function hash(string $proof): string /** * Verify a proof - * - * @param string $proof - * @param string $hash - * @return bool */ public function verify(string $proof, string $hash): bool { diff --git a/src/Auth/Proofs/Code.php b/src/Auth/Proofs/Code.php index 31abe92..df56448 100644 --- a/src/Auth/Proofs/Code.php +++ b/src/Auth/Proofs/Code.php @@ -6,14 +6,9 @@ class Code extends Proof { - /** - * @var int - */ protected int $length; /** - * @param int $length - * * @throws \Exception */ public function __construct(int $length = 6) @@ -29,8 +24,6 @@ public function __construct(int $length = 6) /** * Get the code length - * - * @return int */ public function getLength(): int { @@ -40,12 +33,10 @@ public function getLength(): int /** * Set the code length * - * @param int $length - * @return self * * @throws \Exception */ - public function setLength(int $length): self + public function setLength(int $length): static { if ($length <= 0) { throw new \Exception('Code length must be greater than 0'); diff --git a/src/Auth/Proofs/Password.php b/src/Auth/Proofs/Password.php index 4a55a00..2e08ffd 100644 --- a/src/Auth/Proofs/Password.php +++ b/src/Auth/Proofs/Password.php @@ -65,12 +65,8 @@ public function __construct(array $hashes = []) /** * Add a new hashing hash - * - * @param string $name - * @param Hash $hash - * @return self */ - public function addHash(string $name, Hash $hash): self + public function addHash(string $name, Hash $hash): static { $this->hashes[$name] = $hash; @@ -80,12 +76,10 @@ public function addHash(string $name, Hash $hash): self /** * Remove a hashing hash * - * @param string $name - * @return self * * @throws \Exception */ - public function removeHash(string $name): self + public function removeHash(string $name): static { if (! isset($this->hashes[$name])) { throw new \Exception("Hash '{$name}' not found"); @@ -103,8 +97,6 @@ public function removeHash(string $name): self /** * Get a specific hashing hash by name * - * @param string $name - * @return Hash * * @throws \Exception */ @@ -120,12 +112,10 @@ public function getHashByName(string $name): Hash /** * Set password generation length * - * @param int $length - * @return self * * @throws \Exception */ - public function setLength(int $length): self + public function setLength(int $length): static { if ($length < 8) { throw new \Exception('Password length must be at least 8 characters'); @@ -138,12 +128,10 @@ public function setLength(int $length): self /** * Set password generation charset * - * @param string $charset - * @return self * * @throws \Exception */ - public function setCharset(string $charset): self + public function setCharset(string $charset): static { if (strlen($charset) < 10) { throw new \Exception('Password charset must contain at least 10 characters'); @@ -175,9 +163,8 @@ public function generate(): string /** * Create a hash instance by type * - * @param string $type One of the supported hash types (ARGON2, BCRYPT, SCRYPT, SCRYPT_MODIFIED, SHA, MD5, PHPASS) - * @param array $options Optional parameters for hash configuration - * @return Hash + * @param string $type One of the supported hash types (ARGON2, BCRYPT, SCRYPT, SCRYPT_MODIFIED, SHA, MD5, PHPASS) + * @param array $options Optional parameters for hash configuration * * @throws \Exception */ diff --git a/src/Auth/Proofs/Phrase.php b/src/Auth/Proofs/Phrase.php index 3192365..d1c034d 100644 --- a/src/Auth/Proofs/Phrase.php +++ b/src/Auth/Proofs/Phrase.php @@ -22,8 +22,6 @@ public function __construct() /** * Generate a proof - * - * @return string */ public function generate(): string { diff --git a/src/Auth/Proofs/Token.php b/src/Auth/Proofs/Token.php index 4c00351..79980cc 100644 --- a/src/Auth/Proofs/Token.php +++ b/src/Auth/Proofs/Token.php @@ -6,14 +6,9 @@ class Token extends Proof { - /** - * @var int - */ protected int $length; /** - * @param int $length - * * @throws \Exception */ public function __construct(int $length = 256) @@ -40,8 +35,6 @@ public function generate(): string /** * Get the token length - * - * @return int */ public function getLength(): int { @@ -51,12 +44,10 @@ public function getLength(): int /** * Set the token length * - * @param int $length - * @return self * * @throws \Exception */ - public function setLength(int $length): self + public function setLength(int $length): static { if ($length <= 0) { throw new \Exception('Token length must be greater than 0'); diff --git a/src/Auth/Store.php b/src/Auth/Store.php index ccab76d..1db7848 100644 --- a/src/Auth/Store.php +++ b/src/Auth/Store.php @@ -9,17 +9,10 @@ class Store */ protected array $data = []; - /** - * @var string|null - */ protected ?string $key = null; /** * Get a property from the store - * - * @param string $key - * @param mixed $default - * @return mixed */ public function getProperty(string $key, mixed $default = null): mixed { @@ -28,12 +21,8 @@ public function getProperty(string $key, mixed $default = null): mixed /** * Set a property in the store - * - * @param string $key - * @param mixed $value - * @return self */ - public function setProperty(string $key, mixed $value): self + public function setProperty(string $key, mixed $value): static { $this->data[$key] = $value; @@ -42,8 +31,6 @@ public function setProperty(string $key, mixed $value): self /** * Get the store key - * - * @return string|null */ public function getKey(): ?string { @@ -52,11 +39,8 @@ public function getKey(): ?string /** * Set the store key - * - * @param string|null $key - * @return self */ - public function setKey(?string $key): self + public function setKey(?string $key): static { $this->key = $key; @@ -66,7 +50,6 @@ public function setKey(?string $key): self /** * Encode store data to base64 string * - * @return string * * @throws \JsonException */ @@ -79,11 +62,8 @@ public function encode(): string /** * Decode base64 string and populate current store instance - * - * @param string $data - * @return self */ - public function decode(string $data): self + public function decode(string $data): static { try { $decoded = base64_decode($data, true); @@ -97,7 +77,7 @@ public function decode(string $data): self $this->setProperty($key, $value); } } - } catch (\JsonException $e) { + } catch (\JsonException) { // Invalid JSON, return empty store } From ec153a664aef5cea1c09784f9f9afa94a4d41213 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 20 Oct 2025 22:56:00 +1300 Subject: [PATCH 05/12] Upgrade PHP --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5549234..5151fa0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN composer update \ --no-scripts \ --prefer-dist -FROM php:8.0-cli-alpine as compile +FROM php:8.4-cli-alpine as compile RUN apk add --no-cache \ git \ From 135284ae1118bd648970d49c85ea5f850ed0ce46 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 29 Oct 2025 05:59:23 +0000 Subject: [PATCH 06/12] Fix docker build --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5151fa0..6296b7a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,7 @@ WORKDIR /usr/src/code RUN docker-php-ext-install sodium # Copy and enable scrypt extension -COPY --from=scrypt /usr/local/lib/php/extensions/no-debug-non-zts-20200930/scrypt.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/ +COPY --from=scrypt /usr/local/lib/php/extensions/no-debug-non-zts-20240926/scrypt.so /usr/local/lib/php/extensions/no-debug-non-zts-20240926/ RUN docker-php-ext-enable scrypt # Configure PHP From ae726387b78ea5137920b5d858adeeb306e60610 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 29 Oct 2025 06:11:34 +0000 Subject: [PATCH 07/12] fix dockerfile casing --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6296b7a..c1f2557 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM composer:2.0 as composer +FROM composer:2.8 AS composer ARG TESTING=false ENV TESTING=$TESTING @@ -14,7 +14,7 @@ RUN composer update \ --no-scripts \ --prefer-dist -FROM php:8.4-cli-alpine as compile +FROM php:8.4-cli-alpine AS compile RUN apk add --no-cache \ git \ @@ -27,7 +27,7 @@ RUN apk add --no-cache \ FROM compile AS scrypt RUN pecl install scrypt -FROM compile as final +FROM compile AS final LABEL maintainer="team@appwrite.io" From 504c2b9bbc3b9cf430401f30148a8d77b8353243 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 29 Oct 2025 06:11:37 +0000 Subject: [PATCH 08/12] fix format --- tests/Auth/HashTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Auth/HashTest.php b/tests/Auth/HashTest.php index 84c6dfd..5351d8f 100644 --- a/tests/Auth/HashTest.php +++ b/tests/Auth/HashTest.php @@ -12,8 +12,7 @@ class HashTest extends TestCase protected function setUp(): void { // Create a concrete implementation of Hash for testing - $this->hash = new class extends Hash - { + $this->hash = new class () extends Hash { public function hash(string $value): string { return 'hashed_'.$value; From ec91631fd643d8b9f90276c1265248d6e734396b Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 29 Oct 2025 06:12:20 +0000 Subject: [PATCH 09/12] use specific version --- .github/workflows/code-ql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-ql-analysis.yml b/.github/workflows/code-ql-analysis.yml index 2d75229..4eaeb8a 100644 --- a/.github/workflows/code-ql-analysis.yml +++ b/.github/workflows/code-ql-analysis.yml @@ -16,5 +16,5 @@ jobs: - name: Run CodeQL run: | - docker run --rm -v $PWD:/app composer:2 sh -c \ + docker run --rm -v $PWD:/app composer:2.8 sh -c \ "composer install --profile --ignore-platform-reqs && composer check" \ No newline at end of file From f3c7e9ba9845612414fee19385e162214e384e32 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 29 Oct 2025 06:15:13 +0000 Subject: [PATCH 10/12] Fix path --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c1f2557..7ef7a3f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,8 @@ WORKDIR /usr/src/code RUN docker-php-ext-install sodium # Copy and enable scrypt extension -COPY --from=scrypt /usr/local/lib/php/extensions/no-debug-non-zts-20240926/scrypt.so /usr/local/lib/php/extensions/no-debug-non-zts-20240926/ +COPY --from=scrypt /usr/local/lib/php/extensions/no-debug-non-zts-20240926/scrypt.so /usr/local/lib/php/extensions/no-debug-non-zts-20240926/scrypt.so + RUN docker-php-ext-enable scrypt # Configure PHP From 66df814bb6d3797e790c626001716b3ede8da95f Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 29 Oct 2025 06:20:09 +0000 Subject: [PATCH 11/12] Fix php extension build id --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7ef7a3f..5f46d8e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,7 @@ WORKDIR /usr/src/code RUN docker-php-ext-install sodium # Copy and enable scrypt extension -COPY --from=scrypt /usr/local/lib/php/extensions/no-debug-non-zts-20240926/scrypt.so /usr/local/lib/php/extensions/no-debug-non-zts-20240926/scrypt.so +COPY --from=scrypt /usr/local/lib/php/extensions/no-debug-non-zts-20240924/scrypt.so /usr/local/lib/php/extensions/no-debug-non-zts-20240924/scrypt.so RUN docker-php-ext-enable scrypt From 61ade83cd65b5c1e07ec4c6daf392ce11ada7769 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 29 Oct 2025 06:38:24 +0000 Subject: [PATCH 12/12] fix use composer 2.6 --- .github/workflows/code-ql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-ql-analysis.yml b/.github/workflows/code-ql-analysis.yml index 4eaeb8a..55d230a 100644 --- a/.github/workflows/code-ql-analysis.yml +++ b/.github/workflows/code-ql-analysis.yml @@ -16,5 +16,5 @@ jobs: - name: Run CodeQL run: | - docker run --rm -v $PWD:/app composer:2.8 sh -c \ + docker run --rm -v $PWD:/app composer:2.6 sh -c \ "composer install --profile --ignore-platform-reqs && composer check" \ No newline at end of file