cloudflare / cloudflare/chanfana

Security on nested routers

Open
#53 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
766
Forks
70
Avg merge
25m
Merged PRs (30d)
4

Description

Reading the Swagger [Bearer Authentication](https://swagger.io/docs/specification/authentication/bearer-authentication/) documentation, it is possible to add security globally, or on a specific route or routes *(**e.g.** in the `/private` routes in the below screenshot.)*

This doesn't appear to apply to a nested router such as the ***Secure*** section below. This nested router includes the `security` configuration as part of the `schema` but is seemingly ignored as no lock appears on the route, nor is `security` listed in the `openapi.json` for those routes *(unlike the `/private` routes.)*

Is *(the inability of)* applying security to all routes inside a nested router a limitation of `itty-router-openapi`, OpenAPI itself, or am I perhaps going about this the wrong way?

Repository: https://github.com/jasiqli/itty-openapi-security-test

![docs-page](https://github.com/cloudflare/itty-router-openapi/assets/107296949/1162cf8a-d1da-41b6-8771-b785995cc975)

Contributor guide

Open the contributing guide

Research direction

Start with the linked itty-openapi-security-test reproduction and inspect how the nested Secure router defines its schema and security configuration. Compare its generated openapi.json and Swagger display with the /private routes; done means determining whether nested-router security is supported and documenting or correcting the observed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.