Skip to content

Commit

Permalink
Add security scanning and remove debug printing (#34)
Browse files Browse the repository at this point in the history
* Add security scanning and remove debug printing

* Use v10000 instead of main
  • Loading branch information
henryrecker-pingidentity authored Feb 20, 2024
1 parent 67fc885 commit 66bee48
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 16 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/gosec-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Security Scan"

# Run workflow each time code is pushed to your repository and on a schedule.
# The scheduled workflow runs every at 00:00 on Sunday UTC time.
on:
push:
branches: [ "v10000" ]
pull_request:
branches: [ "v10000" ]
schedule:
- cron: '0 0 * * 0'

jobs:
tests:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
# we let the report trigger content trigger a failure using the GitHub Security features.
args: '-no-fail -fmt sarif -out results.sarif ./...'
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
with:
# Path to SARIF file relative to the root of the repository
sarif_file: results.sarif
16 changes: 0 additions & 16 deletions configurationapi/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions configurationapi/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ package configurationapi

//go:generate ../scripts/generateEnumConversionFunctions.py
//go:generate ../scripts/setUserPrivilegeEnumNames.py
//go:generate ../scripts/updateClient.py
21 changes: 21 additions & 0 deletions scripts/updateClient.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3
# coding: UTF-8

# Update client.go
updatedClientLines = []
with open("client.go", 'r') as clientFile:
for line in clientFile:
# Skip unused imports
if "\"log\"" in line or "\"net/http/httputil\"" in line:
continue
# Remove debug lines for printing request contents
if "c.cfg.Debug" in line:
# advance iterator to skip the expected lines
for i in range(7):
line = clientFile.readline()
updatedClientLines.append(line)

with open("client.go", 'w') as clientFile:
for line in updatedClientLines:
clientFile.write(line)

0 comments on commit 66bee48

Please sign in to comment.