Commit Graph

239 Commits

Author SHA1 Message Date
Kim Christensen 0820ef60a4 Implement regex.find_n (#1001)
Add regex.find_n built-in function

Fixes #747

Signed-off-by: Kim Christensen <kimworking@gmail.com>
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-10-12 18:57:51 -04:00
repenno 3e0fe4ba7b Add support for headers in http.send
Signed-off-by: repenno <rapenno@gmail.com>
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-10-08 16:51:23 -07:00
Richard Kettlewell 848caefcc9 Add builtin to verify and decode JWT
Signed-off-by: Richard Kettlewell <Richard.Kettlewell@thalesesecurity.com>
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2018-09-25 10:28:12 -07:00
Torin Sandall 9fbff4c330 Prepare v0.9.2 release
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-09-24 09:10:52 -07:00
Torin Sandall aff944f6d8 Add array.concat built-in to language ref
For some reason, this was missing from the language reference.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-09-24 08:38:45 -07:00
arekkas 74f0dedd6c Add regex.template_match built-in
Closes #964

Signed-off-by: arekkas <aeneas@ory.am>
2018-09-20 10:05:49 -07:00
arekkas f265f9b1a4 Add NetCIDROverlap built-in
This patch adds a new built-in `net.cidr_overlap`.

See #897

Signed-off-by: arekkas <aeneas@ory.am>
2018-09-19 08:33:32 -07:00
Torin Sandall 8b65cb5f18 Update test runner to set Fail to true
Previously the test runner would set fail to the value generated by the
test rule or false on undefined. The intent was to communicate the value
generated by the rule. In practice users are not writing tests that
generate values other than true so this is essentially unnecessary.

Fixes #954

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-09-17 11:07:01 -07:00
Johannes M. Scheuermann 6a7c0b3972 Fix coverage flag for test command
Signed-off-by: Johannes M. Scheuermann <joh.scheuer@gmail.com>
2018-09-17 08:49:07 -07:00
Johannes M. Scheuermann e1a1a1bc9b Add recommended version for minikube and remove the ADMISSION_CONTROLLERS variable
Signed-off-by: Johannes M. Scheuermann <joh.scheuer@gmail.com>
2018-09-06 10:30:00 -07:00
Johannes M. Scheuermann ccb0fef494 Correct links to yaml files
Signed-off-by: Johannes M. Scheuermann <joh.scheuer@gmail.com>
2018-09-06 10:30:00 -07:00
Johannes M. Scheuermann 326fb83958 Correct link to admission-controller.yaml and add deployment selector
Signed-off-by: Johannes M. Scheuermann <joh.scheuer@gmail.com>
2018-09-06 10:30:00 -07:00
Johannes M. Scheuermann eae1b4190d Correct Minikube parameter in Kubernetes example
Signed-off-by: Johannes M. Scheuermann <joh.scheuer@gmail.com>
2018-09-06 10:30:00 -07:00
Johannes M. Scheuermann e083b34501 Correct example policy fixes #934
Signed-off-by: Johannes M. Scheuermann <joh.scheuer@gmail.com>
2018-09-06 10:19:16 -07:00
Torin Sandall d1d7a8f26e Update docker authorization tutorial to use latest
The docker authorization tutorial was using an old version of the
plugin. The latest version of the plugin implements the new Docker
plugin model and has different installation steps. These changes should
fix the parse errors that users were seeing when running through the
tutorial.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-09-04 17:21:44 -07:00
Torin Sandall 3ffb13f138 Link to security docs in tutorials
Fixes #917

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-09-04 14:30:20 -07:00
Torin Sandall 4aa9d715e4 Improve token authentication docs and handler
With these changes, the identity will be undefined if a token is not
specified. This is less surprising than the empty string that would be
set prior to these changes.

Fixes #901

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-09-04 14:30:07 -07:00
Ashutosh Narkar 51d5d1114e Add option to enable http redirects. (#925)
Fixes #921

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2018-09-04 11:27:25 -07:00
Kazuki Suda b4e9362b35 Fix to indent 4 spaces instead of a tab
On the document, all rego files are indented with 4 spaces. Thus this
commit fixes to indent 4 spaces instead of a tab.

- https://www.openpolicyagent.org/docs/kubernetes-admission-control.html

Signed-off-by: Kazuki Suda <kazuki.suda@gmail.com>
2018-09-04 09:24:32 -07:00
Torin Sandall 0d1c5dd3f7 Fix whitespace in REPL example of language guide
The rule 'r' was being defined incrementally when that was not intended.
Rename to 's' to avoid this.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-08-28 11:14:33 -07:00
Travis Tripp ce65ff8a6b v0.9.1 How Do I Write Policies example output fix
The output from running the interactive
interpretter with v0.9.1 does not match
a few of the examples list in the
How Do I Write Policies section.

This updates the examples to match
the examples observed from running
the v0.9.1 cli.

Signed-off-by: Travis Tripp <os.travis.tripp@gmail.com>
2018-08-27 10:07:38 -07:00
NIkhil Bhatia 24a1ca5953 Update tutorial for default policy load ns (#899)
By default kube-mgmt will try to load policies out of configmaps in the opa namespace OR configmaps in other namespaces labelled openpolicyagent.org/policy=rego.

Signed-off-by: Nikhil Bhatia nbhatia@microsoft.com
2018-08-22 15:06:19 -07:00
Torin Sandall d5ba22b70a Prepare v0.9.1 release
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-08-16 08:42:41 -07:00
Torin Sandall ff389cddd1 Fix terraform tutorial type check errors
In de828cd we added any and all built-in functions. This broke the
example policy in the terraform tutorial that was expecting "all" to be
a variable. We fix this by replacing the unification expressions ("=")
with assignments (":=").

Fixes #888

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-08-16 08:37:29 -07:00
ken5scal f38864994a fix typo
Signed-off-by: ken5scal <kengoscal@gmail.com>
2018-08-15 10:09:49 -07:00
Torin Sandall 6282a2ab26 Improve Docker tutorial example
Previously the example policy at the end of the tutorial would allow
operations if the Authz-User was contained in the input headers but not
in the user mapping. This change makes sure that the user is defined in
the mapping.

Also, update the example to use := and == instead of = (which is
functionaly the same but better practice because they avoid capturing
globals.)

Fixes #880

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-08-15 09:08:29 -07:00
Torin Sandall ce05e30cc0 Refactor configuration reference docs
Previously the configuration reference for bundles, status updates,
decision logs, etc. was split across multiples. These changes refactor
the docs so that the configuration reference is in one place.

Also, fix a few issues in the gitbook SUMMARY.md file that made the TOC
not work properly.

Fixes #871

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-08-14 10:15:36 -07:00
Ashutosh Narkar d3a1655d0f Add regex split builtin (#877)
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2018-08-13 10:12:37 -07:00
Richard Kettlewell e9071942d9 Implement io.jwt.verify_es256
The signing key used in the new test(corresponding to certPemEs256) is:

-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgtT+DJZkjOAhEaLnU
dc0BOvwnmFxFGyYz0PRkdOV/r82hRANCAATPwn3WCEXLmjp/bFniDwuwsfu7bASl
Pae2PyWhqGeWwe23Xlyx+tSqxlkXYe4pZ23BkAAscpGjyn5gXHExyDlK
-----END PRIVATE KEY-----

Signed-off-by: Richard Kettlewell <Richard.Kettlewell@thalesesecurity.com>
2018-08-13 09:08:57 -07:00
Richard Kettlewell 90b99e53f5 Implement io.jwt.verify_ps256
The behavior is the same as the rs256 version, except that it uses
RSA-PSS for verification.

The signing key used in the new tests (corresponding to certPemPs) is:

-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAuJApsyzFv+Y85M5JjezHvMDw/spgVCI7BqpYhnzK3xXw1dnk
z1bWXGA9yF6AeADlE+1yc1ozrAURTnFSihIgj414i3MC2/0FkNcdAbnX7d9q9/jd
CkHda4HER0zzXCaHlgnzoAz6edUU800+h0LleLnfgg4UST+0DFTCIGpfTbs7OPSy
2WgT1vP6xbB45CUOJA7o0q6XE+hdhWWN0plrDiYD+0Y1SpOQYXmHhSmr+WVeKeoh
5/0zeEVab6TQYec/16ByEyepaZB0g6WyGkFE6aG1NrpvDd24s/h7BAJg/S2mtu1l
KWEqYjOgwzEl5XQQyXbpnq1USb12ArX16rZdewIDAQABAoIBAEw7F04vVvpdIZer
8MuTGijHVIMYmdMGVHT7VRcvYifkixX5Kr3M8zsycTJafhuS2wtxDs3AWwlZCn3o
5puqwxIn77tBZNPyX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sFwQMO2BmSI74MdsdsqnXRJDEm99
XGCADKfGvBKXKseZNDZopF1a95YEGeEFt6f/bh9ZSs4UaCwzYrxp
-----END RSA PRIVATE KEY-----

Signed-off-by: Richard Kettlewell <Richard.Kettlewell@thalesesecurity.com>
2018-08-13 09:08:57 -07:00
Torin Sandall 0c66566673 Add support for command line bundle loading
Previously OPA would only load JSON/YAML/Rego files off the command
line. With these changes, OPA will load .tar.gz files and interpret them
as bundles. This is useful if you want to test your bundles locally with
OPA without running OPA as a server, configuring it to pull down the
bundle, etc.

Also, update docs to mention that data files MUST be named data.json.

Fixes #870
Fixes #873

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-08-08 16:10:34 -07:00
Stephan Renatus d7d24fd864 book: fix typos
Signed-off-by: Stephan Renatus <srenatus@chef.io>
2018-08-06 10:54:46 -07:00
Torin Sandall 71d0e299b4 Prepare v0.9.0 release
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-07-31 14:35:00 -07:00
Torin Sandall 8238c45855 Small improvements to language guide
- Fix basics section on undefined
- Add note about safety to section on built-ins

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-07-25 11:15:02 -07:00
Torin Sandall 67db7610db Add built-in function to parse Rego modules
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-07-24 11:39:27 -07:00
Torin Sandall 4b5a232cd2 Refactor presentation package and docs
Minor changes following eb5e5b243f

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-07-20 17:28:59 -07:00
Ashutosh Narkar eb5e5b243f Add profiler to OPA eval command
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2018-07-20 16:00:05 -07:00
Varun Mathur de828cdc6e - Added any/all builtins
- Added tests
- Added docs

Signed-off-by: Varun Mathur <varun.mathur@live.com>
2018-07-10 13:06:34 -07:00
Olivier Lemasle 97c7c489bd Fix link in FAQ
Signed-off-by: Olivier Lemasle <o.lemasle@gmail.com>
2018-07-03 08:32:35 -07:00
Torin Sandall 8c95fa4a39 Update Compile API empty body representation
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-06-29 10:29:28 -07:00
Torin Sandall 28390a2342 Add docs for testing policies with opa test
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-06-29 06:38:10 -07:00
Ashutosh Narkar fa99c6e5c7 Update docker engine version in docker authz tutorial (#806)
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2018-06-28 10:09:45 -07:00
Torin Sandall eec5b0c62a Fix docs summary.md to include Compile API
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-06-28 08:31:23 -07:00
Torin Sandall d3b9f53e1f Add docs for new /v1/compile API
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-06-28 08:11:45 -07:00
vrnmthr deef34d27e Filled out the casting section of builtin functions. I think the to_set
and to_array functions require no justification.

For the others: I realized this would be useful to have when I was
doing http calls that returned a types.A and thus when I parsed my code
on occasion it only threw type errors at runtime when I attempted to use
the result in another builtin. It would be great to have some way to
throw these type errors at compile time as well if the
user likes, hence these functions.

Changed names to cast_, added test, added copyright banner, added docs.

Signed-off-by: Varun Mathur <varun.mathur@live.com>
Signed-off-by: Varun Mathur <vmathur@cloudsimple.com>
Signed-off-by: Varun Mathur <varun.mathur@live.com>
2018-06-27 11:00:54 -07:00
Stephan Renatus 6e8da23b30 Add time.weekday builtin
Fixes #789.

Signed-off-by: Stephan Renatus <srenatus@chef.io>
2018-06-25 08:52:42 -07:00
Torin Sandall 877d39f035 Prepare v0.8.2 release
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-06-22 15:02:03 -07:00
Torin Sandall 35afcc6f9d Add urlquery.encode_object to language reference
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-06-22 14:58:05 -07:00
Torin Sandall eee76c6365 Update subcommands to support loader filter
These changes update the subcommands to support a file/directory name
filter. This allows users to exclude certain files from being loaded.
With these changes users can excldue private directories created by
Kubernetes for volume-mounted ConfigMaps.

As part of this change, update the Kubernetes deployment documentation
to use the new --ignore flag, run OPA as a Deployment instead of as a
ReplicationController, and generally improve the example.

Fixes #782

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-06-22 14:22:14 -07:00
Torin Sandall c5106fa49d Remove decision log buffer limit
This change removes the default decision log buffer limit to avoid
unintentionally dropping decision logs. If users are concerned about
memory usage they can set the limit, but by default they will not be
surprised by log discards.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-06-18 11:32:22 -07:00