Skip to content

Commit

Permalink
v1-prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
xfhg committed Sep 13, 2024
1 parent 270cb10 commit 712af20
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/assure.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ func executeAssure(policy Policy, rgPath string, targetDir string, filesToAssure
"-f", searchPatternFile,
}

if targetDir == "" {
return fmt.Errorf("no target directory defined")
}

// Append the file targets
if len(filesToAssure) > 0 {
codePatternAssureJSON = append(codePatternAssureJSON, filesToAssure...)
Expand Down
4 changes: 4 additions & 0 deletions cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func executeScan(policy Policy, rgPath string, targetDir string, filesToScan []s
"-f", searchPatternFile,
}

if targetDir == "" {
return fmt.Errorf("no target directory defined")
}

// Append the same file targets as the previous command
if len(filesToScan) > 0 {
codePatternScanJSON = append(codePatternScanJSON, filesToScan...)
Expand Down
37 changes: 37 additions & 0 deletions playground/policies/test_ob_scan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

Config:
Flags:
policy_schedule: "*/15 * * * * *"
report_schedule: "*/50 * * * * *"
# target: "targets/"
ignore:
- "targets/scan/"

Policies:
- id: "SCAN-001 Private Keys"
type: "scan"
enforcement:
- environment: "production"
fatal: "true"
exceptions: "false"
confidence: "high"
- environment: "development"
fatal: "true"
exceptions: "false"
confidence: "high"
metadata:
name: "Detect private keys"
description: "Generic long description for (metadata) policy"
msg_solution: "Generic solution message to production issue."
msg_error: "Generic error message for production issue"
tags:
- "security"
- "encryption"
score: "9"
_regex:
- \s*(-----BEGIN PRIVATE KEY-----)
- \s*(-----BEGIN RSA PRIVATE KEY-----)
- \s*(-----BEGIN DSA PRIVATE KEY-----)
- \s*(-----BEGIN EC PRIVATE KEY-----)
- \s*(-----BEGIN OPENSSH PRIVATE KEY-----)
- \s*(-----BEGIN PGP PRIVATE KEY BLOCK-----)

0 comments on commit 712af20

Please sign in to comment.