Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(workflow): add pattern validation for query name and description #7208

Merged
merged 65 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
7e3fe04
added pattern validation for query name and description
JulioSCX Jul 23, 2024
8f6eddb
renamed beta queries to account for new query validations
JulioSCX Jul 24, 2024
0244237
updated regex validations for consistency
JulioSCX Jul 29, 2024
a8adabe
Merge branch 'master' into add-pattern-validation-workflow
JulioSCX Jul 29, 2024
0629d11
update image
JulioSCX Jul 29, 2024
ef22972
update image
JulioSCX Jul 29, 2024
79a972f
changing error output
JulioSCX Jul 29, 2024
7918ebe
docker changes test
JulioSCX Jul 29, 2024
47dd1b0
docker changes test
JulioSCX Jul 29, 2024
e701436
docker changes test
JulioSCX Jul 29, 2024
e39b2da
docker changes test
JulioSCX Jul 29, 2024
bad329c
docker changes test
JulioSCX Jul 29, 2024
a0d75ea
docker changes test
JulioSCX Jul 29, 2024
ad75215
docker changes test
JulioSCX Jul 29, 2024
0db27df
docker changes test
JulioSCX Jul 29, 2024
10fbda1
docker changes test
JulioSCX Jul 29, 2024
92d5f0e
docker changes test
JulioSCX Jul 29, 2024
bcda3bd
docker changes test
JulioSCX Jul 29, 2024
173bfac
docker changes test
JulioSCX Jul 29, 2024
1a22be3
docker changes test
JulioSCX Jul 29, 2024
de84a6b
docker changes test
JulioSCX Jul 29, 2024
07849c6
updated chainguard
JulioSCX Jul 30, 2024
a3a32e1
update chainguard
JulioSCX Jul 30, 2024
59445f2
Merge branch 'master' into add-pattern-validation-workflow
JulioSCX Jul 30, 2024
68c03a5
dockerfile test
JulioSCX Jul 30, 2024
2f6ddef
Merge branch 'add-pattern-validation-workflow' of https://github.com/…
JulioSCX Jul 30, 2024
13a21b2
reverted tests
JulioSCX Jul 30, 2024
1c914e4
dockerfile test
JulioSCX Jul 30, 2024
83fed48
revert test changes
JulioSCX Jul 30, 2024
23a986c
test busybox image
JulioSCX Jul 30, 2024
ae382da
revert test changes
JulioSCX Jul 30, 2024
b6dad27
reverted chainguard go image
JulioSCX Jul 30, 2024
c507df7
update chainguard go
JulioSCX Jul 30, 2024
253008c
removed output to see error message
JulioSCX Jul 30, 2024
b0429ef
check user in workflow
JulioSCX Jul 30, 2024
0a08194
test output folder creation
JulioSCX Jul 30, 2024
5f8d8e2
test remove chmod
JulioSCX Jul 30, 2024
f6028ad
changed to chainguard latest
JulioSCX Jul 30, 2024
33fd522
added chmod back
JulioSCX Jul 30, 2024
b9948da
added back tests and reverted output results changes
JulioSCX Jul 30, 2024
653a814
changed back to root chainguard
JulioSCX Jul 30, 2024
e8c964f
removed test
JulioSCX Jul 30, 2024
b950bec
testing 041
JulioSCX Jul 30, 2024
bb26a4b
Merge branch 'add-pattern-validation-workflow' of https://github.com/…
JulioSCX Jul 30, 2024
05d3a5d
Merge branch 'add-pattern-validation-workflow' of https://github.com/…
JulioSCX Jul 30, 2024
bb75d7c
restore 041
JulioSCX Jul 30, 2024
355fad9
Merge branch 'add-pattern-validation-workflow' of https://github.com/…
JulioSCX Jul 30, 2024
f92c258
restore file
JulioSCX Jul 30, 2024
227d703
restore file
JulioSCX Jul 31, 2024
0c22c0d
removed results file
JulioSCX Jul 31, 2024
3fa5375
restore all tests
JulioSCX Jul 31, 2024
15d9c35
apk add sed
JulioSCX Jul 31, 2024
969b90c
sed version
JulioSCX Jul 31, 2024
5b0e731
apk update
JulioSCX Jul 31, 2024
e1deb7b
remove sed version
JulioSCX Jul 31, 2024
7b05207
test git latest-dev
JulioSCX Jul 31, 2024
bf85b1d
removed tests
JulioSCX Jul 31, 2024
ad4df77
added back results json
JulioSCX Jul 31, 2024
f10b074
added back all tests
JulioSCX Jul 31, 2024
14bd950
upgrade docker
JulioSCX Aug 1, 2024
c47a981
upgrade docker to 26.1.4
JulioSCX Aug 1, 2024
7e269cb
upgrade docker to v26.1.5
JulioSCX Aug 1, 2024
cff8d3a
git latest root dev
JulioSCX Aug 1, 2024
a01af2c
removed unnecessary folder creation
JulioSCX Aug 1, 2024
d17d03e
deleted cxone action
JulioSCX Aug 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .github/scripts/queries-validator/metadata-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
"minLength": 1,
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-4{1}[a-f0-9]{3}-[89ab]{1}[a-f0-9]{3}-[a-f0-9]{12}$"
},
"description_text_pattern": {
"type": "string",
"minLength": 1,
"pattern": "^.{1,500}$"
},
"query_name_pattern": {
"type": "string",
"minLength": 1,
"pattern": "^[a-zA-Z][a-zA-Z0-9_ \\-\"',:$.()]{0,119}$"
},
"description_id_pattern": {
"type": "string",
"minLength": 1,
Expand All @@ -29,8 +39,9 @@
"$ref": "#/definitions/query_id_pattern"
},
"queryName": {
"$ref": "#/definitions/query_name_pattern",
"type": "string",
"minLength": 8,
"minLength": 1,
"maxLength": 120
},
"severity": {
Expand Down Expand Up @@ -75,8 +86,9 @@
]
},
"descriptionText": {
"$ref": "#/definitions/description_text_pattern",
"type": "string",
"minLength": 16,
"minLength": 1,
"maxLength" : 500
},
"descriptionUrl": {
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/cxone.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM cgr.dev/chainguard/go@sha256:54b74a40acfc93d62bd32c72e3afe19bc55e4b2db7baa09d5950f3e5878baf28 as build_env
FROM cgr.dev/chainguard/go@sha256:74bc9af1d45fd1c8d432a89148c5e413711204636b54ca05197b511bea7a18fb as build_env

# Copy the source from the current directory to the Working Directory inside the container
WORKDIR /app
Expand Down Expand Up @@ -31,7 +31,7 @@ USER nonroot
# Runtime image
# Ignore no User Cmd since KICS container is stopped afer scan
# kics-scan ignore-line
FROM cgr.dev/chainguard/git@sha256:f3ed07723172f93a50715cf6189be7c7526232ff88035e3eb24046bfffeb8f5c
FROM cgr.dev/chainguard/git@sha256:8aca2e237da593d9326eb47aef652b3f4721b533b3b0f19cf62c3bbe1e8ec45d

ENV TERM xterm-256color

Expand All @@ -49,4 +49,4 @@ WORKDIR /app/bin
ENV PATH $PATH:/app/bin

# Command to run the executable
ENTRYPOINT ["/app/bin/kics"]
ENTRYPOINT ["/app/bin/kics"]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "953c0cc6-5f30-44cb-a803-bf4ef2571be8",
"queryName": "(Beta) Databricks Autoscale Badly Setup",
"queryName": "Beta - Databricks Autoscale Badly Setup",
"severity": "MEDIUM",
"category": "Resource Management",
"descriptionText": "Databricks should have min and max worker setup for autoscale",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[
{
"queryName": "(Beta) Databricks Autoscale Badly Setup",
"queryName": "Beta - Databricks Autoscale Badly Setup",
"severity": "MEDIUM",
"line": 6,
"fileName": "positive1.tf"
},
{
"queryName": "(Beta) Databricks Autoscale Badly Setup",
"queryName": "Beta - Databricks Autoscale Badly Setup",
"severity": "MEDIUM",
"line": 6,
"fileName": "positive2.tf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "b0749c53-e3ff-4d09-bbe4-dca94e2e7a38",
"queryName": "(Beta) Check Databricks Cluster AWS Attribute Best Practices",
"queryName": "Beta - Check Databricks Cluster AWS Attribute Best Practices",
"severity": "LOW",
"category": "Best Practices",
"descriptionText": "One or some Databricks Cluster AWS Attribute Best Practices are not respected",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[
{
"queryName": "(Beta) Check Databricks Cluster AWS Attribute Best Practices",
"queryName": "Beta - Check Databricks Cluster AWS Attribute Best Practices",
"severity": "LOW",
"line": 11,
"fileName": "positive1.tf"
},
{
"queryName": "(Beta) Check Databricks Cluster AWS Attribute Best Practices",
"queryName": "Beta - Check Databricks Cluster AWS Attribute Best Practices",
"severity": "LOW",
"line": 13,
"fileName": "positive2.tf"
},
{
"queryName": "(Beta) Check Databricks Cluster AWS Attribute Best Practices",
"queryName": "Beta - Check Databricks Cluster AWS Attribute Best Practices",
"severity": "LOW",
"line": 10,
"fileName": "positive3.tf"
},
{
"queryName": "(Beta) Check Databricks Cluster AWS Attribute Best Practices",
"queryName": "Beta - Check Databricks Cluster AWS Attribute Best Practices",
"severity": "LOW",
"line": 12,
"fileName": "positive4.tf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "38028698-e663-4ef7-aa92-773fef0ca86f",
"queryName": "(Beta) Check Databricks Cluster Azure Attribute Best Practices",
"queryName": "Beta - Check Databricks Cluster Azure Attribute Best Practices",
"severity": "LOW",
"category": "Best Practices",
"descriptionText": "One or some Databricks Cluster Azure Attribute Best Practices are not respected",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[
{
"queryName": "(Beta) Check Databricks Cluster Azure Attribute Best Practices",
"queryName": "Beta - Check Databricks Cluster Azure Attribute Best Practices",
"severity": "LOW",
"line": 11,
"fileName": "positive1.tf"
},
{
"queryName": "(Beta) Check Databricks Cluster Azure Attribute Best Practices",
"queryName": "Beta - Check Databricks Cluster Azure Attribute Best Practices",
"severity": "LOW",
"line": 12,
"fileName": "positive2.tf"
},
{
"queryName": "(Beta) Check Databricks Cluster Azure Attribute Best Practices",
"queryName": "Beta - Check Databricks Cluster Azure Attribute Best Practices",
"severity": "LOW",
"line": 10,
"fileName": "positive3.tf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "539e4557-d2b5-4d57-a001-cb01140a4e2d",
"queryName": "(Beta) Check Databricks Cluster GCP Attribute Best Practices",
"queryName": "Beta - Check Databricks Cluster GCP Attribute Best Practices",
"severity": "LOW",
"category": "Best Practices",
"descriptionText": "One or some Databricks Cluster GCP Attribute Best Practices are not respected",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"queryName": "(Beta) Check Databricks Cluster GCP Attribute Best Practices",
"queryName": "Beta - Check Databricks Cluster GCP Attribute Best Practices",
"severity": "LOW",
"line": 11,
"fileName": "positive1.tf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "a4edb7e1-c0e0-4f7f-9d7c-d1b603e81ad5",
"queryName": "(Beta) Databricks Cluster or Job With None Or Insecure Permission(s)",
"queryName": "Beta - Databricks Cluster or Job With None Or Insecure Permission(s)",
"severity": "HIGH",
"category": "Insecure Configurations",
"descriptionText": "Databricks Cluster and Job must have restricted permissions",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[
{
"queryName": "(Beta) Databricks Cluster or Job With None Or Insecure Permission(s)",
"queryName": "Beta - Databricks Cluster or Job With None Or Insecure Permission(s)",
"severity": "HIGH",
"line": 16,
"fileName": "positive1.tf"
},
{
"queryName": "(Beta) Databricks Cluster or Job With None Or Insecure Permission(s)",
"queryName": "Beta - Databricks Cluster or Job With None Or Insecure Permission(s)",
"severity": "HIGH",
"line": 12,
"fileName": "positive2.tf"
},
{
"queryName": "(Beta) Databricks Cluster or Job With None Or Insecure Permission(s)",
"queryName": "Beta - Databricks Cluster or Job With None Or Insecure Permission(s)",
"severity": "HIGH",
"line": 16,
"fileName": "positive3.tf"
},
{
"queryName": "(Beta) Databricks Cluster or Job With None Or Insecure Permission(s)",
"queryName": "Beta - Databricks Cluster or Job With None Or Insecure Permission(s)",
"severity": "HIGH",
"line": 16,
"fileName": "positive4.tf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "23c3067a-8cc9-480c-b645-7c1e0ad4bf60",
"queryName": "(Beta) Databricks Group Without User Or Instance Profile",
"queryName": "Beta - Databricks Group Without User Or Instance Profile",
"severity": "LOW",
"category": "Access Control",
"descriptionText": "Databricks Group should have at least one user or one instance profile associated",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[
{
"queryName": "(Beta) Databricks Group Without User Or Instance Profile",
"queryName": "Beta - Databricks Group Without User Or Instance Profile",
"severity": "LOW",
"line": 16,
"fileName": "positive1.tf"
},
{
"queryName": "(Beta) Databricks Group Without User Or Instance Profile",
"queryName": "Beta - Databricks Group Without User Or Instance Profile",
"severity": "LOW",
"line": 14,
"fileName": "positive2.tf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "23e1f5f0-12b7-4d7e-9087-f60f42ccd514",
"queryName": "(Beta) Indefinitely Databricks OBO Token Lifetime",
"queryName": "Beta - Indefinitely Databricks OBO Token Lifetime",
"severity": "MEDIUM",
"category": "Insecure Defaults",
"descriptionText": "OBO Token has an indefinitely lifetime",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"queryName": "(Beta) Indefinitely Databricks OBO Token Lifetime",
"queryName": "Beta - Indefinitely Databricks OBO Token Lifetime",
"severity": "MEDIUM",
"line": 1,
"fileName": "positive.tf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "7d05ca25-91b4-42ee-b6f6-b06611a87ce8",
"queryName": "(Beta) Indefinitely Databricks Token Lifetime",
"queryName": "Beta - Indefinitely Databricks Token Lifetime",
"severity": "MEDIUM",
"category": "Insecure Defaults",
"descriptionText": "Token has an indefinitely lifetime",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"queryName": "(Beta) Indefinitely Databricks Token Lifetime",
"queryName": "Beta - Indefinitely Databricks Token Lifetime",
"severity": "MEDIUM",
"line": 1,
"fileName": "positive.tf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "2c4fe4a9-f44b-4c70-b09b-5b75cd251805",
"queryName": "(Beta) Unrestricted Databricks ACL",
"queryName": "Beta - Unrestricted Databricks ACL",
"severity": "HIGH",
"category": "Networking and Firewall",
"descriptionText": "ACL allow ingress from 0.0.0.0/0 and/or ::/0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[
{
"queryName": "(Beta) Unrestricted Databricks ACL",
"queryName": "Beta - Unrestricted Databricks ACL",
"severity": "HIGH",
"line": 10,
"fileName": "positive1.tf"
},
{
"queryName": "(Beta) Unrestricted Databricks ACL",
"queryName": "Beta - Unrestricted Databricks ACL",
"severity": "HIGH",
"line": 10,
"fileName": "positive2.tf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "5a627dfa-a4dd-4020-a4c6-5f3caf4abcd6",
"queryName": "(Beta) Check use no LTS Spark Version",
"queryName": "Beta - Check use no LTS Spark Version",
"severity": "LOW",
"category": "Best Practices",
"descriptionText": "Spark Version is not a Long-term Support",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[
{
"queryName": "(Beta) Check use no LTS Spark Version",
"queryName": "Beta - Check use no LTS Spark Version",
"severity": "LOW",
"line": 8,
"fileName": "positive1.tf"
},
{
"queryName": "(Beta) Check use no LTS Spark Version",
"queryName": "Beta - Check use no LTS Spark Version",
"severity": "LOW",
"line": 11,
"fileName": "positive2.tf"
},
{
"queryName": "(Beta) Check use no LTS Spark Version",
"queryName": "Beta - Check use no LTS Spark Version",
"severity": "LOW",
"line": 10,
"fileName": "positive3.tf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "375cdab9-3f94-4ae0-b1e3-8fbdf9cdf4d7",
"queryName": "(Beta) Job's Task is Legacy (spark_submit_task)",
"queryName": "Beta - Job's Task is Legacy (spark_submit_task)",
"severity": "MEDIUM",
"category": "Best Practices",
"descriptionText": "Job's Task Is spark_submit_task",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[
{
"queryName": "(Beta) Job's Task is Legacy (spark_submit_task)",
"queryName": "Beta - Job's Task is Legacy (spark_submit_task)",
"severity": "MEDIUM",
"line": 36,
"fileName": "positive1.tf"
},
{
"queryName": "(Beta) Job's Task is Legacy (spark_submit_task)",
"queryName": "Beta - Job's Task is Legacy (spark_submit_task)",
"severity": "MEDIUM",
"line": 18,
"fileName": "positive2.tf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "df58dd45-8009-43c2-90f7-c90eb9d53ed9",
"queryName": "(Beta) Nifcloud Computing Has Common Private Network",
"queryName": "Beta - Nifcloud Computing Has Common Private Network",
"severity": "LOW",
"category": "Networking and Firewall",
"descriptionText": "The instance has common private network",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[
{
"queryName": "(Beta) Nifcloud Computing Has Common Private Network",
"queryName": "Beta - Nifcloud Computing Has Common Private Network",
"severity": "LOW",
"line": 1,
"fileName": "positive1.tf"
},
{
"queryName": "(Beta) Nifcloud Computing Has Common Private Network",
"queryName": "Beta - Nifcloud Computing Has Common Private Network",
"severity": "LOW",
"line": 1,
"fileName": "positive2.tf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "b2ea2367-8dc9-4231-a035-d0b28bfa3dde",
"queryName": "(Beta) Nifcloud Computing Has Public Ingress Security Group Rule",
"queryName": "Beta - Nifcloud Computing Has Public Ingress Security Group Rule",
"severity": "HIGH",
"category": "Networking and Firewall",
"descriptionText": "An ingress security group rule allows traffic from /0",
Expand Down
Loading
Loading