Phase 0: Fundament für Inhaus
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s

- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3)
- Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung
- Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü
- Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person
- Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“
- Benutzerverwaltung im Admin, Zugang vorläufig über is_admin
- vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/
- PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung
- VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-25 20:35:30 +00:00
parent 7197eaebf2
commit 9c0f8de791
15771 changed files with 1564103 additions and 5 deletions

View file

@ -0,0 +1,164 @@
<?php
declare(strict_types=1);
namespace Cose\Mac;
use CBOR\ByteStringObject;
use CBOR\CBORObject;
use CBOR\Decoder;
use CBOR\ListObject;
use CBOR\MapObject;
use CBOR\OtherObject\OtherObjectManager;
use CBOR\StringStream;
use CBOR\Tag;
use CBOR\Tag\CoseMac0Tag as UpstreamTag;
use CBOR\Tag\TagManager;
use const E_USER_DEPRECATED;
use InvalidArgumentException;
use function sprintf;
use function trigger_error;
/**
* A tagged COSE_Mac0 (RFC 9052, CBOR tag 17).
*
* @deprecated since 4.8.0, use \CBOR\Tag\CoseMac0Tag from spomky-labs/cbor-php 3.4.0 or later instead. Will be removed
* in 5.0.0.
*
* The six COSE structures were ported upstream in cbor-php 3.4.0, where they share AbstractCoseTag and are
* registered in the default decoder, so Decoder::create() resolves tag 17 on its own. The replacement accepts what
* this class rejects -- a zero-length protected header, a detached (nil) payload, the indefinite-length encodings --
* and reads every item through the list it carries, so its accessors cannot drift from the bytes it serializes.
*
* What does not move upstream is the RFC 9052 layer above the CBOR shape, and that stays here: {@see \Cose\Structure\CoseHeaders}
* for header labels typed as RFC 9052 section 1.5 defines them, and the Sig_structure, MAC_structure and
* Enc_structure builders that a signature or a MAC is actually computed over. Both work on the upstream classes.
*
* Migrating: the class name changes, and the four-argument create() becomes createFromComponents() -- upstream
* create() takes the whole list instead.
*
* @see https://github.com/web-auth/cose-lib/issues/176
* @see \Cose\Tests\Structure\DeprecatedTagClassesTest
*/
final class CoseMac0Tag extends Tag
{
/**
* A COSE header is a flat map of a handful of parameters whose values nest a couple of levels at most, so the
* decoder built when none is given is bounded far below the cbor-php default of 1000: a protected header crafted
* to nest thousands of levels is rejected instead of being walked.
*/
public const DEFAULT_PROTECTED_HEADER_MAX_DEPTH = 32;
private const TAG_ID = 17;
private readonly ByteStringObject $protectedHeader;
private readonly MapObject $unprotectedHeader;
private readonly ByteStringObject $payload;
private readonly ByteStringObject $tag;
public function __construct(int $additionalInformation, ?string $data, CBORObject $object)
{
trigger_error(sprintf(
'The class "%s" is deprecated since 4.8.0 and will be removed in 5.0.0. Use "%s" from spomky-labs/cbor-php 3.4.0 or later instead.',
self::class,
UpstreamTag::class
), E_USER_DEPRECATED);
if (! $object instanceof ListObject) {
throw new InvalidArgumentException('Not a valid CoseMac0 object. No list.');
}
if ($object->count() !== 4) {
throw new InvalidArgumentException('Not a valid CoseMac0 object. The list shall have 4 items.');
}
$protectedHeader = $object->get(0);
$unprotectedHeader = $object->get(1);
$payload = $object->get(2);
$tag = $object->get(3);
if (! $protectedHeader instanceof ByteStringObject) {
throw new InvalidArgumentException('Not a valid CoseMac0 object. The item 1 shall be a ByteString object.');
}
if (! $unprotectedHeader instanceof MapObject) {
throw new InvalidArgumentException('Not a valid CoseMac0 object. The item 2 shall be a Map object.');
}
if (! $payload instanceof ByteStringObject) {
throw new InvalidArgumentException('Not a valid CoseMac0 object. The item 3 shall be a ByteString object.');
}
if (! $tag instanceof ByteStringObject) {
throw new InvalidArgumentException('Not a valid CoseMac0 object. The item 4 shall be a ByteString object.');
}
parent::__construct($additionalInformation, $data, $object);
$this->protectedHeader = $protectedHeader;
$this->unprotectedHeader = $unprotectedHeader;
$this->payload = $payload;
$this->tag = $tag;
}
public static function getTagId(): int
{
return self::TAG_ID;
}
public static function createFromLoadedData(int $additionalInformation, ?string $data, CBORObject $object): self
{
return new self($additionalInformation, $data, $object);
}
public static function create(
MapObject $protectedHeader,
MapObject $unprotectedHeader,
ByteStringObject $payload,
ByteStringObject $tag
): self {
$protectedHeaderAsBytesString = ByteStringObject::create((string) $protectedHeader);
$object = ListObject::create([$protectedHeaderAsBytesString, $unprotectedHeader, $payload, $tag]);
[$additionalInformation, $data] = self::determineComponents(self::TAG_ID);
return new self($additionalInformation, $data, $object);
}
public function getProtectedHeader(): ByteStringObject
{
return $this->protectedHeader;
}
/**
* The nesting bound only applies to the decoder created here: a caller passing its own $decoder sets its own
* bound, and $maxDepth is then ignored.
*/
public function getProtectedHeaderAsMap(
?Decoder $decoder = null,
int $maxDepth = self::DEFAULT_PROTECTED_HEADER_MAX_DEPTH
): MapObject {
$stream = new StringStream($this->protectedHeader->getValue());
$decoder ??= Decoder::create(TagManager::create(), OtherObjectManager::create(), $maxDepth);
$decoded = $decoder->decode($stream);
if (! $decoded instanceof MapObject) {
throw new InvalidArgumentException('Protected header is not a valid Map object.');
}
return $decoded;
}
public function getUnprotectedHeader(): MapObject
{
return $this->unprotectedHeader;
}
public function getPayload(): ByteStringObject
{
return $this->payload;
}
public function getTag(): ByteStringObject
{
return $this->tag;
}
}

View file

@ -0,0 +1,183 @@
<?php
declare(strict_types=1);
namespace Cose\Mac;
use CBOR\ByteStringObject;
use CBOR\CBORObject;
use CBOR\Decoder;
use CBOR\ListObject;
use CBOR\MapObject;
use CBOR\OtherObject\OtherObjectManager;
use CBOR\StringStream;
use CBOR\Tag;
use CBOR\Tag\CoseMacTag as UpstreamTag;
use CBOR\Tag\TagManager;
use const E_USER_DEPRECATED;
use InvalidArgumentException;
use function sprintf;
use function trigger_error;
/**
* A tagged COSE_Mac (RFC 9052, CBOR tag 97).
*
* @deprecated since 4.8.0, use \CBOR\Tag\CoseMacTag from spomky-labs/cbor-php 3.4.0 or later instead. Will be removed
* in 5.0.0.
*
* The six COSE structures were ported upstream in cbor-php 3.4.0, where they share AbstractCoseTag and are
* registered in the default decoder, so Decoder::create() resolves tag 97 on its own. The replacement accepts what
* this class rejects -- a zero-length protected header, a detached (nil) payload, the indefinite-length encodings --
* and reads every item through the list it carries, so its accessors cannot drift from the bytes it serializes.
*
* What does not move upstream is the RFC 9052 layer above the CBOR shape, and that stays here: {@see \Cose\Structure\CoseHeaders}
* for header labels typed as RFC 9052 section 1.5 defines them, and the Sig_structure, MAC_structure and
* Enc_structure builders that a signature or a MAC is actually computed over. Both work on the upstream classes.
*
* Migrating: the class name changes, and the four-argument create() becomes createFromComponents() -- upstream
* create() takes the whole list instead.
*
* @see https://github.com/web-auth/cose-lib/issues/176
* @see \Cose\Tests\Structure\DeprecatedTagClassesTest
*/
final class CoseMacTag extends Tag
{
/**
* A COSE header is a flat map of a handful of parameters whose values nest a couple of levels at most, so the
* decoder built when none is given is bounded far below the cbor-php default of 1000: a protected header crafted
* to nest thousands of levels is rejected instead of being walked.
*/
public const DEFAULT_PROTECTED_HEADER_MAX_DEPTH = 32;
private const TAG_ID = 97;
private readonly ByteStringObject $protectedHeader;
private readonly MapObject $unprotectedHeader;
private readonly ByteStringObject $payload;
private readonly ByteStringObject $tag;
private readonly ListObject $recipients;
public function __construct(int $additionalInformation, ?string $data, CBORObject $object)
{
trigger_error(sprintf(
'The class "%s" is deprecated since 4.8.0 and will be removed in 5.0.0. Use "%s" from spomky-labs/cbor-php 3.4.0 or later instead.',
self::class,
UpstreamTag::class
), E_USER_DEPRECATED);
if (! $object instanceof ListObject) {
throw new InvalidArgumentException('Not a valid CoseMac object. No list.');
}
if ($object->count() !== 5) {
throw new InvalidArgumentException('Not a valid CoseMac object. The list shall have 5 items.');
}
$protectedHeader = $object->get(0);
$unprotectedHeader = $object->get(1);
$payload = $object->get(2);
$tag = $object->get(3);
$recipients = $object->get(4);
if (! $protectedHeader instanceof ByteStringObject) {
throw new InvalidArgumentException('Not a valid CoseMac object. The item 1 shall be a ByteString object.');
}
if (! $unprotectedHeader instanceof MapObject) {
throw new InvalidArgumentException('Not a valid CoseMac object. The item 2 shall be a Map object.');
}
if (! $payload instanceof ByteStringObject) {
throw new InvalidArgumentException('Not a valid CoseMac object. The item 3 shall be a ByteString object.');
}
if (! $tag instanceof ByteStringObject) {
throw new InvalidArgumentException('Not a valid CoseMac object. The item 4 shall be a ByteString object.');
}
if (! $recipients instanceof ListObject) {
throw new InvalidArgumentException('Not a valid CoseMac object. The item 5 shall be a List object.');
}
parent::__construct($additionalInformation, $data, $object);
$this->protectedHeader = $protectedHeader;
$this->unprotectedHeader = $unprotectedHeader;
$this->payload = $payload;
$this->tag = $tag;
$this->recipients = $recipients;
}
public static function getTagId(): int
{
return self::TAG_ID;
}
public static function createFromLoadedData(int $additionalInformation, ?string $data, CBORObject $object): self
{
return new self($additionalInformation, $data, $object);
}
public static function create(
MapObject $protectedHeader,
MapObject $unprotectedHeader,
ByteStringObject $payload,
ByteStringObject $tag,
ListObject $recipients
): self {
$protectedHeaderAsBytesString = ByteStringObject::create((string) $protectedHeader);
$object = ListObject::create([
$protectedHeaderAsBytesString,
$unprotectedHeader,
$payload,
$tag,
$recipients,
]);
[$additionalInformation, $data] = self::determineComponents(self::TAG_ID);
return new self($additionalInformation, $data, $object);
}
public function getProtectedHeader(): ByteStringObject
{
return $this->protectedHeader;
}
/**
* The nesting bound only applies to the decoder created here: a caller passing its own $decoder sets its own
* bound, and $maxDepth is then ignored.
*/
public function getProtectedHeaderAsMap(
?Decoder $decoder = null,
int $maxDepth = self::DEFAULT_PROTECTED_HEADER_MAX_DEPTH
): MapObject {
$stream = new StringStream($this->protectedHeader->getValue());
$decoder ??= Decoder::create(TagManager::create(), OtherObjectManager::create(), $maxDepth);
$decoded = $decoder->decode($stream);
if (! $decoded instanceof MapObject) {
throw new InvalidArgumentException('Protected header is not a valid Map object.');
}
return $decoded;
}
public function getUnprotectedHeader(): MapObject
{
return $this->unprotectedHeader;
}
public function getPayload(): ByteStringObject
{
return $this->payload;
}
public function getTag(): ByteStringObject
{
return $this->tag;
}
public function getRecipients(): ListObject
{
return $this->recipients;
}
}

View file

@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
namespace Cose\Mac;
use CBOR\ByteStringObject;
use CBOR\IndefiniteLengthByteStringObject;
use Cose\Structure\CoseStructure;
/**
* The MAC_structure of a COSE_Mac0 (RFC 9052 section 6.3).
*
* MAC_structure = [ "MAC0", protected : empty_or_serialized_map, external_aad : bstr, payload : bstr ]
*
* This is what the MAC algorithm authenticates. MACing the payload on its own instead binds the tag neither to the
* protected header -- the algorithm and the key identifier the sender chose -- nor to the message type, so a tag
* computed for a COSE_Mac0 would be accepted for a COSE_Mac and the reverse.
*
*
* The fields a decoded message supplies are typed to accept the indefinite-length byte strings the cbor-php
* accessors can hand back, and are kept exactly as they were given: a cryptographic structure has to embed the
* protected bucket byte for byte, or the signature the sender computed over it no longer verifies.
* @see https://www.rfc-editor.org/rfc/rfc9052#section-6.3
* @see \Cose\Tests\Structure\CoseStructureTest
*/
final class Mac0Structure extends CoseStructure
{
private readonly ByteStringObject $externalAad;
public function __construct(
private readonly ByteStringObject|IndefiniteLengthByteStringObject $protectedHeader,
private readonly ByteStringObject|IndefiniteLengthByteStringObject $payload,
?ByteStringObject $externalAad = null
) {
$this->externalAad = $externalAad ?? self::emptyExternalAad();
}
public static function create(
ByteStringObject|IndefiniteLengthByteStringObject $protectedHeader,
ByteStringObject|IndefiniteLengthByteStringObject $payload,
?ByteStringObject $externalAad = null
): self {
return new self($protectedHeader, $payload, $externalAad);
}
public function getProtectedHeader(): ByteStringObject|IndefiniteLengthByteStringObject
{
return $this->protectedHeader;
}
public function getPayload(): ByteStringObject|IndefiniteLengthByteStringObject
{
return $this->payload;
}
public function getExternalAad(): ByteStringObject
{
return $this->externalAad;
}
protected function context(): string
{
return 'MAC0';
}
protected function items(): array
{
return [$this->protectedHeader, $this->externalAad, $this->payload];
}
}

