Skip to content

Conversation

@slobodanadamovic
Copy link
Contributor

@slobodanadamovic slobodanadamovic commented Mar 28, 2025

Adding basic validation to prevent using :: selectors when defining index permissions.
Index names do not allow colon character (:), hence the index name patterns that
would include double colon (::), would never match any of the index names.
To avoid confusion, we are preventing using :: in role index name patterns.

For example, the test-*::failures will be rejected during test-role validation:

PUT /_security/role/test-role
{
    "indices": [
        {
            "names": ["test-*::failures"],
            "privileges": ["read"]
        }
    ]
}

Adding basic validation to prevent using `::` selectors when defining
index permissions.

For example, the `test-*::failures` will not be allowed for `test-role`:

```
PUT /_security/role/test-role
{
    "indices": [
        {
            "names": ["test-*::failures"],
            "privileges": ["read"]
        }
    ]
}
```
@slobodanadamovic slobodanadamovic added >non-issue :Security/Security Security issues without another label Team:Security Meta label for security team auto-backport Automatically create backport pull requests when merged v8.19.0 v9.1.0 labels Mar 28, 2025
@slobodanadamovic slobodanadamovic self-assigned this Mar 28, 2025
}
if (DataStream.isFailureStoreFeatureFlagEnabled()) {
for (String indexName : ridp.indicesPrivileges().getIndices()) {
validationException = validateIndexNameExpression(indexName, validationException);
Copy link
Contributor Author

@slobodanadamovic slobodanadamovic Mar 28, 2025

Choose a reason for hiding this comment

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

We don't support failure store privileges yet for RCS2, but I think we should prevent using :: in remote index patterns as well - regardless of the privileges support.

@slobodanadamovic slobodanadamovic requested a review from n1v0lg March 28, 2025 15:52
@slobodanadamovic slobodanadamovic marked this pull request as ready for review March 28, 2025 15:53
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

Copy link
Contributor

@n1v0lg n1v0lg left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@slobodanadamovic slobodanadamovic merged commit 1f7e26c into elastic:main Mar 31, 2025
22 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
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 125843

@slobodanadamovic
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.x

Questions ?

Please refer to the Backport tool documentation

slobodanadamovic added a commit to slobodanadamovic/elasticsearch that referenced this pull request Mar 31, 2025
elastic#125843)

Adding basic validation to prevent using `::` selectors when defining index permissions.
Index names do not allow colon character (`:`), hence the index name patterns that
would include double colon (`::`), would never match any of the index names.
To avoid confusion, we are preventing using `::` in role index name patterns.

For example, the `test-*::failures` will be rejected during `test-role` validation:

```
PUT /_security/role/test-role
{
    "indices": [
        {
            "names": ["test-*::failures"],
            "privileges": ["read"]
        }
    ]
}
```

(cherry picked from commit 1f7e26c)
elasticsearchmachine pushed a commit that referenced this pull request Mar 31, 2025
#125843) (#125939)

Adding basic validation to prevent using `::` selectors when defining index permissions.
Index names do not allow colon character (`:`), hence the index name patterns that
would include double colon (`::`), would never match any of the index names.
To avoid confusion, we are preventing using `::` in role index name patterns.

For example, the `test-*::failures` will be rejected during `test-role` validation:

```
PUT /_security/role/test-role
{
    "indices": [
        {
            "names": ["test-*::failures"],
            "privileges": ["read"]
        }
    ]
}
```

(cherry picked from commit 1f7e26c)
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 >non-issue :Security/Security Security issues without another label Team:Security Meta label for security team v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants