Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/buy-the-validators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'fiber': patch
---

Validate request bodies with Ajv, and read credential paths with real JSONPath.

Body linting was a hand-written walker over "a deliberately useful subset" of JSON Schema, and the subset was the problem: no `$ref`, no `minimum`, `pattern`, `uniqueItems`, `minLength`, `patternProperties`, `if`/`then` or `dependentSchemas`. All of those passed silently, so a body could be reported clean and still be rejected by the API that published the schema. Ajv is the reference implementation of what that walker was approximating.

What stays hand-written is the part that isn't JSON Schema: OpenAPI 3.0's `nullable`, folded into a union type, and `type` values that don't exist. One real 3.1 document arrives with `"type": "undefined"` 310 times alongside `emoji`, `icon`, `void` and `http` — Ajv rejects those at compile time, which would cost that schema all of its linting rather than one field's, so the invented names are dropped and every valid constraint beside them keeps working. Messages are unchanged, including the "must be number, not string" phrasing Ajv leaves out.

Credential paths now go through `serde_json_path`, so a capture rule can use `$..id_token` to find a token whose nesting depth you don't know, or `$.keys[?(@.active == true)].secret` to pick the entry that is current rather than pinning an index that moves. The dotted form every saved rule already uses keeps working: it isn't valid JSONPath — `$.data.tokens.0.value` needs `[0]` under RFC 9535 — so the query is tried first and the original walk answers for anything it rejects. A query matching several nodes reports nothing rather than picking arbitrarily.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ jobs:
- uses: actions/setup-node@v5
with:
node-version-file: .nvmrc
# This job reads the lockfile and never installs, so there is no store
# to cache. Left on, setup-node infers pnpm from `packageManager` and
# enables caching anyway: a cache *hit* restores and skips the save, so
# this passed for as long as the key kept hitting — and the first
# lockfile change missed, tried to save a store that was never created,
# and failed the job on a post-step while both audits had passed.
# release.yml's draft job turns it off for the same reason.
package-manager-cache: false

# --prod: a vulnerable dev tool can't reach a user's machine. High and
# above, because failing CI over every low advisory teaches people to
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"@tauri-apps/plugin-opener": "2.5.4",
"@tauri-apps/plugin-process": "2.3.1",
"@tauri-apps/plugin-updater": "2.10.1",
"ajv": "^8.20.0",
"bits-ui": "^2.19.0",
"codemirror": "^6.0.2",
"paneforge": "^1.0.2"
Expand Down
34 changes: 34 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 76 additions & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ rmcp = { version = "3.1.4", features = ["server", "macros", "transport-io", "sch
dirs = "6.0.0"
schemars = "1.2.2"
serde_norway = "0.9.42"
serde_json_path = "0.7.2"

# Asking whether a keychain item exists, without reading it. keyring has no such
# call — its `has` fetches the password — and on macOS that difference is a
Expand Down
Loading
Loading