View file

@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
namespace Cose\Mac;
use CBOR\ByteStringObject;
use CBOR\IndefiniteLengthByteStringObject;
use Cose\Structure\CoseStructure;
/**
* The MAC_structure of a COSE_Mac (RFC 9052 section 6.3).
*
* MAC_structure = [ "MAC", protected : empty_or_serialized_map, external_aad : bstr, payload : bstr ]
*
* This is what the MAC algorithm authenticates, over the body protected header of the message. The context string
* is the only difference with {@see Mac0Structure}, and it is what keeps a tag computed for a multi-recipient
* COSE_Mac from being accepted on a COSE_Mac0 built over the same header and payload.
*
*
* The fields a decoded message supplies are typed to accept the indefinite-length byte strings the cbor-php
* accessors can hand back, and are kept exactly as they were given: a cryptographic structure has to embed the
* protected bucket byte for byte, or the signature the sender computed over it no longer verifies.
* @see https://www.rfc-editor.org/rfc/rfc9052#section-6.3
* @see \Cose\Tests\Structure\CoseStructureTest
*/
final class MacStructure extends CoseStructure
{
private readonly ByteStringObject $externalAad;
public function __construct(
private readonly ByteStringObject|IndefiniteLengthByteStringObject $protectedHeader,
private readonly ByteStringObject|IndefiniteLengthByteStringObject $payload,
?ByteStringObject $externalAad = null
) {
$this->externalAad = $externalAad ?? self::emptyExternalAad();
}
public static function create(
ByteStringObject|IndefiniteLengthByteStringObject $protectedHeader,
ByteStringObject|IndefiniteLengthByteStringObject $payload,
?ByteStringObject $externalAad = null
): self {
return new self($protectedHeader, $payload, $externalAad);
}
public function getProtectedHeader(): ByteStringObject|IndefiniteLengthByteStringObject
{
return $this->protectedHeader;
}
public function getPayload(): ByteStringObject|IndefiniteLengthByteStringObject
{
return $this->payload;
}
public function getExternalAad(): ByteStringObject
{
return $this->externalAad;
}
protected function context(): string
{
return 'MAC';
}
protected function items(): array
{
return [$this->protectedHeader, $this->externalAad, $this->payload];
}
}