Skip to content

Commit 0697793

Browse files
committed
fix(Gitlab): Correcting support for JSON 2020 Draft with Regex
1 parent 934bbab commit 0697793

File tree

2 files changed

+65
-20
lines changed

2 files changed

+65
-20
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,13 @@ jobs:
5252
npm run clean
5353
npm run build
5454
55-
- name: Write version vars
55+
- name: Test Container Image
56+
id: test-image
5657
run: |
57-
BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
58-
BRANCH=${GITHUB_REF_NAME#v}
59-
APP_VERSION=$(cat package.json | grep version| head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g')
60-
echo Version: $APP_VERSION
61-
echo "VERSION=$APP_VERSION" >> $GITHUB_ENV
62-
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
63-
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
64-
65-
- name: Build Container Image
66-
id: build-image
67-
uses: redhat-actions/buildah-build@v2
68-
with:
69-
image: continuoussecuritytooling/ajv-cli
70-
tags: "latest next ${{env.APP_VERSION}} ${{env.APP_VERSION}}_rc"
71-
containerfiles: |
72-
./Dockerfile
73-
build-args: |
74-
BUILD_DATE=${{env.BUILD_DATE}}
75-
APP_VERSION=${{env.APP_VERSION}}
58+
docker build -t continuoussecuritytooling/ajv-cli:${{github.run_number}} .
59+
wget https://gitlab.com/gitlab-org/gitlab/-/raw/master/ee/app/validators/json_schemas/security_orchestration_policy.json
60+
docker run -u 0 -v $(pwd):/build continuoussecuritytooling/ajv-cli:${{github.run_number}} migrate --spec=draft2020 -s /build/security_orchestration_policy.json
61+
docker run -u 0 -v $(pwd):/build continuoussecuritytooling/ajv-cli:${{github.run_number}} validate --spec=draft2020 --strict=false --validate-formats=true -c ajv-formats --unicodeRegExp=false -s /build/security_orchestration_policy.json -d /build/test/gitlab/policy.yml
7662
7763
build-results:
7864
name: Build results

test/gitlab/policy.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
approval_policy:
3+
- name: security-secret-scan
4+
description: "Secrets Scan"
5+
enabled: true
6+
rules:
7+
- type: scan_finding
8+
scanners:
9+
- secret_detection
10+
vulnerabilities_allowed: 0
11+
severity_levels:
12+
- critical
13+
- high
14+
vulnerability_states: []
15+
branch_type: default
16+
actions:
17+
- type: send_bot_message
18+
enabled: true
19+
approval_settings:
20+
block_branch_modification: true
21+
block_group_branch_modification: true
22+
prevent_pushing_and_force_pushing: true
23+
prevent_approval_by_author: true
24+
prevent_approval_by_commit_author: true
25+
remove_approvals_with_new_commit: true
26+
require_password_to_approve: false
27+
fallback_behavior:
28+
fail: closed
29+
- name: security-sast-scan
30+
description: "SAST Scan"
31+
enabled: true
32+
policy_scope:
33+
projects:
34+
excluding:
35+
- id: 1
36+
- id: 2
37+
rules:
38+
- type: scan_finding
39+
scanners:
40+
- sast
41+
vulnerabilities_allowed: 0
42+
severity_levels:
43+
- critical
44+
- high
45+
vulnerability_states: []
46+
branch_type: default
47+
actions:
48+
- type: send_bot_message
49+
enabled: true
50+
approval_settings:
51+
block_branch_modification: true
52+
block_group_branch_modification: true
53+
prevent_pushing_and_force_pushing: true
54+
prevent_approval_by_author: true
55+
prevent_approval_by_commit_author: true
56+
remove_approvals_with_new_commit: true
57+
require_password_to_approve: false
58+
fallback_behavior:
59+
fail: closed

0 commit comments

Comments
 (0)