Skip to content

fix: Encode user ids and names as single URL path segments in UIF - #909

Merged
siegfriedweber merged 11 commits into
mainfrom
fix/uif-url-path-segments
Nov 9, 2026
Merged

siegfriedweber merged 11 commits into
mainfrom
fix/uif-url-path-segments

Conversation

@lfrancke

@lfrancke lfrancke commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Description

Builds the user-info-fetcher's Keycloak and Entra URLs with UrlExt::join_safe from operator-rs instead of interpolating request input into them.

A user id or name is now encoded as exactly one URL path segment, and the Keycloak backend sends the username as a username query parameter rather than appending it to the URL as text. Previously alice&exact=false could switch off Keycloak's exact match, and ../.. could point the admin access token at a different endpoint. An id or name that cannot be a path segment (empty, ., .., or containing a line break) is rejected with 400; the same failure for an id that the identity provider itself returned is reported as 502, because it is a fault of the backend and not of the caller.

As a side effect this also fixes a configured Keycloak rootPath being dropped from every requested URL: endpoint_url() strips the trailing slash, and Url::join then treated the last path component as a file name and replaced it, so a Keycloak served below e.g. /auth was unreachable. join_safe only ever appends segments, so the base path survives.

Covered by unit tests per backend and by the keycloak-user-info integration test, which now serves Keycloak below /auth so that a dropped root path fails the suite.

Release Notes

Platform fixes

OPA operator

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • Helm chart can be installed and deployed operator works
  • Integration tests passed locally:
    PASS: kuttl/harness/workload-kind_opa-latest-1.20.2_openshift-false (59.80s)
    PASS: kuttl/harness/openldap-user-info_opa-latest-1.20.2_openshift-false (92.64s)
    PASS: kuttl/harness/logging_opa-1.20.2_openshift-false (94.76s)
    PASS: kuttl/harness/smoke_opa-1.20.2_openshift-false_use-tls-true (84.27s)
    PASS: kuttl/harness/resources_opa-latest-1.20.2_openshift-false (27.58s)
    PASS: kuttl/harness/data-hub-resource-info_opa-latest-1.20.2_trino-latest-483_kafka-latest-4.2.1_superset-latest-6.1.0_data-hub-1.0.3_data-hub-prerequisites-0.3.0_openshift-false (946.48s)
    PASS: kuttl/harness/aas-user-info_opa-latest-1.20.2_openshift-false (88.80s)
    PASS: kuttl/harness/cluster-operation_opa-latest-1.20.2_openshift-false (65.09s)
    PASS: kuttl/harness/config-overrides_opa-latest-1.20.2_openshift-false (71.91s)
    PASS: kuttl/harness/keycloak-user-info_opa-latest-1.20.2_keycloak-23.0.1_openshift-false (267.33s)
    
  • Changes need to be "offline" compatible
  • Release note snippet added in this description

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • (Integration-)Test cases added
  • Documentation added or updated. Follows the style guide.
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added
  • Links to generated (nightly) docs added
  • Release note snippet added
  • Add type/deprecation label & add to the deprecation schedule
  • Add type/experimental label & add to the experimental features tracker

The Keycloak and Entra backends joined request-supplied user ids and
names onto the base URL as text, so `/`, `?`, `#` and `..` in them
changed which URL was requested. Both now append them as one
percent-encoded path segment through `append_path_segments`, and the
Keycloak backend sends the username as a query parameter.

An empty, `.` or `..` segment and one containing a line break are
rejected with `400`, as the url crate would drop or strip them and look
up a different user.

A Keycloak `rootPath` without a trailing slash is now kept, which
`Url::join` dropped.
@lfrancke lfrancke self-assigned this Oct 22, 2026
@lfrancke lfrancke moved this to Development: Waiting for Review in Stackable Engineering Oct 22, 2026
@maltesander
maltesander self-requested a review October 29, 2026 13:32
@maltesander maltesander moved this from Development: Waiting for Review to Development: In Review in Stackable Engineering Oct 29, 2026
maltesander
maltesander previously approved these changes Oct 29, 2026

@maltesander maltesander left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, LGTM!

--- PASS: kuttl (159.52s)
    --- PASS: kuttl/harness (0.00s)
        --- PASS: kuttl/harness/keycloak-user-info_opa-latest-1.20.2_keycloak-23.0.1_openshift-false (159.51s)
PASS

@maltesander maltesander left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@siegfriedweber
siegfriedweber added this pull request to the merge queue Nov 9, 2026
@siegfriedweber siegfriedweber moved this from Development: In Review to Development: Done in Stackable Engineering Nov 9, 2026
Merged via the queue into main with commit bbf3751 Nov 9, 2026
13 checks passed
@siegfriedweber
siegfriedweber deleted the fix/uif-url-path-segments branch November 9, 2026 13:52
@siegfriedweber siegfriedweber added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Nov 9, 2026
@lfrancke lfrancke moved this from Development: Done to Done in Stackable Engineering Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/26.11.0 release-note Denotes a PR that will be considered when it comes time to generate release notes. scheduled-for/26.7.1

Projects

Development

Successfully merging this pull request may close these issues.

4 participants