Skip to content

[Bug]: Time-to-Remediate not detecting threshold breach #174

@cbulleninf

Description

@cbulleninf

What happened?

There seems to have been a bug introduced somewhere between v2.9.1 and v2.11.

I have the below policy to flag critical alerts if they are not remediated after 3 days. I have a test repo with 2 critical dependabot alerts (and 8 others, 10 in total) which have been open for 2 months. If I run PaC on v2.9.1 it correctly errors/flags the threshold breach. If I run the exact same config/repo on v2.11 it passes the evaluation.

If I remove the "remediate" component from the config and just have the levels, then it does error. So the problem seems to be with the remediation feature.

If I look in the logs, it correctly identifies the 10 total dependabot issues, so it's not an issue about not being able to see the dependabot issues.

Policy:

general:
  remediate:
    critical: 3
  
codescanning:
  level: critical

dependabot:
  level: critical

licensing:

secretscanning:
  level: critical

Version

v2 (current major version)

Where are you experiencing the issue?

GitHub Actions

Relevant log output

Run advanced-security/policy-as-code@4914793a39812ef4674b9eda188d1dd480465f8e
Run echo "Running Policy as Code..."
Running Policy as Code...
/home/runner/work/_actions/advanced-security/policy-as-code/4914793a39812ef4674b9eda188d1dd480465f8e/ghascompliance/__version__.py:35: SyntaxWarning: invalid escape sequence '\|'
  """
INFO:root:GitHub Repository :: xxxxx
INFO:root:GitHub Instance :: https://github.com
INFO:root:GitHub Reference (branch/pr) :: master
INFO:root:Loading Policy as Code from Repository - xxxxxx
INFO:root:Cloning policy repo - xxxxx@test
INFO:root:Loading policy file - /tmp/repo/policies/test.yaml
INFO:root:Enabling Time to Remediate (global) :: codescanning
INFO:root:Enabling Time to Remediate (global) :: dependabot
INFO:root:Enabling Time to Remediate (global) :: licensing
INFO:root:Enabling Time to Remediate (global) :: secretscanning
INFO:root:Policy loaded successfully
INFO:root:Saving Policy...
INFO:root:Policy saved
INFO:root:Finished loading policy
INFO:root:Policy as Code Summary:
INFO:root:
INFO:root:general: 'error'
INFO:root:codescanning: 'critical'
INFO:root:dependabot: 'critical'
INFO:root:licensing: 'disabled'
INFO:root:secretscanning: 'critical'
INFO:root:dependencies: 'error'
INFO:root:
INFO:root:Total Code Scanning Alerts :: 1
INFO:root:Code Scanning violations :: 0
INFO:root:Total Dependabot Alerts :: 10
INFO:root:Dependabot violations :: 0
INFO:root:Total Dependency Graph :: 14
INFO:root:Dependency Graph violations :: 0
INFO:root:Total Secret Scanning Alerts :: 0
INFO:root:Secret Scanning violations :: 0
INFO:root:Total unacceptable alerts :: 0
INFO:root:Acceptable risk and no threshold reached.
 _____  _   _   ___   _____ _____                       _ _                      
|  __ \| | | | / _ \ /  ___/  __ \                     | (_)                     
| |  \/| |_| |/ /_\ \\ `--.| /  \/ ___  _ __ ___  _ __ | |_  __ _ _ __   ___ ___ 
| | __ |  _  ||  _  | `--. \ |    / _ \| '_ ` _ \| '_ \| | |/ _` | '_ \ / __/ _ \
| |_\ \| | | || | | |/\__/ / \__/\ (_) | | | | | | |_) | | | (_| | | | | (_|  __/
 \____/\_| |_/\_| |_/\____/ \____/\___/|_| |_| |_| .__/|_|_|\__,_|_| |_|\___\___|
                                                 | |                             
                                                 |_|         v2.11.0
    GitHub Advanced Security Policy as Code by GeekMasher

GitHub Repository :: xxxxx
GitHub Instance :: https://github.com
GitHub Reference (branch/pr) :: master
Policy as Code
Code Scanning Results
Dependabot Results
  Total Dependabot Alerts :: 10
  Dependabot violations :: 0
Dependency Graph
Dependency Graph Results - Licensing
Secret Scanning Results

Summary
  Total unacceptable alerts :: 0
  Acceptable risk and no threshold reached.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions