Skip to content

Commit 6604711

Browse files
committed
Validate certificate next certificate from chain
WE2-1174, Fixes #45 Signed-off-by: Raul Metsma <raul@metsma.ee>
1 parent e1d23eb commit 6604711

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

.github/workflows/coverity.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
1313
PROJECTNAME: 'web-eid/web-eid-authtoken-validation-php'
1414
steps:
15-
- uses: actions/checkout@v5
15+
- uses: actions/checkout@v6
1616
- name: Download Coverity Build Tool
1717
run: |
1818
curl --silent --data "token=$TOKEN&project=$PROJECTNAME" -o cov-analysis-linux64.tar.gz https://scan.coverity.com/download/linux64

.github/workflows/php.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v6
1919

2020
- uses: shivammathur/setup-php@v2
2121
with:
@@ -26,7 +26,7 @@ jobs:
2626

2727
- name: Cache Composer packages
2828
id: composer-cache
29-
uses: actions/cache@v4
29+
uses: actions/cache@v5
3030
with:
3131
path: vendor
3232
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}

src/certificate/CertificateValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static function validateIsValidAndSignedByTrustedCA(
7979

8080
if ($certificate->validateSignature()) {
8181
$chain = $certificate->getChain();
82-
$trustedCACert = end($chain);
82+
$trustedCACert = next($chain);
8383

8484
// Verify that the trusted CA cert is presently valid before returning the result.
8585
self::certificateIsValidOnDate($trustedCACert, $now, "Trusted CA");

tests/validator/certvalidators/SubjectCertificateNotRevokedValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static function setUpBeforeClass(): void
5656
protected function setUp(): void
5757
{
5858
AsnUtil::loadOIDs();
59-
$this->trustedValidator = new SubjectCertificateTrustedValidator(new TrustedCertificates([]), new Logger());
59+
$this->trustedValidator = new SubjectCertificateTrustedValidator(new TrustedCertificates([Certificates::getTestEsteid2018CAGov()]), new Logger());
6060
self::setSubjectCertificateIssuerCertificate($this->trustedValidator);
6161
$this->estEid2018Cert = Certificates::getJaakKristjanEsteid2018Cert();
6262
$this->configuration = new AuthTokenValidationConfiguration();

0 commit comments

Comments
 (0)