Repository navigation
Commit b2be4d2
authored
fix: generated create routes drop server-owned input across ports (1.2.x security) (#568)
* fix: generated create routes store only client-settable fields (1.2.x security)
Python 1.2.1 stopped its generated routes from handing raw request input to
the repository. The same audit found related create-path holes in 1.2.0 in
the other four ports; this closes each in its own idiom. Server-owned values
are dropped silently, never answered with 400.
- Java (codegen-spring): create strips a generated id, readOnly and derived
fields; a TPH per-subtype create also strips the body discriminator and
sibling-subtype fields.
- Kotlin (codegen-kotlin): create skips readOnly/derived columns; a TPH
per-subtype create writes only the route subtype's own columns.
- C# (MetaObjects.Codegen): every readOnly property shape gets a private
setter; create resets a generated id, the TPH discriminator and M:N
navigations before Add.
- TypeScript (codegen-ts): the update schema omits primary-key fields, so
PUT/PATCH can no longer re-key a row with an assigned key.
Proof: new shared api-contract scenarios (core + TPH input-server-owned,
TPH foreign discriminator) and a readOnly `role` field in secret-fields, run
in every port's generated lane and the reference lanes; a new `unset`
assertion key in all five harnesses. In-memory test repositories now store
what they are handed, so the scenarios fail on the 1.2.0 generators.
Proposed versions (not published): npm 1.2.2, NuGet 1.2.2, Maven 8.2.2;
PyPI unchanged at 1.2.1. metamodelVersion unchanged.
* fix: keep a @required readOnly field creatable in C# and Java generated create
Pre-gate review follow-ups to the 1.2.x create-input patch:
- C#: the required-key check skips readOnly fields (the private setter
never binds them), and create validation ignores a violation naming
only a @required readOnly member, as Java's SERVER_OWNED_ON_CREATE does.
- Java: the create-validation server-owned set covers every DTO component,
so a nulled readOnly or derived value-object column no longer 400s.
- TypeScript: drop the now-dead PK guard in the update-schema nullable arm
and list the PK rule in updateSchemaFields' doc comment.
* no-mistakes(review): apply reviewer inline fixes
* no-mistakes(review): Kotlin readOnly create fix + C# reset skip
* no-mistakes(document): docs: finish stale corpus counts from input fix1 parent 783ac21 commit b2be4d2
92 files changed
Lines changed: 1359 additions & 222 deletions
File tree
- client/web/packages
- react
- runtime-web
- tanstack
- docs
- features
- llms
- examples
- advanced-modeling/codegen/templates
- showcase
- .metaobjects/.gen-state
- codegen/templates
- generated/csharp
- jvm
- fixtures/api-contract-conformance
- scenarios
- secret-fields
- scenarios
- tph
- scenarios
- server
- csharp
- MetaObjects.Codegen.Tests
- MetaObjects.Codegen/Generators
- MetaObjects.IntegrationTests/Api
- java
- codegen-base
- codegen-kotlin-exposed1x-check
- codegen-kotlin
- src
- main/kotlin/com/metaobjects/generator/kotlin
- test
- kotlin/com/metaobjects/generator/kotlin
- resources/snapshots/entity-with-tph/acme/auth
- codegen-mustache
- codegen-plantuml
- codegen-spring
- src
- main/java/com/metaobjects/generator/spring
- test/java/com/metaobjects/generator/spring
- core-spring
- integration-tests-kotlin
- src/test/kotlin/com/metaobjects/integration/kotlin/api
- generated
- secretfields/generated
- tph/generated
- integration-tests
- src/test/java/com/metaobjects/integration/api
- generated
- tph/generated
- maven-plugin
- metadata-ktx
- metadata
- omdb-ktx
- omdb
- om
- render
- spring-boot-starter
- python
- src/metaobjects/codegen
- tests/integration
- typescript/packages
- ai-runtime
- cli
- codegen-ts-react
- codegen-ts-tanstack
- codegen-ts
- src/templates
- test
- __snapshots__
- templates
- docs-site
- integration-tests/src
- metadata
- migrate-ts
- render
- runtime-ts
- sdk
- test-generators/src/templates
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
13 | 59 | | |
14 | 60 | | |
15 | 61 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | | - | |
| 369 | + | |
370 | 370 | | |
371 | | - | |
| 371 | + | |
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
381 | | - | |
382 | | - | |
| 381 | + | |
| 382 | + | |
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
614 | | - | |
| 614 | + | |
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
69 | 84 | | |
70 | 85 | | |
71 | 86 | | |
| |||
0 commit comments