Skip to content

Use Zod at config boundaries and audit validation #28

Description

@khodam666

Context

The OpenKhodam config store currently normalizes parsed JSON manually. That is fine for PR #26, but as config grows we should use schema validation where it matters instead of spreading ad-hoc shape checks.

Goal

Adopt Zod at important input/config boundaries and sweep the codebase for places where schema validation would simplify or harden parsing/defaulting.

Suggested scope

  • Start with persisted local config, especially openkhodam-config.json.
  • Define schemas for config shape, defaults, and safe partial/corrupt config handling.
  • Keep filesystem mechanics separate: atomic writes, file permissions, and ENOENT defaults should remain explicit.
  • Sweep renderer/main/preload boundaries for manually validated unknown data that would benefit from Zod.
  • Avoid converting simple trusted internal types just for the sake of using Zod.

Acceptance criteria

  • Clear recommendation for where Zod should and should not be used.
  • At least the persisted OpenKhodam config path has a concrete migration plan or implementation.
  • Manual normalization utilities are simplified where schema validation gives better safety/readability.
  • No renderer access to sensitive token fields is introduced.

Notes

This is intentionally follow-up work; PR #26 can keep the current explicit config store implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions