Add support for empty Security Requirement Object (`{}`) in security requirement
- Vorherrschende Sprache
- PHP
- Sterne
- 500
- Forks
- 99
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
From https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#security-requirement-object
An empty Security Requirement Object (`{}`) indicates anonymous access is supported.
This is used in https://raw.githubusercontent.com/cloudflare/api-schemas/refs/heads/main/openapi.yaml L164315

With current lib and above Cloudflare spec we get error:
```
There was 1 error:
1) IssueTest::test224FailsOnLargeDefinitions
Undefined offset: 0
/app/src/spec/SecurityRequirements.php:29
/app/src/SpecBaseObject.php:168
/app/src/SpecBaseObject.php:140
/app/src/SpecBaseObject.php:168
/app/src/SpecBaseObject.php:140
/app/src/spec/PathItem.php:81
/app/src/spec/Paths.php:62
/app/src/SpecBaseObject.php:168
/app/src/SpecBaseObject.php:140
/app/src/Reader.php:57
/app/src/Reader.php:138
/app/tests/IssueTest.php:17
phpvfscomposer:///app/vendor/phpunit/phpunit/phpunit:106
```
Observed this issue while fixing https://github.com/cebe/php-openapi/issues/224
So adding implementation for empty Security Requirement Object (`{}`) in security requirement is required.
More info about security schemes and security requirements can be obtained at https://swagger.io/docs/specification/v3_0/authentication/
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginnen Sie in spec/SecurityRequirements.php, wo der gemeldete Undefined offset auftritt, und überprüfen Sie tests/IssueTest.php, einschließlich test224FailsOnLargeDefinitions. Reproduzieren Sie den Cloudflare-OpenAPI-Fall und bestätigen Sie, dass ein leeres Security Requirement Object ohne den gemeldeten Fehler akzeptiert wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- php
- Bereich
- api, security
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 55/100