Skip to content

Point in time security model #2087

@bharath-techie

Description

@bharath-techie

Point in time security model

Context:

What is point in time ?

User can create a Point In Time for a set of indices. A Point In Time is a set of segments which are frozen in time taken at the moment of creation. We lock the segments of those indices’ shards and create contexts to access and query only those shards.

Such point in time contexts can be reused across multiple search queries and the data that is searched upon will be on the locked segments. This solution is used with search after for pagination with data consistency.

This can be related to ‘scroll’ , whereas ‘scroll’ context gets created for each query ( cannot be reused for different search queries ) and ‘scroll’ can only move forward.
Design doc : opensearch-project/OpenSearch#3960
Meta issue: opensearch-project/OpenSearch#3959

Point in time APIs

  • Create point in time
    • The request implements ‘IndicesRequest.Replaceable“
    • action - “indices:data/read/point_in_time/create”
    • User can create point in time on any index for which the user has access to ( similar to search )
  • Delete point in time
    • User can pass list of PITs to delete (or) user can choose to delete all PITs
    • action - “indices:data/read/point_in_time/delete”
  • List all PITs
    • This API lists all PITs that the user has access to
    • Rest user facing action to list PITs- “indices:data/read/point_in_time/readall”
    • Action to retreive all cluster PITs - “cluster:admin/point_in_time/readall”
  • Point in time segments API
    • This shows the resource utilization of segments held because of a point in time context.
    • User can pass list of PITs to show segments info (or) user can choose to show all PIT segments info
    • Action - "indices:monitor/segments/point_in_time"

Permission model

Action group:

manage_point_in_time:
  reserved: true
  hidden: false
  static: true
  allowed_actions:
    - "indices:data/read/point_in_time/create"
    - "indices:data/read/point_in_time/delete"
    - "indices:data/read/point_in_time/readall"
    - "cluster:admin/point_in_time/readall"
    - "indices:monitor/point_in_time/segments"
  type: "index"
  description: "Manage point in time actions"

Role which has access to all PIT actions :

point_in_time_1:
  reserved: true
  hidden: false
  description: "Migrated from v6 (all types mapped)"
  cluster_permissions:
    - "cluster:admin/point_in_time/read_from_nodes"
  index_permissions:
    - index_patterns:
        - "pit_1"
      dls: null
      fls: null
      masked_fields: null
      allowed_actions:
        - "manage_point_in_time"

Requirement

  • By design, the user is able to ‘create pit’ on any index and ‘search’ using the same PIT if the underlying index permissions are present
  • So the user should be able to delete or list the PITs which they were able to create ( as long as the underlying index permission is present )
  • User should not be restricted to these APIs (delete, list or segments ) if they don’t have all indices read permission

In order to meet the above requirements, we are making changes in security plugin to evaluate permissions of PITs.

Following two items need review:

  1. Proposed security model
  2. List all PITs design

1. Proposed security model

We need to handle two cases for the APIs

  • Access for explicit PITs ( LIST request )
  • Access for ‘all’ type PIT operations
    • Access when no PITs are present in cluster

When is a PIT permitted ?

A PIT is made of one ore many indices. If the user has access to all the indices of a PIT, then PIT is permitted.
This is common for all APIs.

What if user does not have action permissions ?

Operation is denied.

a. Access for explicit PITs
  • All PITs in the request must be permitted, then we allow the operation ( ALLOW )
  • Even if one PIT is not permitted, we deny the operation ( DENY )
  • This is similar to search and other indices APIs ( user must have access to all explicit indices given as part of search request )
b. Access for operation with ‘all’ or ‘ * ’ PITs
  • Out of all PITs in cluster , if any PIT is permitted , then operation will carry forward ( ALLOW )
  • If there are no permitted PITs, throw forbidden error ( DENY )
  • This is inline with search API
No PITs in cluster
  • General case, Deny operation. Throw 403 - forbidden error ( DENY )
  • Special case - Similar to other indices operation, if the config property - do_not_fail_on_forbidden_empty is true - then allow operation ( ALLOW )
@Override
    public boolean isDnfofForEmptyResultsEnabled() {
        return config.dynamic.do_not_fail_on_forbidden_empty;
    }

2. List all PITs Design

Context

There are two options currently at discussion

Option 1 : New action filter for PITs in security plugin

We will introduce a new action filter which will be called by security filter for PIT requests to wrap the listener to call the PIT privilege evaluator to get the permitted PITs.
Check this thread : opensearch-project/OpenSearch#4388 (comment)

filter pit

Pros :
No extra action / permission required

Cons :
Maintainability of additional filter code in security plugin

Option 2 : Dummy action to filter PITs

Dummy action in opensearch to filter PITs

dummy action 1

Pros :
Simple solution, doesn't add any code to security plugin and it is already tested in the current PR

Cons :

  • Extra dummy action is used for nothing other than filtering when security plugin is enabled. No business logic is present.
  • Extra action permission required for user

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestsprint backlogtriagedIssues labeled as 'Triaged' have been reviewed and are deemed actionable.v2.4.0'Issues and PRs related to version v2.4.0'

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions