Commit Graph

56 Commits

Author SHA1 Message Date
hashicorp-copywrite[bot]
0b12cdcfd1 [COMPLIANCE] License changes (#22290)
* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Updating the license from MPL to Business Source License.

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl.

* add missing license headers

* Update copyright file headers to BUS-1.1

* Fix test that expected exact offset on hcl file

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
Co-authored-by: Brian Kassouf <bkassouf@hashicorp.com>
2023-08-10 18:14:03 -07:00
Pratyoy Mukhopadhyay
dee7fd839e add ns path to granting_policies (#20522) 2023-05-04 15:08:22 -07:00
Hamid Ghaf
e55c18ed12 adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00
Anton Averchenkov
1e515ca08c Fix linter issues in policy.go & acl.go (#16366) 2022-07-22 14:13:14 -04:00
Brian Kassouf
dad15beb5a Add list of granting policies audit logs (#15457)
* Add list of granting policies audit logs

* Add changelog
2022-05-16 16:23:08 -07:00
Josh Black
b17e3256dd reformat using 'make fmt' (#13794) 2022-01-27 10:06:34 -08:00
Chris Capurso
6f65a4addc Add HTTP PATCH support to KV (#12687)
* handle HTTP PATCH requests as logical.PatchOperation

* update go.mod, go.sum

* a nil response for logical.PatchOperation should result in 404

* respond with 415 for incorrect MIME type in PATCH Content-Type header

* add abstraction to handle PatchOperation requests

* add ACLs for patch

* Adding JSON Merge support to the API client

* add HTTP PATCH tests to check high level response logic

* add permission-based 'kv patch' tests in prep to add HTTP PATCH

* adding more 'kv patch' CLI command tests

* fix TestHandler_Patch_NotFound

* Fix TestKvPatchCommand_StdinValue

* add audit log test for HTTP PATCH

* patch CLI changes

* add patch CLI tests

* change JSONMergePatch func to accept a ctx

* fix TestKVPatchCommand_RWMethodNotExists and TestKVPatchCommand_RWMethodSucceeds to specify -method flag

* go fmt

* add a test to verify patching works by default with the root token

* add changelog entry

* get vault-plugin-secrets-kv@add-patch-support

* PR feedback

* reorder some imports; go fmt

* add doc comment for HandlePatchOperation

* add json-patch@v5.5.0 to go.mod

* remove unnecessary cancelFunc for WriteBytes

* remove default for -method

* use stable version of json-patch; go mod tidy

* more PR feedback

* temp go get vault-plugin-secrets-kv@master until official release

Co-authored-by: Josh Black <raskchanky@users.noreply.github.com>
2021-10-13 15:24:31 -04:00
Brian Kassouf
a24653cc5c Run a more strict formatter over the code (#11312)
* Update tooling

* Run gofumpt

* go mod vendor
2021-04-08 09:43:39 -07:00
Scott Miller
39d04d77f3 Update HCL dependency to fix ParseACLPolicy error on invalid syntax (#10156) 2020-11-30 09:17:33 -06:00
mgritter
e6f0044522 Check nil parameter value when processing an ACL. 2019-04-26 15:57:00 -07:00
Jeff Mitchell
170521481d Create sdk/ and api/ submodules (#6583) 2019-04-12 17:54:35 -04:00
Jeff Mitchell
9fb146f3ff Fix hasMountPath for segment wildcard mounts; introduce priority order (#6532)
* Add prioritization when multiple segment/glob rules can match.

* Disallow ambiguous "+*" in policy paths.
2019-04-10 17:46:17 -04:00
Brian Kassouf
facbc4cc60 Revert "filtered-path endpoint (#6132)" (#6337)
This reverts commit dfdbb0bad9.
2019-03-04 14:08:21 -08:00
ncabatoff
dfdbb0bad9 filtered-path endpoint (#6132)
* First pass at filtered-path endpoint.  It seems to be working, but there are tests missing, and possibly some optimization to handle large key sets.

* Vendor go-cmp.

* Fix incomplete vendoring of go-cmp.

* Improve test coverage.  Fix bug whereby access to a subtree named X would expose existence of a the key named X at the same level.

* Add benchmarks, which showed that hasNonDenyCapability would be "expensive" to call for every member of a large folder.  Made a couple of minor tweaks so that now it can be done without allocations.

* Comment cleanup.

* Review requested changes: rename some funcs, use routeCommon instead of
querying storage directly.

* Keep the same endpoint for now, but move it from a LIST to a POST and allow multiple paths to be queried in one operation.

* Modify test to pass multiple paths in at once.

* Add endpoint to default policy.

* Move endpoint to /sys/access/filtered-path.
2019-03-04 11:04:29 -08:00
Jeff Mitchell
1bbba90052 Add ability to use path wildcard segments (#6164)
* Path globbing

* Add glob support at the beginning

* Ensure when evaluating an ACL that our path never has a leading slash. This already happens in the normal request path but not in tests; putting it here provides it for tests and extra safety in case the request path changes

* Simplify the algorithm, we don't really need to validate the prefix first as glob won't apply if it doesn't

* Add path segment wildcarding

* Disable path globbing for now

* Remove now-unneeded test

* Remove commented out globbing bits

* Remove more holdover glob bits

* Rename k var to something more clear
2019-02-14 18:31:43 -08:00
Vishal Nayak
448eb98987 Remove namespace.TestContext and namespace.TestNamespace (#5682) 2018-11-05 11:11:32 -05:00
Jeff Mitchell
b7d6d55ac1 The big one (#5346) 2018-09-17 23:03:00 -04:00
Josh Soref
e43b76ef97 Spelling (#4119) 2018-03-20 14:54:10 -04:00
Chris Hoffman
ed8cf070c9 Add ability to require parameters in ACLs (#3510) 2017-11-02 07:18:49 -04:00
Jeff Mitchell
98168dc791 Sync over 2017-10-23 16:43:07 -04:00
Jeff Mitchell
88e9d194fd Properly lowercase policy names. (#3210)
Previously we lowercased names on ingress but not on lookup or delete
which could cause unexpected results. Now, just unilaterally lowercase
policy names on write and delete. On get, to avoid the performance hit
of always lowercasing when not necessary since it's in the critical
path, we have a minor optimization -- we check the LRU first before
normalizing. For tokens, because they're already normalized when adding
policies during creation, this should always work; it might just be
slower for API calls.

Fixes #3187
2017-08-18 19:47:23 -04:00
Jeff Mitchell
42973f3d79 Clone policy permissions and then use existing values rather than policy values for modifications (#2826)
Should fix #2804
2017-06-07 13:49:51 -04:00
Brian Kassouf
9ee0c34179 Allowed/Denied parameters support for globs (#2438)
* Add check for globbed strings

* Add tests for the acl globbing

* Fix bad test case
2017-03-03 14:50:55 -08:00
Jeff Mitchell
95513e0f1e Add max/min wrapping TTL ACL statements (#2411) 2017-02-27 14:42:00 -05:00
Brian Kassouf
93b7a495e4 Added test for the empty values array case 2017-02-21 16:02:00 -08:00
Brian Kassouf
8a190cfe4e PR feedback 2017-02-21 15:02:39 -08:00
Brian Kassouf
18131905a2 ToLower parameter strings 2017-02-16 17:50:10 -08:00
Brian Kassouf
cbf8c280e1 Simplify the merging of two policies 2017-02-16 16:30:08 -08:00
Brian Kassouf
0bb911c936 Remove debug code 2017-02-16 16:14:30 -08:00
Brian Kassouf
13ffbdabda Update logic to fix a few edge cases: 2017-02-16 15:20:11 -08:00
Brian Kassouf
b23e4da01c Remove duplicate test case 2017-02-15 22:38:33 -08:00
Brian Kassouf
6b7d328e79 Fix the issue of returning on the first paramater check. Added tests for this case. 2017-02-15 22:13:18 -08:00
Jeff Mitchell
d6cf46759e Remove "permissions" from ACL 2017-02-15 21:12:26 -05:00
Brian Kassouf
342f80b620 Add logic to merge the two arrays and refactor the test around merging 2017-01-20 11:16:46 -08:00
Brian Kassouf
888a742198 Update tests to check parsing of types 2017-01-19 18:13:39 -08:00
Brian Kassouf
28e9eaa25d Add tests for boolean values 2017-01-19 17:41:02 -08:00
Brian Kassouf
6f1a313853 fix some of the tests and rename allowed/dissallowed paramaters 2017-01-19 16:40:19 -08:00
Brian Kassouf
aa04ba6ed4 Add test cases for map and integer types 2017-01-18 17:11:25 -08:00
Brian Kassouf
f315ecc13d Use deepequals and write tests for the allow/disallow values 2017-01-17 16:40:21 -08:00
mwoolsey
35888df486 Permissions were changed from a structure to and array of interfaces. Code optimization for acl.go. Fixed bug where multiple parameters would allow if second or following parameters were denied and there was a wildcard in allow. 2016-12-06 18:14:15 -08:00
lemondrank
19257d3a50 added AllowOperation tests 2016-11-07 12:28:41 -08:00
ChaseLEngel
5711af4d1d Moved Operations out of test cases variable. 2016-11-07 12:08:17 -08:00
ChaseLEngel
7ceec7a4a3 Finished merge testing. 2016-11-06 15:16:08 -08:00
mwoolsey
06f3f8cfde narrowed the problem to: the Permissions struct in the TestPolicyMerge method is not being initialized 2016-11-06 13:38:25 -08:00
mwoolsey
d04048bb8e Started the testing on merged pathCapabilites 2016-11-01 21:27:33 -07:00
ChaseLEngel
27ba2db643 Add merge testcases 2016-11-01 19:48:00 -07:00
lemondrank
860578dcd8 started acl_test updates 2016-10-30 15:09:45 -07:00
ChaseLEngel
c36ab446f6 Update acl and policy tests to use Permissions. 2016-10-21 23:45:39 -07:00
vishalnayak
e68a2708e8 Added tests for disallowed_policies 2016-08-02 15:21:15 -04:00
vishalnayak
0f82724f1f test cases for capabilities endpoint 2016-03-05 00:03:55 -05:00