[go: nahoru, domu]

Skip to content

Commit

Permalink
Updated policy-library to use ancestries / excludedAncestries
Browse files Browse the repository at this point in the history
b/241296218
  • Loading branch information
melinath committed Aug 3, 2022
1 parent 5538c63 commit d651f47
Show file tree
Hide file tree
Showing 171 changed files with 257 additions and 257 deletions.
6 changes: 3 additions & 3 deletions bundler/test-data/common/sink/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
exclude: [] # optional, default is no exclusions
ancestries: ["organization/*"]
excludedAncestries: [] # optional, default is no exclusions
parameters: {}
- apiVersion: constraints.gatekeeper.sh/v1alpha1
kind: GCPRestrictedFirewallRulesConstraintV1
Expand All @@ -25,7 +25,7 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
ancestries: ["organization/*"]
parameters:
rules:
- direction: "INGRESS"
Expand Down
6 changes: 3 additions & 3 deletions bundler/test-data/common/source/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
exclude: [] # optional, default is no exclusions
ancestries: ["organization/*"]
excludedAncestries: [] # optional, default is no exclusions
parameters: {}
- apiVersion: constraints.gatekeeper.sh/v1alpha1
kind: GCPRestrictedFirewallRulesConstraintV1
Expand All @@ -25,7 +25,7 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
ancestries: ["organization/*"]
parameters:
rules:
- direction: "INGRESS"
Expand Down
10 changes: 5 additions & 5 deletions bundler/test-data/common/source/invalid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
exclude: [] # optional, default is no exclusions
ancestries: ["organization/*"]
excludedAncestries: [] # optional, default is no exclusions
parameters: {}
- kind: GCPRestrictedFirewallRulesConstraintV1
metadata:
Expand All @@ -24,7 +24,7 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
ancestries: ["organization/*"]
parameters:
rules:
- direction: "INGRESS"
Expand All @@ -41,8 +41,8 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
exclude: []
ancestries: ["organization/*"]
excludedAncestries: []
parameters:
mode: denylist
assetType: bigquery.googleapis.com/Dataset
Expand Down
4 changes: 2 additions & 2 deletions bundler/test-data/generate-docs/source/samples_templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
ancestries: ["organization/*"]
parameters: {}
# Templates
- apiVersion: templates.gatekeeper.sh/v1alpha1
Expand All @@ -39,7 +39,7 @@ items:
openAPIV3Schema:
properties: {}
targets:
validation.gcp.forsetisecurity.org:
- target: "validation.gcp.forsetisecurity.org"
rego: | #INLINE("validator/always_violates.rego")
#
# Copyright 2018 Google LLC
Expand Down
10 changes: 5 additions & 5 deletions bundler/test-data/policy-bundle-flat-export/sink/samples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
exclude: [] # optional, default is no exclusions
ancestries: ["organization/*"]
excludedAncestries: [] # optional, default is no exclusions
parameters: {}
- apiVersion: constraints.gatekeeper.sh/v1alpha1
kind: GCPRestrictedFirewallRulesConstraintV1
Expand All @@ -27,7 +27,7 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
ancestries: ["organization/*"]
parameters:
rules:
- direction: "INGRESS"
Expand All @@ -46,8 +46,8 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
exclude: []
ancestries: ["organization/*"]
excludedAncestries: []
parameters:
mode: denylist
assetType: bigquery.googleapis.com/Dataset
Expand Down
10 changes: 5 additions & 5 deletions bundler/test-data/policy-bundle-flat-export/source/samples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
exclude: [] # optional, default is no exclusions
ancestries: ["organization/*"]
excludedAncestries: [] # optional, default is no exclusions
parameters: {}
- apiVersion: constraints.gatekeeper.sh/v1alpha1
kind: GCPRestrictedFirewallRulesConstraintV1
Expand All @@ -27,7 +27,7 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
ancestries: ["organization/*"]
parameters:
rules:
- direction: "INGRESS"
Expand All @@ -46,8 +46,8 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
exclude: []
ancestries: ["organization/*"]
excludedAncestries: []
parameters:
mode: denylist
assetType: bigquery.googleapis.com/Dataset
Expand Down
10 changes: 5 additions & 5 deletions bundler/test-data/policy-bundle/sink/samples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
exclude: [] # optional, default is no exclusions
ancestries: ["organization/*"]
excludedAncestries: [] # optional, default is no exclusions
parameters: {}
- apiVersion: constraints.gatekeeper.sh/v1alpha1
kind: GCPRestrictedFirewallRulesConstraintV1
Expand All @@ -25,7 +25,7 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
ancestries: ["organization/*"]
parameters:
rules:
- direction: "INGRESS"
Expand All @@ -43,8 +43,8 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
exclude: []
ancestries: ["organization/*"]
excludedAncestries: []
parameters:
mode: denylist
assetType: bigquery.googleapis.com/Dataset
Expand Down
10 changes: 5 additions & 5 deletions bundler/test-data/policy-bundle/source/samples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
exclude: [] # optional, default is no exclusions
ancestries: ["organization/*"]
excludedAncestries: [] # optional, default is no exclusions
parameters: {}
- apiVersion: constraints.gatekeeper.sh/v1alpha1
kind: GCPRestrictedFirewallRulesConstraintV1
Expand All @@ -25,7 +25,7 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
ancestries: ["organization/*"]
parameters:
rules:
- direction: "INGRESS"
Expand All @@ -43,8 +43,8 @@ items:
spec:
severity: high
match:
target: ["organization/*"]
exclude: []
ancestries: ["organization/*"]
excludedAncestries: []
parameters:
mode: denylist
assetType: bigquery.googleapis.com/Dataset
Expand Down
2 changes: 1 addition & 1 deletion docs/constraint_template_authoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ metadata:
spec:
severity: high
match:
target: ["organizations/**"]
ancestries: ["organizations/**"]
parameters:
mode: "allowlist"
instances:
Expand Down
16 changes: 8 additions & 8 deletions docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ metadata:
spec:
severity: # low, medium, or high
match:
target: [] # put the constraint application target here
exclude: [] # optional, default is no exclusions
ancestries: [] # put the constraint application ancestries here
excludedAncestries: [] # optional, default is no exclusions
parameters: # put the parameters defined in constraint template here
```

The <code><em>target</em></code> field is specified in a path-like format. It
The <code><em>ancestries</em></code> field is specified in a path-like format. It
specifies where in the GCP resources hierarchy the constraint is to be applied.
For example:

Expand Down Expand Up @@ -198,8 +198,8 @@ For example:
</tr>
</table>

The <code><em>exclude</em></code> field follows the same pattern and has
precedence over the <code><em>target</em></code> field. If a resource is in
The <code><em>excludedAncestries</em></code> field follows the same pattern and has
precedence over the <code><em>ancestries</em></code> field. If a resource is in
both, it will be excluded.

The schema of the <code><em>parameters</em></code> field is defined in the
Expand Down Expand Up @@ -245,7 +245,7 @@ metadata:
spec:
severity: high
match:
target: ["organizations/**"]
ancestries: ["organizations/**"]
parameters:
mode: "allowlist"
instances:
Expand Down Expand Up @@ -310,7 +310,7 @@ metadata:
spec:
severity: high
match:
target: ["organizations/**"]
ancestries: ["organizations/**"]
parameters:
domains:
- gserviceaccount.com
Expand Down Expand Up @@ -376,7 +376,7 @@ metadata:
spec:
severity: high
match:
target: ["organizations/**"]
ancestries: ["organizations/**"]
parameters:
domains:
- gserviceaccount.com
Expand Down
2 changes: 1 addition & 1 deletion samples/allowed_resource_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
spec:
severity: high
match:
target: # {"$ref":"#/definitions/io.k8s.cli.setters.target"}
ancestries:
- "organizations/**"
parameters:
mode: "denylist"
Expand Down
2 changes: 1 addition & 1 deletion samples/always_violates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ spec:
constraintVersion: 0.1.0
severity: high
match:
target: # {"$ref":"#/definitions/io.k8s.cli.setters.target"}
ancestries:
- "organizations/**"
parameters: {}
2 changes: 1 addition & 1 deletion samples/appengine_location.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
spec:
severity: high
match:
target: # {"$ref":"#/definitions/io.k8s.cli.setters.target"}
ancestries:
- "organizations/**"
parameters:
locations:
Expand Down
2 changes: 1 addition & 1 deletion samples/appengine_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ metadata:
installed.
spec:
match:
target: # {"$ref":"#/definitions/io.k8s.cli.setters.target"}
ancestries:
- "organizations/**"
parameters: {}
2 changes: 1 addition & 1 deletion samples/bigquery_cmek.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ metadata:
spec:
severity: high
match:
target: # {"$ref":"#/definitions/io.k8s.cli.setters.target"}
ancestries:
- "organizations/**"
parameters: {}
2 changes: 1 addition & 1 deletion samples/bigquery_table_retention.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ metadata:
spec:
severity: high
match:
target: # {"$ref":"#/definitions/io.k8s.cli.setters.target"}
ancestries:
- "organizations/**"
parameters:
minimum_retention_days: 100
Expand Down
2 changes: 1 addition & 1 deletion samples/cmek_rotation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ metadata:
spec:
severity: high
match:
target: # {"$ref":"#/definitions/io.k8s.cli.setters.target"}
ancestries:
- "organizations/**"
parameters:
# Optionally specify the required key rotation period. Default is 365 days
Expand Down
2 changes: 1 addition & 1 deletion samples/cmek_rotation_100_days.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ metadata:
spec:
severity: high
match:
target: # {"$ref":"#/definitions/io.k8s.cli.setters.target"}
ancestries:
- "organizations/**"
parameters:
# Optionally specify the required key rotation period. Default is 365 days
Expand Down
2 changes: 1 addition & 1 deletion samples/cmek_settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ metadata:
spec:
severity: high
match:
target: # {"$ref":"#/definitions/io.k8s.cli.setters.target"}
ancestries:
- "organizations/**"
parameters:
# Optionally specify the required key rotation period. Default is 365 days
Expand Down
4 changes: 2 additions & 2 deletions samples/compute_allowed_networks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ metadata:
spec:
severity: high
match:
target: # {"$ref":"#/definitions/io.k8s.cli.setters.target"}
- "organizations/**"
ancestries:
- "organizations/**"
parameters:
allowed:
- https://www.googleapis.com/compute/v1/projects/vpc-sc-pub-sub-billing-alerts/global/networks/default1
2 changes: 1 addition & 1 deletion samples/compute_block_ssh_keys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ metadata:
spec:
severity: high
match:
target: ["organization/*"]
ancestries: ["organization/*"]
parameters: {}
2 changes: 1 addition & 1 deletion samples/compute_enable_oslogin_project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ metadata:
spec:
severity: high
match:
target: ["organization/*"]
ancestries: ["organization/*"]
parameters: {}
2 changes: 1 addition & 1 deletion samples/dataproc_location.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ metadata:
spec:
severity: high
match:
target: # {"$ref":"#/definitions/io.k8s.cli.setters.target"}
ancestries:
- "organizations/**"
parameters:
locations:
Expand Down
2 changes: 1 addition & 1 deletion samples/enforce_label.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ metadata:
spec:
severity: high
match:
target: # {"$ref":"#/definitions/io.k8s.cli.setters.target"}
ancestries:
- "organizations/**"
parameters:
# required parameter: list of label objects that resources should have.
Expand Down
Loading

0 comments on commit d651f47

Please sign in to comment.