Skip to content

fix: adding a check to prevent path collisions - #55328

Open
shawkins wants to merge 1 commit into
keycloak:mainfrom
shawkins:iss54684
Open

shawkins wants to merge 1 commit into
keycloak:mainfrom
shawkins:iss54684

Conversation

@shawkins

Copy link
Copy Markdown
Contributor

closes: #54684

@shawkins
shawkins marked this pull request as ready for review November 19, 2026 15:03
@shawkins
shawkins requested review from a team as code owners November 19, 2026 15:03
Copilot AI balanced review requested due to automatic review settings November 19, 2026 15:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The collision guard misses inherited allOf fields and indirect descendants, allowing conflicting properties to pass undetected.

2 open issues
What changed in this PR

Adds a safeguard during Admin API v2 OpenAPI processing to reject conflicting field names in polymorphic representations, addressing #54684.

Changes:

  • Validates duplicate properties across a parent and its directly listed subtypes, excluding the discriminator.
  • Adds tests for permitted fields and collisions between siblings or with the base type.
File Description
rest/​admin-v2/​services/​src/​test/​java/​org/​keycloak/​admin/​internal/​openapi/​OASModelFilterPolymorphismTest.java Adds focused polymorphic field-validation tests.
rest/​admin-v2/​services/​src/​main/​java/​org/​keycloak/​admin/​internal/​openapi/​OASModelFilter.java Adds conflicting-field validation to discriminator processing.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 19, 2026 15:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Inherited-property overwrites, inconsistent nested discriminator handling, and missed indirect descendants leave collision validation and discriminator propagation incorrect.

3 open issues
2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 19, 2026 17:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The uniqueness test misses lookup-only query paths such as auth.method, allowing ambiguous query resolution to go undetected.

1 open issue
3 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 19, 2026 17:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The uniqueness test checks only registered attribute keys, so it can miss collisions in representation properties and lookup-only subattribute paths.

2 open issues

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 19, 2026 18:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The uniqueness test uses an independent schema list, so newly registered protocols could bypass collision checks.

2 open issues
1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 19, 2026 19:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The test checks only protocol keys, so it can miss a protocol mapped to the wrong representation schema.

1 open issue
2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 19, 2026 21:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The test silently overwrites duplicate discriminator names, allowing a subtype without a distinct schema mapping to go undetected.

1 open issue
1 resolved since last review

Review effort: Balanced

closes: keycloak#54684

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Copilot AI balanced review requested due to automatic review settings November 20, 2026 01:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prohibit same field names in polymorphic representations

2 participants