raystack / raystack/chronicle

feat: validate API auth type field with enum instead of bare string

Open Beginner friendly
#136 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2
Forks
1
Avg merge
12h 29m
Merged PRs (30d)
12

Description

Problem

In `src/types/config.ts`, the API auth schema uses a bare string for the `type` field:

```ts
const apiAuthSchema = z.object({
type: z.string(), // no validation
header: z.string(),
placeholder: z.string().optional(),
})
```

Typos like `apikey` instead of `apiKey`, or `bearer-token` instead of `bearer`, only fail at runtime when the playground tries to construct auth headers.

Suggested Fix

```ts
const apiAuthSchema = z.object({
type: z.enum(['apiKey', 'bearer', 'basic']),
header: z.string(),
placeholder: z.string().optional(),
})
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/types/config.ts and inspect apiAuthSchema, including how its type field is consumed. Done means the schema accepts apiKey, bearer, and basic while rejecting other values; check the surrounding configuration validation or existing schema tests if present.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, authentication
Issue type
Feature
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.