Schema Validation Strategy for Aura Auth v1 #164
Pinned
halvaradop
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Aura Stack community,
Today, we want to discuss the future of schema validation support in Aura Auth and gather feedback from the community before the first major release. Aura Auth currently provides schema validation through the
identity.schemaoption in thecreateAuthfunction. This validation runs across internal authentication flows to ensure that identity data and JWT claims match the expected structure defined by the application. This adds an additional security layer by limiting the data managed by the application to only the fields explicitly allowed by the schema. It also helps mitigate scenarios where attackers attempt to inject unexpected or malicious claims into sessions or tokens.Currently, Aura Auth supports the following schema validation libraries:
These validators are used internally in endpoints and flows such as:
GET /sessionPATCH /sessionGET /callback/:oauthAt the moment, all supported schema validation libraries are installed directly by Aura Auth. The goal behind this decision was to provide a zero-configuration experience, allowing users to choose any supported validator without needing additional setup.
However, this approach also introduces several concerns:
In practice, it is uncommon for a single application to use multiple schema validation libraries simultaneously. For example, using both Zod and ArkType in the same project is relatively rare.
Because of this, including all validators by default conflicts with one of the core goals of Aura Stack: keeping packages lightweight, focused, and framework-agnostic.
For reference, the current dependencies can be seen here:
auth/packages/core/package.json
Lines 90 to 93 in 6781c7c
The idea currently being discussed internally is to reduce the default bundle size by selecting a single schema validation library as the default option and removing the others from the core package.
At the moment, our leading candidate is
TypeBoxorValibot, mainly because of its:However, before making a final decision, we want to hear feedback from the community.
The main question is:
What should Aura Auth provide by default?
Possible directions:
Please share your thoughts and explain the reasoning behind your preference.
Consider factors such as:
We would really appreciate feedback before finalizing the direction for v1.
Beta Was this translation helpful? Give feedback.
All reactions