Repository navigation
fix(deps): move from zod 3.25.76 to zod 4.6.7, out of GHSA-mrhx-c7xc-m3w5 #1798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
ca79408
fix(deps): move from zod 3.25.76 to zod 4.6.7, out of GHSA-mrhx-c7xc-…
coderdan cbb92c8
fix(deps): say the match schema fills in no defaults, and pin the CLI…
coderdan ec74797
fix(deps): import zod as a namespace so the bundled builds drop its l…
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| --- | ||
| "@cipherstash/stack": minor | ||
|
cipherstash-agent marked this conversation as resolved.
Resolved
|
||
| "stash": patch | ||
| "@cipherstash/wizard": patch | ||
| "@cipherstash/migrate": patch | ||
| --- | ||
|
|
||
| Move from zod 3.25.76 to zod 4.6.7, out of the range of GHSA-mrhx-c7xc-m3w5 (zod | ||
| before 4.6.6 can run out of memory validating a very large array). None of these | ||
| packages validates end-user input with zod, so none was exposed in practice. | ||
|
|
||
| The encryption config that `@cipherstash/stack` builds is unchanged: the same | ||
| schemas give the same output under zod 4 as under zod 3, including for index | ||
| options left out. | ||
|
|
||
| `@cipherstash/stack/schema` exports zod schemas (`encryptConfigSchema`, | ||
| `castAsEnum`, `eqlCastAsEnum`), and these are now zod 4 schemas. Calling | ||
| `.parse` or `.safeParse` on them works as before. Code that combines them with | ||
| its own zod 3 schemas, or reads zod 3 error fields such as `.errors`, needs zod 4. | ||
|
cipherstash-agent marked this conversation as resolved.
Resolved
|
||
| zod 4's type declarations need TypeScript 5.4 or later, unless the project sets | ||
| `skipLibCheck`. That applies to `@cipherstash/stack` and to the `Manifest` and | ||
| `ManifestColumn` types that `@cipherstash/migrate` exports. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
languages/typescript/packages/stack/__tests__/encrypt-config-schema.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { encryptConfigSchema } from '@/schema' | ||
|
|
||
| // The config `encryptConfigSchema.parse` returns is what protect-ffi indexes | ||
| // with, so its output is pinned here, field for field. An index option left | ||
| // out must stay out: protect-ffi applies its own default. zod 4 applies a | ||
| // `.default(x)` written inside `.optional()`, where zod 3 did not, so a | ||
| // default written that way would add fields to every config built before. | ||
| describe('encryptConfigSchema', () => { | ||
| const parse = (tables: unknown) => encryptConfigSchema.parse({ v: 2, tables }) | ||
|
|
||
| it('leaves out the match and unique options a column leaves out', () => { | ||
| expect( | ||
| parse({ | ||
| users: { | ||
| email: { cast_as: 'string', indexes: { match: {}, unique: {} } }, | ||
| name: { | ||
| cast_as: 'string', | ||
| indexes: { match: { tokenizer: { kind: 'standard' }, k: 8 } }, | ||
| }, | ||
| }, | ||
| }), | ||
| ).toStrictEqual({ | ||
| v: 2, | ||
| tables: { | ||
| users: { | ||
| email: { cast_as: 'string', indexes: { match: {}, unique: {} } }, | ||
| name: { | ||
| cast_as: 'string', | ||
| indexes: { match: { tokenizer: { kind: 'standard' }, k: 8 } }, | ||
| }, | ||
| }, | ||
| }, | ||
| }) | ||
| }) | ||
|
|
||
| it('keeps every option a column sets', () => { | ||
| const match = { | ||
| tokenizer: { kind: 'ngram', token_length: 3 }, | ||
| token_filters: [{ kind: 'downcase' }], | ||
| k: 6, | ||
| m: 2048, | ||
| include_original: true, | ||
| } | ||
| expect( | ||
| parse({ t: { c: { cast_as: 'string', indexes: { match } } } }), | ||
| ).toStrictEqual({ | ||
| v: 2, | ||
| tables: { t: { c: { cast_as: 'string', indexes: { match } } } }, | ||
| }) | ||
| }) | ||
|
|
||
| it('fills in a column cast_as and indexes, and a config with no tables', () => { | ||
| expect(parse({ t: { a: {}, b: undefined } })).toStrictEqual({ | ||
| v: 2, | ||
| tables: { | ||
| t: { | ||
| a: { cast_as: 'text', indexes: {} }, | ||
| b: { cast_as: 'text', indexes: {} }, | ||
| }, | ||
| }, | ||
| }) | ||
| expect(encryptConfigSchema.parse({ v: 2 })).toStrictEqual({ | ||
| v: 2, | ||
| tables: {}, | ||
| }) | ||
| }) | ||
|
|
||
| it('refuses a config that does not fit', () => { | ||
| for (const config of [ | ||
| {}, | ||
| { v: 'x' }, | ||
| { v: 2, tables: { t: { c: { cast_as: 'nope' } } } }, | ||
| { v: 2, tables: { t: { c: { indexes: { match: { k: 'x' } } } } } }, | ||
| { v: 2, tables: { t: { c: { indexes: { ste_vec: {} } } } } }, | ||
| ]) { | ||
| expect(encryptConfigSchema.safeParse(config).success).toBe(false) | ||
| } | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.