Skip to content

Conversation

@mosche
Copy link
Contributor

@mosche mosche commented Feb 13, 2025

Instrument nio Path toRealPath and register.

Some other methods may throw SecurityExceptions, though they are not relevant in our context:

  • Path.of / Paths.get, same as FileSystemProvider#getPath... no need to protect
  • #toAbsolutePath, we grant read access to sys properties (user.dir) anyways, no need to protect in that case
  • #toUri, same as #toAbsolutePath

Relates to ES-10794

@mosche mosche added :Core/Infra/Core Core issues without another label auto-backport Automatically create backport pull requests when merged v9.0.0 v8.18.0 test-entitlements v8.19.0 v9.1.0 labels Feb 13, 2025
@mosche mosche requested a review from a team February 13, 2025 14:17
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

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

class PathActions {

@EntitlementTest(expectedAccess = PLUGINS)
static void checkToRealPath() throws IOException {
Copy link
Member

Choose a reason for hiding this comment

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

nit: we haven't been consistent, but in other files we've named this as classMethodName, no "check"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're fairly inconsistent, see NioFileSystemActions

Copy link
Contributor

Choose a reason for hiding this comment

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

I've auto-generated most of the names in my tests, so I don't mess them up, like this. Not pretty, especially when suffixes are needed for overloads. 🤷

@rjernst rjernst self-assigned this Feb 14, 2025
@mosche mosche marked this pull request as ready for review February 14, 2025 15:28
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Feb 14, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@mosche
Copy link
Contributor Author

mosche commented Feb 14, 2025

I've updated to PR to check links using readSymbolicLink as discussed @rjernst, though fixing tests this requires relative path support for file permissions

@mosche mosche merged commit 7fd1add into elastic:main Feb 17, 2025
22 checks passed
@mosche mosche deleted the entitlements/nio-path branch February 17, 2025 13:02
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
9.0
8.18 Commit could not be cherrypicked due to conflicts
8.x Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 122507

mosche added a commit to mosche/elasticsearch that referenced this pull request Feb 17, 2025
mosche added a commit to mosche/elasticsearch that referenced this pull request Feb 17, 2025
(cherry picked from commit 7fd1add)

# Conflicts:
#	libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java
@mosche
Copy link
Contributor Author

mosche commented Feb 17, 2025

💚 All backports created successfully

Status Branch Result
8.x
8.18

Questions ?

Please refer to the Backport tool documentation

mosche added a commit to mosche/elasticsearch that referenced this pull request Feb 17, 2025
(cherry picked from commit 7fd1add)

# Conflicts:
#	libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java
elasticsearchmachine pushed a commit that referenced this pull request Feb 17, 2025
(cherry picked from commit 7fd1add)

# Conflicts:
#	libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java
elasticsearchmachine pushed a commit that referenced this pull request Feb 18, 2025
(cherry picked from commit 7fd1add)

# Conflicts:
#	libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/api/ElasticsearchEntitlementChecker.java
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 >refactoring Team:Core/Infra Meta label for core/infra team v8.18.0 v8.19.0 v9.0.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants