Skip to content

Commit

Permalink
🧹 update mql syntax (#1376)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-rock authored Jul 19, 2024
1 parent a13b709 commit e03ced3
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion apps/cnspec/cmd/policy-example.mql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ policies:
queries:
- uid: sshd-score-01
title: Ensure SSH MaxAuthTries is set to 4 or less
mql: sshd.config.params["MaxAuthTries"] <= 4
mql: sshd.config.params.MaxAuthTries <= 4
docs:
desc: |
The MaxAuthTries parameter specifies the maximum number of authentication attempts permitted per connection.
Expand Down
6 changes: 3 additions & 3 deletions examples/complex.mql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ policies:
checks:
- uid: sshd-01
title: Set the port to 22
query: sshd.config.params["Port"] == 22
query: sshd.config.params.Port == 22
severity: 30

- uid: sshd-02
title: Configure the address family
query: sshd.config.params["AddressFamily"] == /inet|inet6|any/
query: sshd.config.params.AddressFamily == /inet|inet6|any/
severity: 40

- uid: sshd-03
title: Enable strict mode
query: sshd.config.params["StrictModes"] == "yes"
query: sshd.config.params.StrictModes == "yes"
severity: 70

# This is a second policy in the same bundle
Expand Down
2 changes: 1 addition & 1 deletion examples/directory/queries/sshd-01.mql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ queries:
- uid: sshd-01
title: Set the port to 22
severity: 30
query: sshd.config.params["Port"] == 22
query: sshd.config.params.Port == 22
2 changes: 1 addition & 1 deletion examples/directory/queries/sshd-02.mql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ queries:
- uid: sshd-02
title: Configure the address family
severity: 40
query: sshd.config.params["AddressFamily"] == /inet|inet6|any/
query: sshd.config.params.AddressFamily == /inet|inet6|any/
2 changes: 1 addition & 1 deletion examples/directory/queries/sshd-03.mql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ queries:
- uid: sshd-03
title: Enable strict mode
severity: 70
query: sshd.config.params["StrictModes"] == "yes"
query: sshd.config.params.StrictModes == "yes"
4 changes: 2 additions & 2 deletions examples/example.mql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ policies:
# final score of this policy.
- uid: sshd-01
title: Ensure the port is set to 22
mql: sshd.config.params["Port"] == 22
mql: sshd.config.params.Port == 22
# Impact is used for scoring. 100 = critical. 0 = informational.
impact: 30

Expand Down Expand Up @@ -69,5 +69,5 @@ queries:
# The title helps in printing.
- uid: shared-query
title: Enable strict mode
mql: sshd.config.params["StrictModes"] == "yes"
mql: sshd.config.params.StrictModes == "yes"
impact: 70
6 changes: 3 additions & 3 deletions internal/bundle/testdata/failing_lint.mql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ policies:
- checks:
- uid: sshd-01
title: Ensure the port is set to 22
mql: sshd.config.params["Port"] == 22
mql: sshd.config.paramsPort == 22
impact: 30

- uid: sshd-02
Expand Down Expand Up @@ -40,8 +40,8 @@ policies:
queries:
- uid: shared-query
title: Enable strict mode
mql: sshd.config.params["StrictModes"] == "yes"
mql: sshd.config.params.StrictModes == "yes"
impact: 70
- uid: unreferenced-query
title: Query not assigned to Policy
mql: sshd.config.params["UsePAM"] == "yes"
mql: sshd.config.params.UsePAM == "yes"

0 comments on commit e03ced3

Please sign in to comment.