Commit Graph
2134 Commits
Author SHA1 Message Date
Johan Brandhorst-Satzkorn ef3bdfd5eb api: add automatic list pagination
Updates all List endpoints to automatically paginate
through results to preserve backwards compatibility.
Adding support for user controllable pagination could
be considered at a later time.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 9ce5a14ef0 config: add max_page_size variable
The max_page_size variable lets operators control the size of the
pagination pages. This value configures both the maximum permitted
page size and the default page size when none is explicitly provided.

Operators can tweak this option up or down to increase or reduce
the load on the database during pagination.
2024-01-05 07:43:20 -08:00
5bfc8a88b1 Add indexes on update_time (#3974)
* Add indexes on update_time

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Co-authored-by: Michael Gaffney <mike@gaffney.cc>
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 43cff11865 internal/db: renumber migration 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 605e44e7ac target: add pagination support
Adds pagination support to the target domain
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn a5b24e79b9 handlers: add refresh token helpers
Helpers for parsing, marshalling and converting types
to domain types.
2024-01-05 07:43:19 -08:00
Johan Brandhorst-Satzkorn 84e5b9401d proto: add pagination Refresh Token
The ListRefreshToken type is used, in its marshalled form,
for pagination requests. A new refresh token is returned
which each invocation of a list method (unless
there was no input refresh token and there were no results).
2024-01-05 07:43:19 -08:00
Johan Brandhorst-Satzkorn 7b5a4be0ab internal/auth: add GrantsHash method to results
The new GrantsHash method can be used to track changes
to a users grants across requests.
2024-01-05 07:43:19 -08:00
Johan Brandhorst-Satzkorn 7c996d0e02 internal/pagination: add new purge package
The purge package contains a job that is used to purge
records from the foo_deleted tables when they become
older than 30 days.
2024-01-05 07:43:19 -08:00
Johan Brandhorst-Satzkorn 78541ad05e internal/pagination: add new pagination package
The pagination package provides generic functions for
iterating over a collection of items such that each incoming
request is filled even after filtering is applied.
2024-01-05 07:43:19 -08:00
Johan Brandhorst-Satzkorn dcb67ca616 internal/refreshtoken: add refreshtoken package
The refreshtoken package encapsulates domain logic surrouding
the refresh token. A refresh token is used both for
paginating through a collection and for requesting any
updates to that collection.
2024-01-05 07:43:19 -08:00
Johan Brandhorst-Satzkorn 0d39456418 internal/boundary: add GetResourceType to Resource
The resource type method is used to automatically
create refresh tokens from a resource when that
resource is the last item returned in a page.

This also renames the iam domain ResourceType method
to GetResourceType to align with the new method.
2024-01-05 07:43:19 -08:00
Johan Brandhorst-Satzkorn dd2b373866 internal/db: add Now method (#3887)
The Now() method returns the current transaction timestamp.
2024-01-05 07:43:19 -08:00
Johan Brandhorst-Satzkorn 38536f4eef internal/db: add deleted tables for all resources (#3885)
Creates a new foo_deleted table for each subtype of each
resource that needs to support pagination. The deleted
tables are used to track deletions of resources and return
them to users of the new pagination API. We track only the
ID and delete_time of the resource, so there's no way to
filter out resources that the user could not see before it
was deleted. This is intentional to keep the design simple
and is not considered a security issue.
2024-01-05 07:43:19 -08:00
Jeff Mitchell 263660a7cb Add support for templating key_id (#4215) 2024-01-04 21:19:36 -05:00
Jeff Mitchell fe4c43305c Move and export ExpectWorkers (#4207)
This is a useful test function and keeping it in the cluster package
means it can't be used by api/cli tests.
2024-01-03 10:41:12 -05:00
hc-github-team-es-release-engineering 9b56db8858 update year in license files (#4115) 2024-01-02 10:52:22 -08:00
Damian Debkowski 2f62f65252 fix(db): make bucket_prefix column immutable for storage buckets (#4108) 2024-01-02 08:53:49 -08:00
Lisbet Alvarez 69810ba80b update ui commit to include bug fix (#4144) 2023-12-11 17:11:52 -08:00
Lisbet Alvarez c61600896f Bump UI commit (#4118)
* Bump UI commit

* update ui commit to include another bug fix

* update commit with oidc prompt changes
2023-12-08 09:59:48 -08:00
Timothy Messier a77c88ae5d feat(ratelimit): Increase default values (#4129)
This increases the default rate limits to:

- 1,500 reqs / 30 seconds for list actions in total
- 1,500 reqs / 30 seconds for list actions per IP address
- 150 reqs / 30 seconds for list actions per auth token

And for all other actions:

- 30,000 reqs / 30 seconds for list actions in total
- 30,000 reqs / 30 seconds for list actions per IP address
- 3,000 reqs / 30 seconds for list actions per auth token

This seems to be a reasonable default for a small to medium size cluster
based on some scale testing.

(cherry picked from commit 237c8b6084f42655edaba49055e511163fdf1c53)
2023-12-08 14:53:49 +00:00
Elim Tsiagbey 053421600d feat(oidc-prompts): Add Validation for Prompts (#4130)
Add validation to prevent "none" from being combined with multiple prompts.

- Valid `["none"]`
- Invalid `["none", "select_account"]`
- Valid `["consent", "select_account"]`
2023-12-08 09:51:54 -05:00
Timothy Messier 758e7b8bf1 test(credentials): Disable rate limiting for test
This test quickly polls a list endpoint, which exceeds the default rate
limits before the test can complete in CI.
2023-12-04 22:40:39 +00:00
Timothy Messier a7730b02ac test(host_catalog): Fix flaky assertion 2023-12-04 21:38:31 +00:00
Timothy Messier 6e233c879f fix(ratelimit): Round up when setting Retry-After header
Previously this would truncate to the nearest integer, which could
result in clients retrying before the quota has reset, and getting rate
limited again. This also includes an update from go-rate that will round
up when reporting the reset time for the RateLimit header.

Note that in the case of a 503, the Retry-After header was already being
set correctly.

See: https://github.com/hashicorp/go-rate/pull/8
2023-12-04 21:35:20 +00:00
Timothy Messier 35b91c66de refact(ratelimit): Rename MaxEntries to MaxQuotas 2023-12-04 17:25:16 +00:00
Timothy Messier a150c588bb feat(controller): Emit sys event detailing the rate limit configuration
A sys event will be emitted when the controller is constructed, and if
the rate limits are changed via a SIGHUP. The event contains the details
of the rate limits for each combination of resource and action. This
event can be used by operators to confirm the limits are set as they
would expect based on the controller config.
2023-12-04 16:24:20 +00:00
Timothy Messier 9438be4506 feat(ratelimier): Support disabling rate limiting 2023-12-04 16:24:20 +00:00
Timothy Messier d0c3da5f1d refact(ratelimiter): Updates due to refactor in go-rate 2023-12-04 16:24:19 +00:00
Timothy Messier 3c2bed92b0 feat(ratelimit): Expose metrics on quota usage
This provides two prometheus metrics to monitor the rate limiter:

boundary_controller_api_ratelimiter_quota_storage_capacity:

This is a gague that shows the total number of quotas that can be stored
at a given moment by the rate limiter.

boundary_controller_api_ratelimiter_quota_storage_usage:

This is a gague that shows the number of quotas currently being stored
by the limiter. If this becomes equal to the capacity, requests that
would result in a new quota being created will get limited and receive a
429 status code.
2023-12-04 16:24:04 +00:00
Timothy Messier 0bc423ebd8 feat(controller): Reload api rate limits on SIGHUP 2023-12-04 16:24:04 +00:00
Timothy Messier f54f2c0fc4 fix(ratelimit): Correctly extract ids from paths with punctuation 2023-12-04 16:24:04 +00:00
Timothy Messier 26854b01a8 feat(ratelimit): Set RateLimit and RateLimit-Policy headers 2023-12-04 16:24:04 +00:00
Timothy Messier e337cf8f69 feat(controller): Add authtoken public id to request context
This allows for http middleware handler functions that run later in the
handler function stack to have access to the extracted auth token public
id.
2023-12-04 16:24:04 +00:00
Timothy Messier 059d4992de feat(ratelimit): Add support for limits per ip address and auth token 2023-12-04 16:24:00 +00:00
Timothy Messier 00bd2899af feat(controller): Add ratelimiter http middleware 2023-12-04 16:22:58 +00:00
Timothy Messier 2853324479 feat(ratelimit): Add http middleware handler function 2023-12-04 16:20:44 +00:00
Timothy Messier 6da47443fd feat(ratelimit): Create rate limits from configs 2023-12-04 16:20:44 +00:00
Timothy Messier 61fcd857ec feat(resource): Add function to get type from plural string 2023-12-04 16:20:44 +00:00
Timothy Messier 51adde4b2c feat(handlers): Register actions for each resource type
This registers the ActionSets for each resource when the handler
packages are initialized. This then allows other packages to retrieve
the ActionSets for a given resource from the action package.

The initial consumer of this will be the ratelimit package so that it
can programmatically enumerate all of the valid combinations of a
resource and action.

This leaves a number of TODO to refactor the handler packages to also
retrieve the action sets from the registered actions instead of using a
package variable. This is left as a TODO since there is some
inconsistencies in how these package variables are used between the
handlers. For example a number of packages use a map of subtypes to
ActionSets which is then used withing the handler implementation. Others
use a map, but don't seem to use it at all. And others just use an
ActionSet.
2023-12-04 16:20:29 +00:00
Timothy Messier 3f4a723541 feat(action): Add registrar for valid actions by resource 2023-12-04 16:20:29 +00:00
Timothy Messier 8643d8e6c6 feat(errors): Add code for invalid configuration 2023-12-04 16:20:29 +00:00
Timothy Messier c52caae345 refact(action): Make ActionSet behave as a set instead of a list
This switches the implementation of an ActionSet from a slice to a map
to ensure the elements in an ActionSet are unique. This allows for other
packages to perform set operations such as a union or difference without
needing to account for duplicates.
2023-12-04 16:20:29 +00:00
Timothy Messier bee45dc486 feat(config): Add fields for controller rate limit configuration 2023-12-04 16:20:28 +00:00
Timothy Messier 0fb77358e5 feat(ratelimit): Define initial ratelimit package and Config 2023-12-04 16:20:28 +00:00
Lisbet Alvarez 8584f71791 update ui commitish (#4087) 2023-12-01 10:12:37 -08:00
Jim 798e86cefe tests (ldap managed groups): extend tests to include ldap grps for GrantsForUser(...) (#3972)
* chore (managed groups): just a small rename to improve readability

* test (aut/ldap): add a test for user grants based on ldap grp

* tests (role grant): extend TestGrantsForUser(...) to cover ldap grps

* refact (iam.(Repository).GrantsForUser): more readable grantsQuery

Convert existing CTE to use sub-selects for readability
2023-11-29 16:29:36 -05:00
Johan Brandhorst-Satzkorn a89573b35f subtypes,handlers: add runtime trace regions (#4060)
* subtypes,handlers: add runtime trace regions

The subtype.Filterable and handlers.ProtoToStruct functions
are costly and worth measuring whenever runtime tracing
is in use. This has almost no cost when tracing is not in use,
so there's little harm in having them in place.

* testing: Add TRACING.md

TRACING.md contains information about how to perform
Go runtime tracing of the Boundary application.
2023-11-27 13:37:04 -08:00
Jim 18729721a1 fix (plugins/gcpkms): update dep to fix issue with using gcp kms (#4058) 2023-11-24 14:33:56 -05:00
Elim Tsiagbey 8b8d2822df feat(oidc): OIDC Prompt (#4053)
Boundary OIDC method does not currently support passing in prompts during authentication. This change adds the capability of passing OIDC prompts. Prompts are optional OIDC parameters that determine the behaviour of the authentication server: https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest

## Changes

- New `auth_oidc_prompt` table which contains all the prompts for OIDC auth method
- New `auth_oidc_prompt_enm` table which contains possible enum values for a prompt
  - Currently supported:
    - `none`: 
The Authorization Server MUST NOT display any authentication or consent user interface pages
    - `login`: The Authorization Server SHOULD prompt the End-User for reauthentication
    - `consent`: The Authorization Server SHOULD prompt the End-User for consent before returning information to the Client
    - `select_account`: The Authorization Server SHOULD prompt the End-User to select a user account
- `oidc_auth_method_with_value_obj` view has been updated to return `prompt` value
- Add `prompt` option for OIDC auth method CLI create and update
- Pass configured prompt during OIDC authentication
- Add `prompt` API validation for create and update
2023-11-21 11:30:02 -05:00