Commit Graph

132 Commits

Author SHA1 Message Date
James Phillips 483898abe5 Renames "prepared_query" ACL policy to "query". 2016-02-24 17:02:06 -08:00
James Phillips 899dcfe053 Completes switch of prepared_query ACLs to govern query names. 2016-02-24 01:26:16 -08:00
James Phillips 67de77482e Creates new "prepared-query" ACL type and new token capture behavior.
Prior to this change, prepared queries had the following behavior for
ACLs, which will need to change to support templates:

1. A management token, or a token with read access to the service being
   queried needed to be provided in order to create a prepared query.

2. The token used to create the prepared query was stored with the query
   in the state store and used to execute the query.

3. A management token, or the token used to create the query needed to be
   supplied to perform and CRUD operations on an existing prepared query.

This was pretty subtle and complicated behavior, and won't work for
templates since the service name is computed at execution time. To solve
this, we introduce a new "prepared-query" ACL type, where the prefix
applies to the query name for static prepared query types and to the
prefix for template prepared query types.

With this change, the new behavior is:

1. A management token, or a token with "prepared-query" write access to
   the query name or (soon) the given template prefix is required to do
   any CRUD operations on a prepared query, or to list prepared queries
   (the list is filtered by this ACL).

2. You will no longer need a management token to list prepared queries,
   but you will only be able to see prepared queries that you have access
   to (you get an empty list instead of permission denied).

3. When listing or getting a query, because it was easy to capture
   management tokens given the past behavior, this will always blank out
   the "Token" field (replacing the contents as <hidden>) for all tokens
   unless a management token is supplied. Going forward, we should
   discourage people from binding tokens for execution unless strictly
   necessary.

4. No token will be captured by default when a prepared query is created.
   If the user wishes to supply an execution token then can pass it in via
   the "Token" field in the prepared query definition. Otherwise, this
   field will default to empty.

5. At execution time, we will use the captured token if it exists with the
   prepared query definition, otherwise we will use the token that's passed
   in with the request, just like we do for other RPCs (or you can use the
   agent's configured token for DNS).

6. Prepared queries with no name (accessible only by ID) will not require
   ACLs to create or modify (execution time will depend on the service ACL
   configuration). Our argument here is that these are designed to be
   ephemeral and the IDs are as good as an ACL. Management tokens will be
   able to list all of these.

These changes enable templates, but also enable delegation of authority to
manage the prepared query namespace.
2016-02-23 17:12:43 -08:00
James Phillips ce0881a99a Adds a new management ACL for prepared queries. 2015-11-15 17:06:00 -08:00
Dale Wijnand 5a28ebcaa3 Fix a bunch of typos. 2015-09-15 13:22:08 +01:00
Ryan Uber 58c26497a9 acl: adding negative tests for bad policy 2015-07-07 14:46:41 -06:00
Ryan Uber 02b49058a2 acl: more keyring tests 2015-07-07 11:21:27 -06:00
Ryan Uber 7e50a457d9 acl: allow omitting keyring policy, add tests 2015-07-07 11:07:37 -06:00
Ryan Uber 47a33e3f1a acl: keyring policy uses a flat string 2015-07-07 10:45:38 -06:00
Ryan Uber 1b8051a783 acl: initial pass at keyring ACLs 2015-07-06 18:28:09 -06:00
Ryan Uber 90f5eb8f69 acl: fix spelling in tests 2015-06-19 10:20:38 -07:00
Ryan Uber 0c624350eb acl: support for user events 2015-06-18 18:13:28 -07:00
Maciej Bryński 11425734d5 Consul prefix services ACLs 2015-05-05 08:25:19 +02:00
Veres Lajos 3b1068387a typofixes - https://github.com/vlajos/misspell_fixer 2014-12-04 23:25:06 +00:00
Armon Dadgar 8ff08819c8 acl: Expose service policy checks 2014-11-30 20:33:46 -07:00
Armon Dadgar 3695f65292 acl: Support for service policies 2014-11-30 20:18:16 -07:00
Armon Dadgar 05900f35c2 acl: Test parsing JSON 2014-08-18 15:46:59 -07:00
Armon Dadgar 34e018e471 acl: Updating for HCL changes 2014-08-18 15:46:58 -07:00
Armon Dadgar 9bababf872 acl: Avoid shared cache with different parents 2014-08-18 15:46:24 -07:00
Armon Dadgar 705c6cdb86 acl: Support checking write permissions on a prefix 2014-08-18 15:46:24 -07:00
Armon Dadgar 78580a733e acl: Avoid infinite recursion... 2014-08-18 15:46:23 -07:00
Armon Dadgar c2153843c6 acl: Support ACL checks, adding new root policy 2014-08-18 15:46:23 -07:00
Armon Dadgar 2fe94709e6 acl: Return the parent with GetACLPolicy 2014-08-18 15:46:23 -07:00
Armon Dadgar 5c0da3a4d7 acl: Simplify parent ACL, adding root policies 2014-08-18 15:46:23 -07:00
Armon Dadgar 468c8c3013 acl: Use only a single Radix tree per ACL 2014-08-18 15:46:22 -07:00
Armon Dadgar 3569082768 acl: Adding cache purging 2014-08-18 15:46:22 -07:00
Armon Dadgar ef77869983 acl: Adding additional tier of caching 2014-08-18 15:46:22 -07:00
Armon Dadgar 45f358e715 acl: Associate policy ID 2014-08-18 15:46:22 -07:00
Armon Dadgar 50ba1f6067 acl: Change types 2014-08-18 15:46:22 -07:00
Armon Dadgar 1abfd6c050 acl: Adding cached policy fetch via ACL 2014-08-18 15:46:21 -07:00
Armon Dadgar 6e9792dc37 acl: Adding caching mechanism 2014-08-18 15:46:21 -07:00
Armon Dadgar 7a1d778474 acl: First pass 2014-08-18 15:46:21 -07:00