Skip to content

Commit c4d6da1

Browse files
authored
CoseSign*Tag and structure (#14)
* Add CoseEncrypt0Tag and CoseEncryptTag implementations with tests * Refactor protected header decoding in Cose tags and add tests for CoseSign1Tag * Enhance getProtectedHeaderAsMap method to accept a custom decoder in COSE tags and add tests for its functionality * Fix cache key generation in CI configuration to use composer.json instead of composer.lock
1 parent 8cc8742 commit c4d6da1

27 files changed

+2418
-42
lines changed

.ci-tools/phpstan-baseline.neon

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,66 @@ parameters:
264264
count: 1
265265
path: ../src/BigInteger.php
266266

267+
-
268+
rawMessage: Class "Cose\Encryption\CoseEncrypt0Tag" is not allowed to extend "CBOR\Tag".
269+
identifier: ergebnis.noExtends
270+
count: 1
271+
path: ../src/Encryption/CoseEncrypt0Tag.php
272+
273+
-
274+
rawMessage: 'Method Cose\Encryption\CoseEncrypt0Tag::__construct() has parameter $data with a nullable type declaration.'
275+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
276+
count: 1
277+
path: ../src/Encryption/CoseEncrypt0Tag.php
278+
279+
-
280+
rawMessage: 'Method Cose\Encryption\CoseEncrypt0Tag::createFromLoadedData() has parameter $data with a nullable type declaration.'
281+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
282+
count: 1
283+
path: ../src/Encryption/CoseEncrypt0Tag.php
284+
285+
-
286+
rawMessage: 'Method Cose\Encryption\CoseEncrypt0Tag::getProtectedHeaderAsMap() has parameter $decoder with a nullable type declaration.'
287+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
288+
count: 1
289+
path: ../src/Encryption/CoseEncrypt0Tag.php
290+
291+
-
292+
rawMessage: 'Method Cose\Encryption\CoseEncrypt0Tag::getProtectedHeaderAsMap() has parameter $decoder with null as default value.'
293+
identifier: ergebnis.noParameterWithNullDefaultValue
294+
count: 1
295+
path: ../src/Encryption/CoseEncrypt0Tag.php
296+
297+
-
298+
rawMessage: Class "Cose\Encryption\CoseEncryptTag" is not allowed to extend "CBOR\Tag".
299+
identifier: ergebnis.noExtends
300+
count: 1
301+
path: ../src/Encryption/CoseEncryptTag.php
302+
303+
-
304+
rawMessage: 'Method Cose\Encryption\CoseEncryptTag::__construct() has parameter $data with a nullable type declaration.'
305+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
306+
count: 1
307+
path: ../src/Encryption/CoseEncryptTag.php
308+
309+
-
310+
rawMessage: 'Method Cose\Encryption\CoseEncryptTag::createFromLoadedData() has parameter $data with a nullable type declaration.'
311+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
312+
count: 1
313+
path: ../src/Encryption/CoseEncryptTag.php
314+
315+
-
316+
rawMessage: 'Method Cose\Encryption\CoseEncryptTag::getProtectedHeaderAsMap() has parameter $decoder with a nullable type declaration.'
317+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
318+
count: 1
319+
path: ../src/Encryption/CoseEncryptTag.php
320+
321+
-
322+
rawMessage: 'Method Cose\Encryption\CoseEncryptTag::getProtectedHeaderAsMap() has parameter $decoder with null as default value.'
323+
identifier: ergebnis.noParameterWithNullDefaultValue
324+
count: 1
325+
path: ../src/Encryption/CoseEncryptTag.php
326+
267327
-
268328
rawMessage: Cannot cast mixed to string.
269329
identifier: cast.string
@@ -509,3 +569,123 @@ parameters:
509569
identifier: return.type
510570
count: 1
511571
path: ../src/Key/SymmetricKey.php
572+
573+
-
574+
rawMessage: Class "Cose\Mac\CoseMac0Tag" is not allowed to extend "CBOR\Tag".
575+
identifier: ergebnis.noExtends
576+
count: 1
577+
path: ../src/Mac/CoseMac0Tag.php
578+
579+
-
580+
rawMessage: 'Method Cose\Mac\CoseMac0Tag::__construct() has parameter $data with a nullable type declaration.'
581+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
582+
count: 1
583+
path: ../src/Mac/CoseMac0Tag.php
584+
585+
-
586+
rawMessage: 'Method Cose\Mac\CoseMac0Tag::createFromLoadedData() has parameter $data with a nullable type declaration.'
587+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
588+
count: 1
589+
path: ../src/Mac/CoseMac0Tag.php
590+
591+
-
592+
rawMessage: 'Method Cose\Mac\CoseMac0Tag::getProtectedHeaderAsMap() has parameter $decoder with a nullable type declaration.'
593+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
594+
count: 1
595+
path: ../src/Mac/CoseMac0Tag.php
596+
597+
-
598+
rawMessage: 'Method Cose\Mac\CoseMac0Tag::getProtectedHeaderAsMap() has parameter $decoder with null as default value.'
599+
identifier: ergebnis.noParameterWithNullDefaultValue
600+
count: 1
601+
path: ../src/Mac/CoseMac0Tag.php
602+
603+
-
604+
rawMessage: Class "Cose\Mac\CoseMacTag" is not allowed to extend "CBOR\Tag".
605+
identifier: ergebnis.noExtends
606+
count: 1
607+
path: ../src/Mac/CoseMacTag.php
608+
609+
-
610+
rawMessage: 'Method Cose\Mac\CoseMacTag::__construct() has parameter $data with a nullable type declaration.'
611+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
612+
count: 1
613+
path: ../src/Mac/CoseMacTag.php
614+
615+
-
616+
rawMessage: 'Method Cose\Mac\CoseMacTag::createFromLoadedData() has parameter $data with a nullable type declaration.'
617+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
618+
count: 1
619+
path: ../src/Mac/CoseMacTag.php
620+
621+
-
622+
rawMessage: 'Method Cose\Mac\CoseMacTag::getProtectedHeaderAsMap() has parameter $decoder with a nullable type declaration.'
623+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
624+
count: 1
625+
path: ../src/Mac/CoseMacTag.php
626+
627+
-
628+
rawMessage: 'Method Cose\Mac\CoseMacTag::getProtectedHeaderAsMap() has parameter $decoder with null as default value.'
629+
identifier: ergebnis.noParameterWithNullDefaultValue
630+
count: 1
631+
path: ../src/Mac/CoseMacTag.php
632+
633+
-
634+
rawMessage: Class "Cose\Signature\CoseSign1Tag" is not allowed to extend "CBOR\Tag".
635+
identifier: ergebnis.noExtends
636+
count: 1
637+
path: ../src/Signature/CoseSign1Tag.php
638+
639+
-
640+
rawMessage: 'Method Cose\Signature\CoseSign1Tag::__construct() has parameter $data with a nullable type declaration.'
641+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
642+
count: 1
643+
path: ../src/Signature/CoseSign1Tag.php
644+
645+
-
646+
rawMessage: 'Method Cose\Signature\CoseSign1Tag::createFromLoadedData() has parameter $data with a nullable type declaration.'
647+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
648+
count: 1
649+
path: ../src/Signature/CoseSign1Tag.php
650+
651+
-
652+
rawMessage: 'Method Cose\Signature\CoseSign1Tag::getProtectedHeaderAsMap() has parameter $decoder with a nullable type declaration.'
653+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
654+
count: 1
655+
path: ../src/Signature/CoseSign1Tag.php
656+
657+
-
658+
rawMessage: 'Method Cose\Signature\CoseSign1Tag::getProtectedHeaderAsMap() has parameter $decoder with null as default value.'
659+
identifier: ergebnis.noParameterWithNullDefaultValue
660+
count: 1
661+
path: ../src/Signature/CoseSign1Tag.php
662+
663+
-
664+
rawMessage: Class "Cose\Signature\CoseSignTag" is not allowed to extend "CBOR\Tag".
665+
identifier: ergebnis.noExtends
666+
count: 1
667+
path: ../src/Signature/CoseSignTag.php
668+
669+
-
670+
rawMessage: 'Method Cose\Signature\CoseSignTag::__construct() has parameter $data with a nullable type declaration.'
671+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
672+
count: 1
673+
path: ../src/Signature/CoseSignTag.php
674+
675+
-
676+
rawMessage: 'Method Cose\Signature\CoseSignTag::createFromLoadedData() has parameter $data with a nullable type declaration.'
677+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
678+
count: 1
679+
path: ../src/Signature/CoseSignTag.php
680+
681+
-
682+
rawMessage: 'Method Cose\Signature\CoseSignTag::getProtectedHeaderAsMap() has parameter $decoder with a nullable type declaration.'
683+
identifier: ergebnis.noParameterWithNullableTypeDeclaration
684+
count: 1
685+
path: ../src/Signature/CoseSignTag.php
686+
687+
-
688+
rawMessage: 'Method Cose\Signature\CoseSignTag::getProtectedHeaderAsMap() has parameter $decoder with null as default value.'
689+
identifier: ergebnis.noParameterWithNullDefaultValue
690+
count: 1
691+
path: ../src/Signature/CoseSignTag.php

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- uses: actions/[email protected]
4848

4949
- id: cache-key-generator
50-
run: echo "key=composer-${{ runner.os }}-${{ hashFiles('composer.lock') }}" >> $GITHUB_OUTPUT
50+
run: echo "key=composer-${{ runner.os }}-${{ hashFiles('composer.json') }}" >> $GITHUB_OUTPUT
5151

5252
- uses: actions/cache@v4
5353
with:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: 'Dependency Review'
2+
on: [pull_request]
3+
4+
permissions:
5+
contents: read
6+
7+
jobs:
8+
dependency-review:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: 'Checkout Repository'
12+
uses: actions/[email protected]
13+
- name: 'Dependency Review'
14+
uses: actions/dependency-review-action@v4
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: 'Lock Issues'
2+
3+
on:
4+
schedule:
5+
- cron: '12 6 * * *'
6+
7+
jobs:
8+
lock:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: dessant/lock-threads@v5
12+
with:
13+
github-token: ${{ github.token }}
14+
issue-inactive-days: '31'
15+
exclude-issue-created-before: ''
16+
exclude-any-issue-labels: ''
17+
add-issue-labels: ''
18+
issue-comment: >
19+
This thread has been automatically locked since there has not been
20+
any recent activity after it was closed. Please open a new issue for
21+
related bugs.
22+
issue-lock-reason: 'resolved'
23+
process-only: 'issues'

.github/workflows/release-on-milestone-closed.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2-
31
name: "Automatic Releases"
42

53
on:
@@ -14,7 +12,7 @@ jobs:
1412

1513
steps:
1614
- name: "Checkout"
17-
uses: "actions/checkout@v5"
15+
uses: "actions/checkout@v5.0.0"
1816

1917
- name: "Release"
2018
uses: "laminas/[email protected]"
@@ -35,7 +33,7 @@ jobs:
3533

3634
steps:
3735
- name: "Checkout"
38-
uses: "actions/checkout@v5"
36+
uses: "actions/checkout@v5.0.0"
3937

4038
- name: "Create Merge-Up Pull Request"
4139
uses: "laminas/[email protected]"
@@ -56,7 +54,7 @@ jobs:
5654

5755
steps:
5856
- name: "Checkout"
59-
uses: "actions/checkout@v5"
57+
uses: "actions/checkout@v5.0.0"
6058

6159
- name: "Create and/or Switch to new Release Branch"
6260
uses: "laminas/[email protected]"
@@ -77,7 +75,7 @@ jobs:
7775

7876
steps:
7977
- name: "Checkout"
80-
uses: "actions/checkout@v5"
78+
uses: "actions/checkout@v5.0.0"
8179
with:
8280
fetch-depth: 0
8381

@@ -100,7 +98,7 @@ jobs:
10098

10199
steps:
102100
- name: "Checkout"
103-
uses: "actions/checkout@v5"
101+
uses: "actions/checkout@v5.0.0"
104102

105103
- name: "Create new milestones"
106104
uses: "laminas/[email protected]"

.github/workflows/renovate.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Renovate
2+
on:
3+
schedule:
4+
# The "*" (#42, asterisk) character has special semantics in YAML, so this
5+
# string has to be quoted.
6+
- cron: '40 6 3 * *'
7+
jobs:
8+
renovate:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/[email protected]
13+
- name: Renovate Bot GitHub Action
14+
uses: renovatebot/[email protected]
15+
with:
16+
configurationFile: .github/renovate-global.json
17+
token: ${{ secrets.RENOVATE_TOKEN }}

.github/workflows/scorecards.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
name: Scorecards supply-chain security
22

33
on:
4-
# Only the default branch is supported.
5-
branch_protection_rule:
64
schedule:
7-
- cron: '19 5 * * 0'
5+
- cron: '34 4 * * 6'
86
push:
9-
branches: [ "4.3.x" ]
7+
branches:
8+
- "*.*.x"
109

1110
# Declare default permissions as read only.
1211
permissions: read-all
@@ -26,7 +25,7 @@ jobs:
2625

2726
steps:
2827
- name: "Checkout code"
29-
uses: actions/checkout@v5
28+
uses: actions/checkout@v5.0.0
3029
with:
3130
persist-credentials: false
3231

@@ -58,6 +57,6 @@ jobs:
5857

5958
# Upload the results to GitHub's code scanning dashboard.
6059
- name: "Upload to code-scanning"
61-
uses: github/codeql-action/upload-sarif@v4.31.2
60+
uses: github/codeql-action/upload-sarif@v4
6261
with:
6362
sarif_file: results.sarif

0 commit comments

Comments
 (0)