Skip to content

Conversation

@prdoyle
Copy link
Contributor

@prdoyle prdoyle commented Feb 3, 2025

Effect

  • Prevents foo from matching food despite being a prefix
  • Normalizes the paths coming from the entitlement policies to use platform-native separators

Backslash rationale

To the greatest extent possible, we want things to "just work" on Windows. Policy files should not fail to parse, or work incorrectly, due solely to the use of the forward slash as a file separator on Windows.

The simplest solution turned out to be to use toAbsolutePath() to turn all slashes into platform-default slashes. This behaviour isn't documented in toAbsolutePath()'s javadocs, but it's the behaviour I observed on Windows.

@prdoyle prdoyle added >non-issue :Core/Infra/Core Core issues without another label auto-backport Automatically create backport pull requests when merged test-entitlements v8.18.1 v8.19.0 v9.0.1 v9.1.0 labels Feb 3, 2025
@prdoyle prdoyle self-assigned this Feb 3, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Feb 3, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

A couple questions

@prdoyle prdoyle mentioned this pull request Feb 4, 2025
@prdoyle prdoyle enabled auto-merge (squash) February 4, 2025 21:34
Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM

@prdoyle prdoyle merged commit c1deef4 into elastic:main Feb 5, 2025
22 checks passed
@prdoyle prdoyle deleted the file-prefixes branch February 5, 2025 19:05
prdoyle added a commit to prdoyle/elasticsearch that referenced this pull request Feb 5, 2025
…ories (elastic#121598)

* Fix FileAccessTree for prefixes that aren't parents

* Support backslashes

* Whoops, nio

* Move normalization responsibility to FileEntitlement

* Normalize to native separators

* Avoid forbidden API
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.18
8.x
9.0

prdoyle added a commit to prdoyle/elasticsearch that referenced this pull request Feb 5, 2025
…ories (elastic#121598)

* Fix FileAccessTree for prefixes that aren't parents

* Support backslashes

* Whoops, nio

* Move normalization responsibility to FileEntitlement

* Normalize to native separators

* Avoid forbidden API
elasticsearchmachine pushed a commit that referenced this pull request Feb 5, 2025
…ories (#121598) (#121809)

* Fix FileAccessTree for prefixes that aren't parents

* Support backslashes

* Whoops, nio

* Move normalization responsibility to FileEntitlement

* Normalize to native separators

* Avoid forbidden API
elasticsearchmachine pushed a commit that referenced this pull request Feb 5, 2025
…ories (#121598) (#121808)

* Fix FileAccessTree for prefixes that aren't parents

* Support backslashes

* Whoops, nio

* Move normalization responsibility to FileEntitlement

* Normalize to native separators

* Avoid forbidden API
elasticsearchmachine pushed a commit that referenced this pull request Feb 5, 2025
…ories (#121598) (#121807)

* Fix FileAccessTree for prefixes that aren't parents

* Support backslashes

* Whoops, nio

* Move normalization responsibility to FileEntitlement

* Normalize to native separators

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

Labels

auto-backport Automatically create backport pull requests when merged :Core/Infra/Core Core issues without another label >non-issue Team:Core/Infra Meta label for core/infra team v8.18.1 v8.19.0 v9.0.1 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants