Skip to content

Commit 1010edd

Browse files
feat: validate subscription check added
action release updated readme updated
1 parent 7458d47 commit 1010edd

File tree

8 files changed

+42
-73
lines changed

8 files changed

+42
-73
lines changed

.github/release-drafter.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/actions_release.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ on:
66
tag:
77
description: "Tag for the release"
88
required: true
9-
# Uncomment if using yarn
10-
# script:
11-
# description: "Specify the build script to run"
12-
# required: true
13-
# type: string
149

1510
permissions:
1611
contents: read
@@ -25,4 +20,3 @@ jobs:
2520
uses: step-security/reusable-workflows/.github/workflows/actions_release.yaml@v1
2621
with:
2722
tag: "${{ github.event.inputs.tag }}"
28-
# script: "${{ github.event.inputs.script }}"

.github/workflows/claude_review.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Prisma Cloud Scan Action
22

3-
This GitHub Action will scan container images for vulnerabilities and compliance issues using Prisma Cloud by Palo Alto Networks. With it, you can receive immediate feedback about image vulnerabilities and compliance violations both in GitHub and in the Prisma Cloud Console as well as block builds that do not meet your compliance requirements, such as high or critical vulnerabilities.
3+
This GitHub Action will scan container images for vulnerabilities and compliance issues using Prisma Cloud. With it, you can receive immediate feedback about image vulnerabilities and compliance violations both in GitHub and in the Prisma Cloud Console as well as block builds that do not meet your compliance requirements, such as high or critical vulnerabilities.
44

55
This action is a wrapper around [twistcli](https://docs.twistlock.com/docs/compute_edition/tools/twistcli_scan_images.html) which connects to the specified Prisma Cloud Console for vulnerability and compliance policy and metadata.
66

@@ -36,7 +36,7 @@ jobs:
3636
# (Optional) for compatibility with GitHub's code scanning alerts
3737
- name: Upload SARIF file
3838
if: ${{ always() }} # necessary if using failure thresholds in the image scan
39-
uses: github/codeql-action/upload-sarif@v2
39+
uses: github/codeql-action/upload-sarif@v3
4040
with:
4141
sarif_file: ${{ steps.scan.outputs.sarif_file }}
4242
```

dist/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14771,7 +14771,25 @@ function formatSarif(twistcliVersion, resultsFile) {
1477114771
}
1477214772
}
1477314773

14774+
async function validateSubscription() {
14775+
const API_URL = `https://agent.api.stepsecurity.io/v1/github/${process.env.GITHUB_REPOSITORY}/actions/subscription`;
14776+
14777+
try {
14778+
await axios.get(API_URL, {timeout: 3000});
14779+
} catch (error) {
14780+
if (error.response && error.response.status === 403) {
14781+
console.error(
14782+
'Subscription is not valid. Reach out to [email protected]'
14783+
);
14784+
process.exit(1);
14785+
} else {
14786+
core.info('Timeout or API not reachable. Continuing to next step.');
14787+
}
14788+
}
14789+
}
14790+
1477414791
async function scan() {
14792+
await validateSubscription();
1477514793
const httpProxy = process.env.https_proxy || process.env.HTTPS_PROXY || process.env.http_proxy || process.env.HTTP_PROXY;
1477614794
const consoleUrl = core.getInput('pcc_console_url');
1477714795
const username = core.getInput('pcc_user');

index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,25 @@ function formatSarif(twistcliVersion, resultsFile) {
272272
}
273273
}
274274

275+
async function validateSubscription() {
276+
const API_URL = `https://agent.api.stepsecurity.io/v1/github/${process.env.GITHUB_REPOSITORY}/actions/subscription`;
277+
278+
try {
279+
await axios.get(API_URL, {timeout: 3000});
280+
} catch (error) {
281+
if (error.response && error.response.status === 403) {
282+
console.error(
283+
'Subscription is not valid. Reach out to [email protected]'
284+
);
285+
process.exit(1);
286+
} else {
287+
core.info('Timeout or API not reachable. Continuing to next step.');
288+
}
289+
}
290+
}
291+
275292
async function scan() {
293+
await validateSubscription();
276294
const httpProxy = process.env.https_proxy || process.env.HTTPS_PROXY || process.env.http_proxy || process.env.HTTP_PROXY;
277295
const consoleUrl = core.getInput('pcc_console_url');
278296
const username = core.getInput('pcc_user');

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
22
"name": "prisma-cloud-scan",
33
"description": "Scan with Prisma Cloud",
4-
"author": "Palo Alto Networks",
4+
"author": "step-security",
55
"license": "Apache-2.0",
66
"scripts": {
77
"lint": "eslint index.js",
88
"build": "ncc build index.js --license licenses.txt"
99
},
10-
"homepage": "https://github.com/paloaltonetworks/prisma-cloud-scan#readme",
10+
"homepage": "https://github.com/step-security/prisma-cloud-scan#readme",
1111
"repository": {
1212
"type": "git",
13-
"url": "git+https://github.com/paloaltonetworks/prisma-cloud-scan.git"
13+
"url": "git+https://github.com/step-security/prisma-cloud-scan.git"
1414
},
1515
"bugs": {
16-
"url": "https://github.com/paloaltonetworks/prisma-cloud-scan/issues"
16+
"url": "https://github.com/step-security/prisma-cloud-scan/issues"
1717
},
1818
"keywords": [
1919
"prisma",

0 commit comments

Comments
 (0)