diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0d76a2fa1..c0d6dfaf9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,24 +12,24 @@ jobs: fail-fast: false matrix: php: [8.1, 8.2, 8.3, 8.4] - os: [ubuntu-22.04] + os: [ubuntu-latest, windows-latest] stability: [prefer-lowest, prefer-stable] runs-on: ${{ matrix.os }} - name: PHP ${{ matrix.php }} - ${{ matrix.stability }} + name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - name: Checkout code uses: actions/checkout@v4 - with: + with: fetch-depth: 0 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: dom, curl, libxml, mbstring, zip + extensions: dom, curl, libxml, mbstring, sodium, zip coverage: pcov - name: Install dependencies diff --git a/src/CryptKey.php b/src/CryptKey.php index 3a3bdd9d4..135a2f7b9 100644 --- a/src/CryptKey.php +++ b/src/CryptKey.php @@ -72,7 +72,7 @@ public function __construct(string $keyPath, protected ?string $passPhrase = nul throw new LogicException('Invalid key supplied'); } - if ($keyPermissionsCheck === true) { + if ($keyPermissionsCheck === true && PHP_OS_FAMILY !== 'Windows') { // Verify the permissions of the key $keyPathPerms = decoct(fileperms($this->keyPath) & 0777); if (in_array($keyPathPerms, ['400', '440', '600', '640', '660'], true) === false) { diff --git a/tests/AuthorizationServerTest.php b/tests/AuthorizationServerTest.php index 6e41a17f3..f01c30638 100644 --- a/tests/AuthorizationServerTest.php +++ b/tests/AuthorizationServerTest.php @@ -50,6 +50,15 @@ public function setUp(): void chmod(__DIR__ . '/Stubs/private.key.crlf', 0600); } + public function testKeyPermissions(): void + { + $permission = PHP_OS_FAMILY === 'Windows' ? '666' : '600'; + + self::assertSame($permission, decoct(fileperms(__DIR__ . '/Stubs/private.key') & 0777)); + self::assertSame($permission, decoct(fileperms(__DIR__ . '/Stubs/public.key') & 0777)); + self::assertSame($permission, decoct(fileperms(__DIR__ . '/Stubs/private.key.crlf') & 0777)); + } + public function testGrantTypeGetsEnabled(): void { $server = new AuthorizationServer(