
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
# Using npm
npm install h3-typebox
# Using yarn
yarn install h3-typebox
# Using pnpm
pnpm install h3-typebox
import { createServer } from 'http'
import { createApp } from 'h3'
import { validateBody, validateQuery, Type } from 'h3-typebox'
const app = createApp()
app.use('/', async (event) => {
// Validate body
const body = await validateBody(event, Type.Object({
optional: Type.Optional(Type.String()),
required: Type.Boolean(),
}))
// Validate query
const query = validateQuery(event, Type.Object({
required: Type.String(),
}))
})
createServer(app).listen(process.env.PORT || 3000)
See how to define your schema with Type on TypeBox documentation.
You can define a options object on validateBody or validateQuery. Currently the following options are supported:
includeAjvFormats: BooleanSome formats like date, date-time or email are specified in the current JSONSchema draft, but not included in ajv by default, but provided by the ajv-formats package. If one of these formats is needed, you can specify includeAjvFormats: true in the options of validateBody or validateQuery like this:
// Body
validateBody(event, schema, { includeAjvFormats: true })
// Query
validateQuery(event, schema, { includeAjvFormats: true })
Currently, only the following extended formats are supported for performance and security reasons:
These can be used by custom schemas with the Type.Unsafe method or with an inline schema:
const bodySchema = Type.Object({
optional: Type.Optional(Type.String()),
dateTime: Type.String({ format: 'date-time' })
})
validateBody(event, bodySchema, { includeAjvFormats: true })
pnpm installpnpm devMade with 💙
Published under MIT License.
FAQs
JSON schema validation for h3, using typebox & ajv
The npm package h3-typebox receives a total of 81 weekly downloads. As such, h3-typebox popularity was classified as not popular.
We found that h3-typebox demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.