Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Application Privileges with support for Kibana RBAC #32309

Merged
merged 34 commits into from
Jul 24, 2018

Commits on Jun 7, 2018

  1. Introduce Application Privileges to Roles (#30164)

    This commit introduces "Application Privileges" (aka custom privileges) to the X-Pack security model.
    
    Application Privileges are managed within Elasticsearch, and can be tested with the _has_privileges API, but do not grant access to any actions or resources within Elasticsearch.
    Their purpose is to allow applications outside of Elasticsearch to represent and store their own privileges model within Elasticsearch roles.
    
    Specifically, this adds
    - GET/PUT/DELETE actions for defining application level privileges
    - application privileges in role definitions
    - application privileges in the has_privileges API
    tvernum authored Jun 7, 2018
    Configuration menu
    Copy the full SHA
    03e5e72 View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2018

  1. Configuration menu
    Copy the full SHA
    53961b0 View commit details
    Browse the repository at this point in the history

Commits on Jun 15, 2018

  1. Configuration menu
    Copy the full SHA
    4f33b36 View commit details
    Browse the repository at this point in the history

Commits on Jun 20, 2018

  1. Merge branch 'master' into security-app-privs

    # Conflicts:
    #	x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/action/user/TransportHasPrivilegesAction.java
    #	x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/user/TransportHasPrivilegesActionTests.java
    tvernum committed Jun 20, 2018
    Configuration menu
    Copy the full SHA
    baf9b47 View commit details
    Browse the repository at this point in the history

Commits on Jun 21, 2018

  1. Refactor Privileges API/Store to use separate class (#31191)

    The ApplicationPrivilege class had a dual purpose of defining
    application privileges as stored in the security index, and also being
    the means by which those privileges were tested against roles.
    This made the class difficult to work with - in particular validation
    was dependent on which purpose it was being used for.
    
    This commit splits the index storage part into a new
    ApplicationPrivilegeDescriptor class
    tvernum authored Jun 21, 2018
    Configuration menu
    Copy the full SHA
    ecea2e4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    acb0060 View commit details
    Browse the repository at this point in the history

Commits on Jun 25, 2018

  1. Merge branch 'master' into security-app-privs

    # Conflicts:
    #	x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/action/user/TransportHasPrivilegesAction.java
    tvernum committed Jun 25, 2018
    Configuration menu
    Copy the full SHA
    179615f View commit details
    Browse the repository at this point in the history

Commits on Jun 26, 2018

  1. Fix case sensitivity bug in application privileges (#31491)

    The was a spurious toLowerCase in the privilege check that was left
    over from a previous design approach
    tvernum authored Jun 26, 2018
    Configuration menu
    Copy the full SHA
    d509bd2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2c8f649 View commit details
    Browse the repository at this point in the history
  3. Allowing the kibana system role to get/put privileges (#31201)

    * Allowing the kibana system role to get/put privileges and roles
    
    * Removing the ability to get/put roles
    
    * Removing unnecessary white-space
    kobelb authored Jun 26, 2018
    Configuration menu
    Copy the full SHA
    5f36981 View commit details
    Browse the repository at this point in the history

Commits on Jun 28, 2018

  1. Configuration menu
    Copy the full SHA
    c3f7fcc View commit details
    Browse the repository at this point in the history

Commits on Jun 29, 2018

  1. Merge branch 'master' into security-app-privs

    # Conflicts:
    #	x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/AuthorizationServiceTests.java
    tvernum committed Jun 29, 2018
    Configuration menu
    Copy the full SHA
    985802a View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2018

  1. Configuration menu
    Copy the full SHA
    b8d7462 View commit details
    Browse the repository at this point in the history

Commits on Jul 3, 2018

  1. Configuration menu
    Copy the full SHA
    1746510 View commit details
    Browse the repository at this point in the history
  2. Serialize application privileges in PutRoleRequest (#31712)

    The serialization methods for `PutRoleRequest` did not handle the
    applicationPrivileges array.
    Fixes this and added tests
    tvernum authored Jul 3, 2018
    Configuration menu
    Copy the full SHA
    95948c7 View commit details
    Browse the repository at this point in the history

Commits on Jul 4, 2018

  1. Configuration menu
    Copy the full SHA
    9d61760 View commit details
    Browse the repository at this point in the history

Commits on Jul 5, 2018

  1. Support wider range of application names (#31752)

    This extends the validation for application names to allow an optional
    suffix of "-" (or "_") followed by any number of "filename safe
    characters" (excluding '*')
    
    The purpose of this is to support multiple kibana instances against a
    single ES cluster where the name of each kibana application is
    "kibana-${kibana-index}", assuming some reasonable limits on the
    Kibana index name.
    
    The change also retricts the wildcard handling of application names
    to only support a trailing wildcard: e.g `*`, `kibana-*`, etc.
    tvernum authored Jul 5, 2018
    Configuration menu
    Copy the full SHA
    4e1031b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    77e69a3 View commit details
    Browse the repository at this point in the history

Commits on Jul 6, 2018

  1. Configuration menu
    Copy the full SHA
    35c08f4 View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2018

  1. Merge branch 'master' into security-app-privs

    # Conflicts:
    #	x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/permission/Role.java
    #	x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authz/store/CompositeRolesStore.java
    tvernum committed Jul 12, 2018
    Configuration menu
    Copy the full SHA
    02bfc8d View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2018

  1. Configuration menu
    Copy the full SHA
    610e587 View commit details
    Browse the repository at this point in the history
  2. Extend ClusterPermission to consider requests (#31998)

    This lays the foundation for OLS on cluster privileges as it means
    that a cluster permission can be applied not just to actions, but also
    the objects being acted upon by the request.
    tvernum authored Jul 16, 2018
    Configuration menu
    Copy the full SHA
    0083161 View commit details
    Browse the repository at this point in the history
  3. Add test for merging roles (#32008)

    This commit adds a test for the most basic function of the `CompositeRolesStore` which
    is to merge 2 simple role descriptors into a single role. There were a lot of tests around
    FLS/DLS and custom roles providers, but nothing for the most simple case.
    tvernum authored Jul 16, 2018
    Configuration menu
    Copy the full SHA
    154eb1f View commit details
    Browse the repository at this point in the history

Commits on Jul 17, 2018

  1. Configuration menu
    Copy the full SHA
    7fa9f49 View commit details
    Browse the repository at this point in the history
  2. Introduce "ConditionalClusterPrivilege" (#32073)

    A conditional cluster privilege is like the existing cluster
    privilege, except that it has a Predicate over the request as
    well as over the action name.
    It is the "role descriptor" level representation for the newly
    introduced "ConditionalClusterPermission"
    
    This change adds the ConditionalClusterPrivilege interface, and
    allows them to be attached to RoleDescriptors, but does not provide
    any JSON/XContent support. This means that they cannot be used in the
    Roles API, nor are they stored in the security index, but they can be
    defined by custom Roles Providers and will be consulted as part of
    authorization decisions on Roles.
    tvernum authored Jul 17, 2018
    Configuration menu
    Copy the full SHA
    df1ca1f View commit details
    Browse the repository at this point in the history

Commits on Jul 19, 2018

  1. Configuration menu
    Copy the full SHA
    fd42a9b View commit details
    Browse the repository at this point in the history
  2. Add manage-application-privileges conditional cluster privilege (#32116)

    This includes support in the Roles API and for storing in the security
    index.
    
    Traditional, action-name cluster privileges are still described by a cluster: []
    element in the JSON, while conditional privileges are described in a policy: {}
    element (the name is subject to change).
    
    For the roles API, and builtin roles providers (native + file) the only supported
    conditional privilege is ManageApplicationPrivileges represented in JSON as:
    
    "application" : { "manage" : { "applications" : [ "my-app",  "app-*" ] } }
    
    which restricts the use of the Get/Put/Delete Privileges actions to those that act upon the specified application names ("my-app", "app-*")
    tvernum authored Jul 19, 2018
    Configuration menu
    Copy the full SHA
    69a42b3 View commit details
    Browse the repository at this point in the history

Commits on Jul 23, 2018

  1. kibana_system can only manage kibana privileges (#32221)

    The kibana_system role can only manage privileges for applications
    named "kibana-*".
    The default kibana instance will have an application name of
    "kibana-.kibana", and other instances will be named similarly but with
    the ".kibana" replaced by the name of their kibana index.
    tvernum authored Jul 23, 2018
    Configuration menu
    Copy the full SHA
    ef7961b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ab641d3 View commit details
    Browse the repository at this point in the history

Commits on Jul 24, 2018

  1. Configuration menu
    Copy the full SHA
    22c0eb4 View commit details
    Browse the repository at this point in the history
  2. Kibana reserved role app privs (#32137)

    * Changed kibaan_user and kibana_dashboard_only_user to use the app privs
    
    * Fixing ReservedRoleTests
    
    * Fixing some style issues with the tests
    
    * Adding the action to the patterns if there are no descriptors
    
    * KibanaUserRoleIntegTests now inherits from NativeRealmIntegTestCase
    
    This causes the test to properly close the security index in the @after
    to ensure we aren't leaving the .security index open
    
    * Switching the AuditTrailTests to use monitoring_user
    
    This way the test doesn't transiently load the .security index because
    it has application privileges and need to close the index when it's done
    
    * kibana_user can no longer create indexes, or index documents
    
    * Deleting unused imports
    
    * Assigning both index and application privileges
    
    * Fix line length
    
    * Fix bad merge
    
    * No longer adding privilege to actions when it has no actions
    
    * Putting test back how it was
    kobelb authored Jul 24, 2018
    Configuration menu
    Copy the full SHA
    1c1240d View commit details
    Browse the repository at this point in the history
  3. Require that all app privileges have actions (#32272)

    The javadoc and validation for ApplicationPrivileges supports the idea
    that a privilege could have no actions. However, in that case every
    privilege that had no actions grants every other action-less privilege
    within the same action, including the NONE privilege.
    
    This commit makes the following changes:
    - It is not possible to PUT a privilege without any actions
    - A permission with no actions, never grants another privilege even if
      that privilege is also a zero-action privilege (which, ideally would
      never exist, but can occur through missing privileges or index
      manipulation).
    tvernum authored Jul 24, 2018
    Configuration menu
    Copy the full SHA
    6087767 View commit details
    Browse the repository at this point in the history
  4. Support "source" parameter in _has_privileges (#32310)

    The rest tests require that any request that supports GET with body
    must also support GET with source="..."
    
    This changes the _has_privileges rest action to support the source
    parameter as an alternative to reading a body
    tvernum authored Jul 24, 2018
    Configuration menu
    Copy the full SHA
    32e4f62 View commit details
    Browse the repository at this point in the history
  5. Rename "policy" to "global" in role definition (#32324)

    The "global" field stores cluster privileges that have a richer
    privilege model than the traditional "cluster" privileges.
    
    This commit renames the JSON field (in the API and security index)
    from "policy" to "global"
    tvernum authored Jul 24, 2018
    Configuration menu
    Copy the full SHA
    8b14e2c View commit details
    Browse the repository at this point in the history