mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
docs: Update regal and blog links (#8901)
Updates to latest regal release and makes some changes to blog.openpolicyagent.org links too. --------- Signed-off-by: Charlie Egan <charlie_egan@apple.com>
This commit is contained in:
@@ -11,9 +11,10 @@ sidebar_label: Architecture
|
||||
|
||||
Or "How does Regal work?"
|
||||
|
||||
As you might have [read](https://web.archive.org/web/https://www.styra.com/blog/guarding-the-guardrails-introducing-regal-the-rego-linter/), Regal
|
||||
[uses Rego for linting Rego](https://web.archive.org/web/https://www.styra.com/blog/linting-rego-with-rego/) — or rather, Rego policies turned into
|
||||
a JSON representation of their abstract syntax tree (AST).
|
||||
As you might have
|
||||
[read](https://web.archive.org/web/https://www.styra.com/blog/guarding-the-guardrails-introducing-regal-the-rego-linter/),
|
||||
Regal [uses Rego for linting Rego](https://web.archive.org/web/https://www.styra.com/blog/linting-rego-with-rego/) — or rather,
|
||||
Rego policies turned into a JSON representation of their abstract syntax tree (AST).
|
||||
|
||||
## High-level Overview
|
||||
|
||||
@@ -45,7 +46,8 @@ The main entrypoint for Rego rule evaluation is unsurprisingly found in
|
||||
rule from the [Go](https://github.com/open-policy-agent/regal/blob/main/pkg/linter/linter.go) application.
|
||||
|
||||
The `report` rule in turn uses
|
||||
[dynamic policy composition](https://web.archive.org/web/https://www.styra.com/blog/dynamic-policy-composition-for-opa/) to query all rules named
|
||||
[dynamic policy composition](https://web.archive.org/web/https://www.styra.com/blog/dynamic-policy-composition-for-opa/)
|
||||
to query all rules named
|
||||
`report` under `data.regal.rules[category][title]` for built-in rules, and `data.custom.regal.rules[category][title]`
|
||||
for custom rules. The violations reported from each rule is added to the `report` set and sent back to the application,
|
||||
which will compile a final report and present it to the user.
|
||||
|
||||
@@ -286,11 +286,10 @@ Documentation: https://www.openpolicyagent.org/projects/regal/rules/style/prefer
|
||||
<!-- markdownlint-restore -->
|
||||
<br />
|
||||
|
||||
:::note
|
||||
If you're running Regal on an existing policy library, you may want to disable the `style` category initially, as it
|
||||
will likely generate a lot of violations. You can do this by passing the `--disable-category style` flag to
|
||||
`regal lint`.
|
||||
:::
|
||||
> **Note**
|
||||
> If you're running Regal on an existing policy library, you may want to disable the `style` category initially, as it
|
||||
> will likely generate a lot of violations. You can do this by passing the `--disable-category style` flag to
|
||||
> `regal lint`.
|
||||
|
||||
### Using Regal in Your Editor
|
||||
|
||||
|
||||
@@ -142,9 +142,24 @@ be suggestions for:
|
||||
src={require('./assets/lsp/completion.png').default}
|
||||
alt="Screenshot of completion suggestions as displayed in Zed"/>
|
||||
|
||||
New completion providers are added continuously, so if you have a suggestion for
|
||||
a new completion, please
|
||||
[open an issue](https://github.com/open-policy-agent/regal/issues)!
|
||||
New completion providers are added continuously, so if you have a suggestion for a new completion, please
|
||||
[file an issue](https://github.com/open-policy-agent/regal/issues)!
|
||||
|
||||
#### Editor support
|
||||
|
||||
VS Code currently prevents (or severely limits) displaying suggestions from language servers like Regal whenever
|
||||
GitHub Copilot's "ghost text suggestions" feature is enabled. Since this feature is typically enabled — possibly even by
|
||||
default, many users risk missing out on code completions provided by language servers without even realizing it. Whether
|
||||
overriding language server suggestions is intentional or not is currently unclear, as
|
||||
[the issue](https://github.com/microsoft/vscode/issues/315257) has been reported but not yet addressed by the VS Code
|
||||
maintainers.
|
||||
|
||||
While AI-assisted suggestions occasionally can be helpful, they aren't based on the same deep understanding of the
|
||||
language or the context as those provided by language servers. Unless you heavily rely on GitHub Copilot's suggestions,
|
||||
**we recommend disabling the "ghost text suggestions" feature as long as Copilot is overriding language server
|
||||
suggestions**.
|
||||
|
||||
The toggle is easily accessible from the UI, so you can even turn it on and off as needed.
|
||||
|
||||
### Code actions
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ Runs Regal against all staged `.rego` files, aborting the commit if any fail.
|
||||
|
||||
Runs Regal against all staged `.rego` files, aborting the commit if any fail.
|
||||
|
||||
- Downloads the latest `regal` binary from GitHub.
|
||||
- Downloads the latest `regal` binary from Github.
|
||||
|
||||
### `regal-fix`
|
||||
|
||||
@@ -77,4 +77,4 @@ Same as `regal-fix`, but uses the `regal` binary already on `$PATH`.
|
||||
|
||||
Same as `regal-fix`, but downloads the latest `regal` binary from GitHub instead of building or relying on `$PATH`.
|
||||
|
||||
- Downloads the latest `regal` binary from GitHub.
|
||||
- Downloads the latest `regal` binary from Github.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# deprecated-builtin
|
||||
|
||||
**Summary**: Deprecated built-in function
|
||||
**Summary**: Avoid using deprecated built-in functions
|
||||
|
||||
**Category**: Bugs
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# disallow-rego-v1
|
||||
|
||||
**Summary**: Use of disallowed `import rego v1`
|
||||
**Summary**: Use of disallowed `import rego.v1`
|
||||
|
||||
**Category**: Custom
|
||||
|
||||
|
||||
@@ -47,6 +47,9 @@ rules:
|
||||
#
|
||||
# one of "error", "warning", "ignore"
|
||||
level: error
|
||||
# maximum line length for a rule to be suggested as a one-liner
|
||||
# default: 120
|
||||
max-line-length: 120
|
||||
```
|
||||
|
||||
## Related Resources
|
||||
|
||||
@@ -44,7 +44,8 @@ user_roles_mapping[user] := roles if {
|
||||
|
||||
## Rationale
|
||||
|
||||
Comprehensions are [awesome](https://web.archive.org/web/https://www.styra.com/blog/five-things-you-didnt-know-about-opa/), and should be part of
|
||||
Comprehensions are [awesome](https://web.archive.org/web/https://www.styra.com/blog/five-things-you-didnt-know-about-opa/),
|
||||
and should be part of
|
||||
any policy author's toolbox. Using comprehensions inside of rule bodies allow for a wide variety of elegant solutions to
|
||||
otherwise hard problems. However, when used as the value directly (and unconditionally) assigned to a rule, it is almost
|
||||
always better to use a rule that generates a set or object in the rule body rather than having a comprehension do so in
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# implicit-future-keywords
|
||||
|
||||
**Summary**: Implicit future keywords
|
||||
**Summary**: Avoid implicit future keyword imports
|
||||
|
||||
**Category**: Imports
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# import-shadows-import
|
||||
|
||||
**Summary**: Import shadows import
|
||||
**Summary**: Import shadows another import
|
||||
|
||||
**Category**: Imports
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# non-loop-expression
|
||||
|
||||
**Summary**: Non loop expression in loop
|
||||
**Summary**: Non-loop expression in loop
|
||||
|
||||
**Category**: Performance
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ considered OK, and the `double-negative` rule is limited to check for a limited
|
||||
- `not no_`
|
||||
- `not non_`
|
||||
- `not not_`,
|
||||
- `not without_`
|
||||
|
||||
## Configuration Options
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# todo-comment
|
||||
|
||||
**Summary**: Avoid TODO Comments
|
||||
**Summary**: Avoid TODO and FIXME comments
|
||||
|
||||
**Category**: Style
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
```rego
|
||||
package policy
|
||||
|
||||
# Using metasyntactic names
|
||||
foo := ["bar", "baz"]
|
||||
# Using metasyntactic name
|
||||
foo := ["developer", "admin"]
|
||||
|
||||
# ...
|
||||
```
|
||||
@@ -18,7 +18,7 @@ foo := ["bar", "baz"]
|
||||
```rego
|
||||
package policy
|
||||
|
||||
# Using names relevant to the context
|
||||
# Using name relevant to the context
|
||||
roles := ["developer", "admin"]
|
||||
|
||||
# ...
|
||||
|
||||
@@ -15,7 +15,7 @@ code:
|
||||
inventors:
|
||||
- styra
|
||||
blogs:
|
||||
- https://blog.openpolicyagent.org/envoy-external-authorization-with-opa-578213ed567c
|
||||
- https://openpolicyagent.org/blog/envoy-external-authorization-with-opa-578213ed567c
|
||||
videos:
|
||||
- title: 'OPA at Scale: How Pinterest Manages Policy Distribution'
|
||||
speakers:
|
||||
|
||||
@@ -78,7 +78,7 @@ videos:
|
||||
blogs:
|
||||
- https://medium.com/@sbueringer/kubernetes-authorization-via-open-policy-agent-a9455d9d5ceb
|
||||
- https://medium.com/@jimmy.ray/policy-enabled-kubernetes-with-open-policy-agent-3b612b3f0203
|
||||
- https://blog.openpolicyagent.org/securing-the-kubernetes-api-with-open-policy-agent-ce93af0552c3
|
||||
- https://openpolicyagent.org/blog/securing-the-kubernetes-api-with-open-policy-agent-ce93af0552c3
|
||||
- https://itnext.io/kubernetes-authorization-via-open-policy-agent-a9455d9d5ceb
|
||||
- https://medium.com/capital-one-tech/policy-enabled-kubernetes-with-open-policy-agent-3b612b3f0203
|
||||
- https://www.redhat.com/en/blog/fine-grained-policy-enforcement-in-openshift-with-open-policy-agent
|
||||
|
||||
@@ -10,8 +10,8 @@ labels:
|
||||
code:
|
||||
- https://play.openpolicyagent.org/
|
||||
blogs:
|
||||
- https://blog.openpolicyagent.org/the-rego-playground-977566855cec
|
||||
- https://blog.openpolicyagent.org/rego-playground-new-features-ec0345a73b9e
|
||||
- https://openpolicyagent.org/blog/the-rego-playground-977566855cec
|
||||
- https://openpolicyagent.org/blog/rego-playground-new-features-ec0345a73b9e
|
||||
docs_features:
|
||||
learning-rego:
|
||||
note: |
|
||||
|
||||
@@ -8,7 +8,7 @@ software:
|
||||
code:
|
||||
- https://github.com/open-policy-agent/contrib/tree/main/data_filter_example
|
||||
blogs:
|
||||
- https://blog.openpolicyagent.org/write-policy-in-opa-enforce-policy-in-sql-d9d24db93bf4
|
||||
- https://openpolicyagent.org/blog/write-policy-in-opa-enforce-policy-in-sql-d9d24db93bf4
|
||||
inventors:
|
||||
- styra
|
||||
---
|
||||
|
||||
@@ -8,7 +8,7 @@ labels:
|
||||
inventors:
|
||||
- Apple
|
||||
blogs:
|
||||
- "https://blog.openpolicyagent.org/introducing-swift-opa-native-policy-evaluation-for-swift-d5136c8a662e"
|
||||
- "https://openpolicyagent.org/blog/introducing-swift-opa-native-policy-evaluation-for-swift-d5136c8a662e"
|
||||
code:
|
||||
- "https://github.com/open-policy-agent/swift-opa"
|
||||
tutorials:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"slug": "2021",
|
||||
"title": "2021 OPA Community Survey",
|
||||
"year": 2021,
|
||||
"blog": "https://blog.openpolicyagent.org/open-policy-agent-2021-survey-summary-e749bbd7b824",
|
||||
"blog": "/blog/open-policy-agent-2021-survey-summary-e749bbd7b824",
|
||||
"intro": "This page presents selected results from the 2021 OPA Community Survey for comparison across years. For the full survey results and detailed analysis, please see the blog post.",
|
||||
"sections": [
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"slug": "2022",
|
||||
"title": "2022 OPA Community Survey",
|
||||
"year": 2022,
|
||||
"blog": "https://blog.openpolicyagent.org/open-policy-agent-2022-user-survey-summary-370cf0243bb7",
|
||||
"blog": "/blog/open-policy-agent-2022-user-survey-summary-370cf0243bb7",
|
||||
"intro": "This page presents selected results from the 2022 OPA Community Survey for comparison across years. For the full survey results and detailed analysis, please see the blog post.",
|
||||
"sections": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user