Skip to content

Event subscription template - alignment with OWASP and other linting rules#591

Open
rartych wants to merge 8 commits intocamaraproject:mainfrom
rartych:event-subscription-template-limits
Open

Event subscription template - alignment with OWASP and other linting rules#591
rartych wants to merge 8 commits intocamaraproject:mainfrom
rartych:event-subscription-template-limits

Conversation

@rartych
Copy link
Contributor

@rartych rartych commented Feb 27, 2026

What type of PR is this?

  • enhancement/feature

What this PR does / why we need it:

CAMARA_common.yaml includes schema definitions that raise linter errors when used in CAMARA API specifications.
New OWASP API linting rules will raise additional erros related to unrestricted string/integer properties.
This PR:

Which issue(s) this PR fixes:

Fixes #585

Does this PR introduce a breaking change?

  • Yes
  • No

Special notes for reviewers:

What is reasonable value for maximal number of subscriptions returned to API consumer for GET /subscriptions ?
Should we think about pagination?

The values for not used transports (like MQTT, Kafka) can be refined when we decide to implement them.
For now some values are proposed, so the template file conforms to linting rules.

Changelog input

Event subscription template  - aligned with OWASP and other linting rules

Additional documentation

https://github.com/camaraproject/Commonalities/blob/main/documentation/Linting-rules.md#5-owasp-api-security-top-10-2023-rules

Copy link
Contributor

@PedroDiez PedroDiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor editorial comments

LGTM

rartych and others added 2 commits March 2, 2026 17:47
Co-authored-by: Pedro Díez García <pedro.diezgarcia@telefonica.com>
@rartych rartych requested a review from PedroDiez March 2, 2026 16:52
PedroDiez
PedroDiez previously approved these changes Mar 2, 2026
Copy link
Contributor

@PedroDiez PedroDiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Kevsy
Kevsy previously approved these changes Mar 3, 2026
Copy link
Collaborator

@Kevsy Kevsy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

schema:
type: array
minItems: 0
maxItems: 1000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering: What is happening when this maxItems limit is reached? Is it recommended, that one API invoker starts using multiple client Ids, when more than 1000 subscriptions are used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is fair point. In fact it is the limitation in the response listing all subscriptions.
From security and efficiency perspective response pagination should be implemented.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rartych thanks for the clarification.

Pagination seems to be natively only supported in a later OpanAPI specification version.

Maybe the simplest is to add some text into the yaml file, that the API specification should provide support for pagination, when more subscriptions are expected than the max array limit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this section about pagination in CAMARA API design guide: https://github.com/camaraproject/Commonalities/blob/main/documentation/CAMARA-API-Design-Guide.md#41-pagination

We can add the pagination support in the template (page, perPage) and response headers and document that API initiatives can dismiss it based on their Use Cases. In that way, we ensure an homogeneous way for API initiatives that need/adopt it:

In GET /subscriptions:

REQUEST

...
 parameters:
        - $ref: "#/components/parameters/x-correlator"
        - $ref: "#/components/parameters/Page"
        - $ref: "#/components/parameters/PerPage"
...

parameters:
...
      name: page
      in: query
      description: Requested index to indicate the start of the resources/subscriptions to be provided in the response
      schema:
        type: integer
        default: 1
    PerPage:
      name: perPage
      in: query
      description: Requested number of resources/subscriptions to be provided in response
      schema:
        type: integer
        default: 10
...

RESPONSE:

      responses:
        "200":
          description: OK
          headers:
...
            Content-Last-Key:
              $ref: "#/components/headers/Content-Last-Key"
            X-Total-Count:
              $ref: "#/components/headers/X-Total-Count"
...

  headers:
...
    Content-Last-Key:
      description: Indicates the index of the last result provided in the response
      schema:
        type: integer
    X-Total-Count:
      description: Total number of items matching criteria
      schema:
        type: integer
...

Copy link
Contributor

@tlohmar tlohmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks generally good. Some questions.


UpdateReason:
type: string
maxLength: 512
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks redundant, as this is an enum type.


TerminationReason:
type: string
maxLength: 512
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here, redundant as an enum

@rartych rartych dismissed stale reviews from Kevsy and PedroDiez via 42ab0d0 March 3, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align event-subscription-template.yaml with OWASP requirements

4 participants