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

GHAS Compliance Action Default Branch Limitation #72

Closed
HaleenUptain opened this issue Nov 9, 2022 · 3 comments
Closed

GHAS Compliance Action Default Branch Limitation #72

HaleenUptain opened this issue Nov 9, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@HaleenUptain
Copy link

Description

Limitation identified using Code Scanning and Secret Scanning checks, they are only supported on the default branch. We had hoped these checks could be performed on branch pushes and PRs to catch alerts before they are propagated to the default branch but that functionality does not seem to be supported.

Propose Solution

Working with this action we like what we see. We are very interested in this concept and the ability to push security checks farther left in the development process. Proposed solution is to modify this action to work on any branch, not just the default branch, so checks catch alerts on branch pushes and PRs before they are propagated to the default branch.

@HaleenUptain HaleenUptain added the enhancement New feature or request label Nov 9, 2022
@GeekMasher GeekMasher self-assigned this Dec 6, 2022
@GeekMasher
Copy link
Owner

GeekMasher commented Dec 6, 2022

@HaleenUptain You are right and some of this is missing functionality. For Secret Scanning and Dependabot, we can only get the current alerts with no associated data such as branch "first detected in".

Code Scanning using the ref from the Action which comes from Actions and should work.

I might have to write some tests and make sure this does work as intended.

How important is this functionality to you? I can spend some time this / next week building this out as it would take long to build out

@HaleenUptain
Copy link
Author

HaleenUptain commented Dec 6, 2022

@GeekMasher Ability to run a GHAS Compliance action against non-default branches to stop alerts before they are merged into the default branch is critical functionality we are looking for in a GHAS Compliance action. If we could at least get that working for "Code Scanning" that would help and be a big step forward.

Looks like the passed in ref is never used.

Our tests also indicate that ref is not used. We ran a couple bare minimum tests to prove this out. Simple stand alone compliance job using workflow_dispatch to run the jobs manually. Note: Code scanning is the only compliance feature we have turned on in these tests.

Default Branch Test - main
main branch has no high alerts. Policy snippet:
codescanning:
level: error
Standalone compliance job running in main reports that correctly. Ref in .yml is set to:
ref: refs/heads/main

image

image

Non-Default Branch Test - featurebranch_test
featurebranch_test has one high alert.
Compliance job running in main is not returning expected result when we change ref in .yml to point to a non-default branch. We would expect the high alert on featurebranch_test branch to show as a threshold violation:
ref: refs/heads/featurebranch_test
image

image

@GeekMasher
Copy link
Owner

@HaleenUptain I have moved this repository to a more official repository https://github.com/advanced-security/policy-as-code .

This issue is top priority for myself so I will be working on in before the holidays, please check the new issue opened here

advanced-security/policy-as-code#2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants