Qualys IaC GitHub action is used to scan the Infrastructure-as-Code templates in your GitHub repository using Qualys CloudView (Cloud Security Assessment). It checks for security issues using the Qualys Cloud Infrastructure as Code Scan and displays the failed checks as pipeline annotations.
Note: Qualys IaC GitHub action supports below file formats for scanning.
- Terraform supported extensions:
.tf
,.json
- CloudFormation supported extensions:
.template
,.yml
,.yaml
- Visit GitHub configuration a workflow to enable Github Action in your repository.
- Subscribe to Qualys CloudView and obtain Qualys credentials.
- Create GitHub Secrets for Qualys URL, Qualys Username and Qualys Password. Refer to Encrypted secrets for more details on how to setup secrets.
- Configure your workflow. In the actions section use
Qualys/github_action_qiac@main
Note: theactions/checkout
step is required to run before the scan action, otherwise the action does not have access to the IaC files to be scanned. - Optionally, supply parameters to customize GitHub action behaviour.
Note: In case of push
event, the scan scope will be limited to the changed or newly added files only. This is to avoid the unnecessary scanning of files which are not part of this push event.
name: Qualys IAC Scan
on:
push:
branches:
- main
jobs:
Qualys_iac_scan:
runs-on: ubuntu-latest
name: Qualys IaC Scan
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Qualys IAC scan action step
uses: Qualys/github_action_qiac@main
id: qiac
env:
URL: ${{ secrets.URL }}
UNAME: ${{ secrets.USERNAME }}
PASS: ${{ secrets.PASSWORD }}
Note: In case of pull request
event, the scope of scan will be limited to the files included in the pull request only. This is to avoid the unnecessary scanning of files which are not part of this pull request.
name: Qualys IAC Scan
on:
pull_request:
branches:
- main
jobs:
Qualys_iac_scan:
runs-on: ubuntu-latest
name: Qualys IaC Scan
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Qualys IAC scan action step
uses: Qualys/github_action_qiac@main
id: qiac
env:
URL: ${{ secrets.URL }}
UNAME: ${{ secrets.USERNAME }}
PASS: ${{ secrets.PASSWORD }}
Note: In case of scheduled
event, the path given in directory
input will be scanned. In case the path is not given, the entire repository will be scanned.
name: Qualys IAC Scan
on:
schedule:
- cron: '*/5 * * * *'
jobs:
Qualys_iac_scan:
runs-on: ubuntu-latest
name: Qualys IaC Scan
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Qualys IAC scan action step
uses: Qualys/github_action_qiac@main
id: qiac
env:
URL: ${{ secrets.URL }}
UNAME: ${{ secrets.USERNAME }}
PASS: ${{ secrets.PASSWORD }}
with:
directory: 'path of directory to scan (optional)'
Note: In case of workflow_dispatch
event or manual trigger, the path given in directory
input will be scanned. In case the path is not given, the entire repository
will be scanned.
name: Qualys IAC Scan
on: workflow_dispatch
jobs:
Qualys_iac_scan:
runs-on: ubuntu-latest
name: Qualys IaC Scan
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Qualys IAC scan action step
uses: Qualys/github_action_qiac@main
id: qiac
env:
URL: ${{ secrets.URL }}
UNAME: ${{ secrets.USERNAME }}
PASS: ${{ secrets.PASSWORD }}
with:
directory: 'path of directory to scan (optional)'
Scan IaC in your repository on push/pull request/scheduled event with the step of uploading SARIF file on GitHub.
Note: Upload SARIF file Step will upload your scan report on GitHub and it will show all security alerts(if any) under Security -> Code scanning alerts tab.
name: Qualys IAC Scan
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '*/5 * * * *'
jobs:
Qualys_iac_scan:
runs-on: ubuntu-latest
name: Qualys IaC Scan
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Qualys IAC scan action step
uses: Qualys/github_action_qiac@main
id: qiac
env:
URL: ${{ secrets.URL }}
UNAME: ${{ secrets.USERNAME }}
PASS: ${{ secrets.PASSWORD }}
with:
directory: 'path of directory to scan (optional)'
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v1
if: always()
with:
sarif_file: response.sarif
- Valid Qualys Credentials and subscription of Qualys CloudView module.
- Use of
actions/checkout@v2
withfetch-depth: 0
before calling Qualys IaC GitHub action. Qualys URL, Qualys Username , Qualys Password
to be added insecrets
and provided asenvironment variables
to the Qualys IaC GitHub action.- Self-hosted runners must use a Linux operating system and have Docker installed to run this action.
Parameter | Description | Required | Default | Type |
---|---|---|---|---|
directory | IaC root directory to scan. If not provided then entire repository will be scanned in case of manual or scheduled action trigger | No | "." | Input parameter |