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

Use PSRule for Security testing and re-enable manual testing #127

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
21 changes: 15 additions & 6 deletions .github/workflows/azure-dev-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches: [ aca-openai-agent ]
marlenezw marked this conversation as resolved.
Show resolved Hide resolved
paths:
- "infra/**"
workflow_dispatch:

jobs:
build:
Expand All @@ -22,15 +23,23 @@ jobs:
with:
inlineScript: az config set bicep.use_binary_from_path=false && az bicep build -f infra/main.bicep --stdout

- name: Run Microsoft Security DevOps Analysis
uses: microsoft/security-devops-action@preview
id: msdo
continue-on-error: true
- name: Run PSRule analysis
uses: microsoft/[email protected]
with:
tools: templateanalyzer
modules: PSRule.Rules.Azure
baseline: Azure.Pillar.Security
inputPath: infra/*.test.bicep
outputFormat: Sarif
outputPath: reports/ps-rule-results.sarif
summary: true
continue-on-error: true

env:
PSRULE_CONFIGURATION_AZURE_BICEP_FILE_EXPANSION: 'true'
PSRULE_CONFIGURATION_AZURE_BICEP_FILE_EXPANSION_TIMEOUT: '30'

- name: Upload alerts to Security tab
uses: github/codeql-action/upload-sarif@v2
if: github.repository == 'Azure-Samples/contoso-creative-writer'
with:
sarif_file: ${{ steps.msdo.outputs.sarifFile }}
sarif_file: reports/ps-rule-results.sarif
17 changes: 17 additions & 0 deletions infra/main.test.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This file is for doing static analysis and contains sensible defaults
// for PSRule to minimise false-positives and provide the best results.

// This file is not intended to be used as a runtime configuration file.

targetScope = 'subscription'

param environmentName string = 'testing'
param location string = 'swedencentral'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use Sweden central here or East US 2 as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as it's one of the allowed regions,it doesn't matter


module main 'main.bicep' = {
name: 'main'
params: {
environmentName: environmentName
location: location
}
}