Commit Graph

292 Commits

Author SHA1 Message Date
Sebastien de Menten e13143c737 import http-api tutorial
- simplify python code (use json=, use strip)
- do not rename input as http_api (quite confusing, better to keep input everywhere in all tutorials
- reorder statement to always have input.user as first item in the rule

Signed-off-by: Sebastien de Menten <sdementen@gmail.com>
2019-02-17 09:54:19 -08:00
Torin Sandall bb80fd7f74 Add path conflict checks
Previously there were no checks in place to ensure that base and
virtual documents do not overlap. As a result, if users loaded raw
JSON and rules into OPA that overlapped, the evaluation results were
not well defined. With these changes, we can detect the overlap and
reject updates (to policies or data) that would cause inconsistent
results.

Fixes #1207

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-02-15 08:00:22 -08:00
Sebastien de Menten b6d95b1cad change tickerAttributes to ticker_attributes (typo in example)
Signed-off-by: Sebastien de Menten <sdementen@gmail.com>
2019-02-12 06:41:12 -08:00
Andy Curtis 778594ec79 config: add version to labels
Adds OPA version to the config labels, so that the version
appears in status updates. Previously, decision logs had a
top-level version field. This removes that field because
version will be contained in the labels instead.

Signed-off-by: Andy Curtis <arcurtis@gmail.com>
2019-02-08 15:55:27 -08:00
repenno b4aecc3c43 Need https.send built-in supporting TLS secured connections
Fixes #1067

=== RUN   TestHTTPSClient
--- PASS: TestHTTPSClient (0.30s)
=== RUN   TestHTTPSClient/Successful_HTTPS_Get_with_File_Cert
    --- PASS: TestHTTPSClient/Successful_HTTPS_Get_with_File_Cert (0.03s)
=== RUN   TestHTTPSClient/Successful_HTTPS_Get_with_File_Cert/http.send
        --- PASS: TestHTTPSClient/Successful_HTTPS_Get_with_File_Cert/http.send (0.02s)
=== RUN   TestHTTPSClient/Successful_HTTPS_Get_with_Env_Cert
    --- PASS: TestHTTPSClient/Successful_HTTPS_Get_with_Env_Cert (0.02s)
=== RUN   TestHTTPSClient/Successful_HTTPS_Get_with_Env_Cert/http.send
        --- PASS: TestHTTPSClient/Successful_HTTPS_Get_with_Env_Cert/http.send (0.01s)
=== RUN   TestHTTPSClient/Successful_HTTPS_Get_with_Env_and_File_Cert
    --- PASS: TestHTTPSClient/Successful_HTTPS_Get_with_Env_and_File_Cert (0.02s)
=== RUN   TestHTTPSClient/Successful_HTTPS_Get_with_Env_and_File_Cert/http.send
        --- PASS: TestHTTPSClient/Successful_HTTPS_Get_with_Env_and_File_Cert/http.send (0.02s)
=== RUN   TestHTTPSClient/No_Root_Ca
    --- PASS: TestHTTPSClient/No_Root_Ca (0.01s)
=== RUN   TestHTTPSClient/No_Root_Ca/http.send
        --- PASS: TestHTTPSClient/No_Root_Ca/http.send (0.00s)
=== RUN   TestHTTPSClient/Wrong_Cert/Key_Pair
2019/01/29 13:23:34 http: TLS handshake error from 127.0.0.1:53160: remote error: tls: bad certificate
    --- PASS: TestHTTPSClient/Wrong_Cert/Key_Pair (0.01s)
=== RUN   TestHTTPSClient/Wrong_Cert/Key_Pair/http.send
        --- PASS: TestHTTPSClient/Wrong_Cert/Key_Pair/http.send (0.00s)
=== RUN   TestHTTPSClient/System_Certs_do_not_include_local_rootCA
    --- PASS: TestHTTPSClient/System_Certs_do_not_include_local_rootCA (0.21s)
=== RUN   TestHTTPSClient/System_Certs_do_not_include_local_rootCA/http.send
2019/01/29 13:23:34 http: TLS handshake error from 127.0.0.1:53161: remote error: tls: bad certificate
        --- PASS: TestHTTPSClient/System_Certs_do_not_include_local_rootCA/http.send (0.21s)
PASS

Signed-off-by: repenno <rapenno@gmail.com>
2019-02-07 08:41:25 -08:00
Pauline 4ce499894e Fixed a few typos
Signed-off-by: Pauline <pauline.lallinec@gmail.com>
2019-02-04 13:31:31 -08:00
Torin Sandall 2f87823158 docs: Fix compile API examples
Updated examples to always include result wrapper and simplified the
example policies a bit by removing use of negation.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-02-01 08:28:06 -08:00
repenno 8e4cabb3de Add documentation in the REST API section for error 405
Fixes #1181

There are a couple of things reported in this PR: lack of 405 error and
missing return codes.

I decided to go through the entire REST API manual while comparing with
the code and found more discrepancies. These are the changes I've done:

1 - Restructured the sections to read

..rest api spec
..example

as opposed to:

..part of rest api spec
..example
..part of rest api spec.

As I went through the manual this break in the spec made things
confusing. If I was going to implement a client I would prefer to have
the complete spec for a certain method followed by an example as
opposed to the example break.

2 - Fixed missing or inconsistent return codes

There were quite a few of these.

3 - Added an overall 405 return code.

Since the sections are per method it does not make sense to have a 405
return code there. Therefore I added a small overall section in the
beginning that explains that we return 405 for non-allowed methods

Signed-off-by: repenno <rapenno@gmail.com>
2019-01-31 08:04:55 -08:00
repenno 2fd5ed838e Add documentation in the REST API section for error 405
Fixes #1181

There are a couple of things reported in this PR: lack of 405 error and
missing return codes.

I decided to go through the entire REST API manual while comparing with
the code and found more discrepancies. These are the changes I've done:

1 - Restructured the sections to read

..rest api spec
..example

as opposed to:

..part of rest api spec
..example
..part of rest api spec.

As I went through the manual this break in the spec made things
confusing. If I was going to implement a client I would prefer to have
the complete spec for a certain method followed by an example as
opposed to the example break.

2 - Fixed missing or inconsistent return codes

There were quite a few of these.

3 - Added an overall 405 return code.

Since the sections are per method it does not make sense to have a 405
return code there. Therefore I added a small overall section in the
beginning that explains that we return 405 for non-allowed methods

Signed-off-by: repenno <rapenno@gmail.com>
2019-01-31 08:04:55 -08:00
Nischal Sheth b8039020d3 docs: Correct a couple of issues in grammar documentation
Remove "instructions", include "object-compr" and "set-compr" in "term".

Fixes #1187

Signed-off-by: Nischal Sheth <nsheth@ves.io>
2019-01-30 07:54:45 -08:00
Torin Sandall 0a83add2ac docs: Tweak bundle documentation
There was a minor issue with capitalization.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-01-28 12:59:22 -08:00
liorlevtov c5c8621bb5 Bundle plugin: Adding Prefix to Configuration
This change allows to set the Prefix to the path of the URI.
Until this commit the prefix statically set as "bundles" and was concatenated by the bundle plugin.

Signed-off-by: liorlevtov <liorl@luminate.io>
2019-01-28 11:40:25 -08:00
Ashutosh Narkar a38675336f docs: Fix Regex doc horizontal alignment
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2019-01-24 10:52:28 -08:00
Torin Sandall a852671272 Prepare v0.10.3 release
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-01-22 07:41:51 -08:00
Torin Sandall 235a333df4 docs: Update decision log and metrics docs
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-01-16 12:45:47 -08:00
Ashutosh Narkar eaf7197fba Update Discovery docs with a realistic example.
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2019-01-16 10:53:49 -08:00
Torin Sandall 2e2e9bcbca docs: Add note about inserting blank line to end multi-line
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-01-16 09:41:27 -08:00
Torin Sandall 4118bb011b docs: Update bundle docs with note about merging
This is a common question so it should be answered at the beginning of
the documentation section on bundles.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-01-16 09:19:26 -08:00
Ashutosh Narkar adba37c3cc Add documentation for OPA-Ceph Integration.
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2019-01-16 00:23:10 -08:00
Stephan Renatus 3286c39822 server: add authentication based on TLS
* identifier: add TLSBased

This is only the identifier, the server setup still has to be done.

Note that it diverges a little from what was proposed in the issue:
not every client cert needs to have a CN record -- so instead, we'll
use whatever is the cert's subject as client identity.

* Drive-by fix: identifier_test: don't use same package for TokenBased
  tests.
* server: require and verify client cert for AuthenticationTLS
* server: allow setting CA pool via --tls-ca-cert-file
* server: expose new authentication via parameter
* [nit] server: simplify getListenerForHTTPServer
* server_test: use httptest for integration-y TLS tests
* book/security: mention TLS authn with example

Signed-off-by: Stephan Renatus <srenatus@chef.io>
2019-01-14 12:57:35 -08:00
Torin Sandall 62ec12d492 chore: Update release-builder for Go 1.11
Also, remove gulp installation as that's not required with the new frontpage.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-01-11 09:47:27 -08:00
Torin Sandall cffc3d996d Add support for custom backends in decision logger
These changes modify the decision logger to support custom
backends. The docs now include an example of how to implement a custom
backend that writes out to stdout.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-01-10 14:52:14 -08:00
Torin Sandall 56484c9b14 Refactor custom plugin interface
These changes refactor the custom plugin interface to bring it inline
with the bundle/decision logs/status built-ins. Specifically, the
plugin interface is being refactored to allow configuration to be
validated separate from plugin instantiation.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2019-01-10 14:52:14 -08:00
oksana 363f87ba52 fix docs: multiple links in policies tutorial were incorrect
Signed-off-by: oksana <oksana@styra.com>
2019-01-07 11:46:58 -08:00
Fraser Cobb cfe1927a1c Update count function doc to mention strings (#1126)
* Update count function doc to mention strings

Updates the doc for the built-in function count to mention strings.

Fixes #1122

Signed-off-by: Fraser Cobb <frasercobb@gmail.com>
2018-12-20 10:20:23 -08:00
Nikhil Bhatia a368b38c9e Update REST API specification with POST endpoint on Query API
Signed-off-by: Nikhil Bhatia <nbhatia@microsoft.com>
2018-12-18 13:09:56 -08:00
Marco Sanvido 4c77f5f5a7 fix small typo
Signed-off-by: Marco Sanvido <marco@styra.com>
2018-12-18 09:47:22 -08:00
Torin Sandall 6af8da83ad Prepare v0.10.2 release
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-12-10 14:14:51 -08:00
Torin Sandall 2d425494aa Refactor discovery implementation
These changes refactor the discovery implementation a bit to improve
test coverage and remove duplication of common logic shared with the
bundle plugin.

Specifically, the downloading logic has been moved into a separate
package that is shared by bundle and discovery. Second, test coverage in
the discovery implementation is increased from ~15% to ~85%.

These changes also include a few functional improvements:

- The default decision paths can be updated dynamically
- The decision logger can be enabled dynamically
- Discovery downloading errors are reported in status updates
- Discovery bundle is evaluated with all runtime params
- Custom plugins can be created dynamically
- Status updates include both discovery and bundle status

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-12-08 00:45:36 +01:00
Marco Sanvido a73e3bacc8 Fix docs: rest api security link was incorrect
Signed-off-by: Marco Sanvido <marco@styra.com>
2018-12-04 07:51:47 -08:00
Ashutosh Narkar 2185f1eb86 Add support for configuration discovery
Previously OPA configuration for bundle downloading, status reporting, etc. had to be supplied in a configuration file on startup. With these changes, OPA can be configured to download a bundle that generates the OPA configuration. This allows OPA to boot with minimal configuration and dynamically update that configuration on-the-fly making it much easier to manage large deployments of OPAs for different use cases within the same system.

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2018-11-29 09:19:58 -08:00
Torin Sandall ce9a6e0c9a Update docs build process for new front page
These changes just update the build process for the new front page. As
part of these changes, the build should now be run under the host user
account instead of as root (this fixes the issue for site build
artifacts being owned by root.) To make that work the gitbook and npm
directories used by the docs build process need to be located under the
root directory so that they're writable by the user.

With these changes, the first time you build the site locally gitbook
needs to be installed but after that it's cached locally in the .gitbook
directory (so subsequent builds are fast when coupled with the vendored
node_modules for the gitbook plugins).

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-11-26 15:10:14 -08:00
Torin Sandall fa9ae9437c Vendor node_modules for gitbook
The gitbook install has been incredibly flaky due to it's dependency on
npm. This commit simply vendors the node_modules so that each time we
build the site the process doesn't have to re-run gitbook install.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-11-26 15:10:14 -08:00
Torin Sandall 3b624b67d5 Update .gitignore for docs
We no longer create an extra docs directory and the node_modules are
going to get vendored so update .gitignore accordingly.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-11-26 15:10:14 -08:00
Torin Sandall 7b524762b8 Update data filtering example
Remove the API authorization portion of the policy as it's not relevant
in the example.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-11-26 15:10:14 -08:00
Mikol Graves bb33db8890 Refresh OPA front page
These changes update the front page of the openpolicyagent.org site. Specifically:

- Replace empty-calorie content with example use cases
- Eliminate gulp and sccs
- Add scroll-to and -back functionality
- Rocking boat

Overall these changes make the site easier to build and provide a more interesting overview of what users can do with OPA today.

Signed-off-by: Mikol Graves <mikol@thinbox.org>
2018-11-26 10:15:22 -08:00
Stephan Renatus 556486f03c book(language reference): fix "alteration" typo
Signed-off-by: Stephan Renatus <srenatus@chef.io>
2018-11-16 10:45:10 -08:00
Torin Sandall f7eefff23a docs: Add decision ID note in API docs
When decision logging is enabled, API calls for decisions will return a
decision ID, e.g., {"result": true, "decision_id": "abcdef1234"}.

Fixes #1061

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-11-09 15:07:08 -08:00
Torin Sandall 20831e9e69 Mark diagnostics feature as deprecated
In a later release we will remove the feature entirely.

Ref: #1052

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-11-01 13:12:47 -07:00
Torin Sandall 95fca8239e Add note to configuration reference about -c flag
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-11-01 09:08:57 -07:00
Torin Sandall 6c39555de1 Prepare v0.10.1 release
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-10-30 13:25:17 -07:00
Stephan Renatus e20786e23c docs(rest-api): remove '{: .opa-tip}'
This didn't look like it was processed in any way, and showed up as-is
on the website.

Signed-off-by: Stephan Renatus <srenatus@chef.io>
2018-10-30 08:03:26 -07:00
Torin Sandall 61420f8e71 Add support for specifying services as object (#1046)
* Fix typo in run short description

Signed-off-by: Torin Sandall <torinsandall@gmail.com>

* Add support for specifying services as object

Previously the services configuration had to be specified as an array,
for example:

services:
- name: foo
  url: https://example.com

In some cases, it's easier to structure the configuration as an object.
Specifically, the Helm package manager does not allow you to override
values nested under arrays. These changes allow the services
configuration to be structured as an object:

services:
  foo:
    url: https://example.com

Ref: https://github.com/helm/helm/issues/1987

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-10-30 08:02:30 -07:00
repenno 9701436b17 Removing profiler.md which is deprecated
Fixes #1045 

Signed-off-by: repenno <rapenno@gmail.com>
2018-10-29 10:06:29 -07:00
arekkas ec505cc837 Introduce glob built-ins
This patch introduces built-ins `glob.match` and `glob.quote_meta`.

Closes #965

Signed-off-by: arekkas <aeneas@ory.am>
2018-10-29 09:37:34 -07:00
Torin Sandall dbf54cde4e Prepare v0.10.0 release
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-10-25 11:05:57 -07:00
Kim Christensen 63f86ec7cf Update documentation
Signed-off-by: Kim Christensen <kimworking@gmail.com>
2018-10-24 21:53:05 -07:00
Ashutosh Narkar b9099f6ef5 Update with keyword description to include data as a target (#1023)
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2018-10-22 16:07:29 -07:00
Torin Sandall b95227688b Add default decision configuration
Previously, OPA would serve POST requests with an empty URL path by
querying data.system.main and returning the generated value. In some
cases, it's useful to be able to reconfigure OPA to use a different
document to serve these kinds of requests. The same goes for the OPA
authorization policy.

These changes make the default decision and default authorization
decision paths configurable.

Signed-off-by: Torin Sandall <torinsandall@gmail.com>
2018-10-17 15:07:26 -07:00
Ashutosh Narkar 986d82fc4d Support for applying the with keyword to the data document (#996)
These changes make it possible to replace the data document.
Both base and virtual documents can be replaced. These changes support
replacing rules without arguments. They do not support replacing
rules/functions with arguments. To support that, we would need to take into
account the scenarios that would arise as a result of replacing the arguments
to the rule/function and the return value of the rule/function itself.

Fixes #517

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2018-10-17 10:53:46 -07:00