GitHub Advance Security Compliance Action

Overview

advanced-security-compliance

This Action was designed to allow users to configure their Risk threshold for security issues reported by GitHub Code Scanning, Secret Scanning and Dependabot Security.

Setup

Action

Here is how you can quickly setup advanced-security-compliance.

# Compliance
- name: Advance Security Compliance Action
  uses: GeekMasher/[email protected]

Action Examples

CLI

The CLI tool primarily using pipenv to manage dependencies and pip virtual environments to not mismatch dependencies.

# Install dependencies and virtual environment
pipenv install
# [option] Install system wide
pipenv install --system

Once installed, you can just call the module using the following command(s):

# Using pipenv script
pipenv run main --help
# ... or
pipenv run python -m ghascompliance

CLI Examples

Policy as Code / PaC

Here is an example of using a simple yet cross-organization using Policy as Code:

# Compliance
- name: Advance Security Compliance Action
  uses: GeekMasher/[email protected]
  with:
    # The owner/repo of where the policy is stored  
    policy: GeekMasher/security-queries
    # The local (within the workspace) or repository
    policy-path: policies/default.yml
    # The branch you want to target
    policy-branch: main

PaC Configuration file

The Policy as Code configuration file is very simple yet powerful allowing a user to define 4 types of rules per technologies you want to use.

# This is the technology you want to write a rule for
licensing:
  # The four main rules types to do everything you need to do for all things 
  #  compliance

  # Warnings will always occur if the rule applies and continues executing to 
  #  other rules.
  warnings:
    ids:
      - Other
      - NA
  # Ignores are run next so if an ignored rule is hit that matches the level, 
  #  it will be skipped
  ignores:
    ids:
      - MIT License
  # Conditions will only trigger and raise an error when an exact match is hit
  conditions:
    ids:
      - GPL-2.0
    names:
      - tunnel-agent

  # The simplest and ultimate rule which checks the severity of the alert and
  #  reports an issue if the level matches or higher (see PaC Levels for more info)
  level: error

PaC Levels

There are many different levels of severities with the addition of all and none (self explanatory). When a level is selected like for example error, all higher level severities (critical and high in this example) will also be added.

- critical
- high
- error
- medium
- moderate
- low
- warning
- notes

PaC Rule Blocks

For each rule you can choose either or both of the two different criteria's matches; ids and names

You can also use imports to side load data from other files to supplement the data already in the rule block

codescanning:
  conditions:
    # When the `ids` of the technologies/tool alert matches any one of the ID's in 
    #  the list specified, the rule will the triggered and report the alert.
    ids:
      # In this example case, the CodeQL rule ID below will always be reported if 
      #  present event if the severity is low or even note.
      - js/sql-injection

      # Side note: Check to see what different tools consider id's verses names,
      #  for example `licensing` considers the "Licence" name itself as the id 
      #  while the name of the package/library as the "name"
    
    # `names` allows you to specify the names of alerts or packages.
    names:
      - "Missing rate limiting"

    # The `imports` allows you to supplement your existing data with a list
    #  from a file on the system. 
    imports:
     ids: "path/to/ids/supplement/file.txt"
     names: "path/to/names/supplement/file.txt"

Wildcards

For both types of criteria matching you can use wildcards to easily match requirements in a quicker way. The matching is done using a Unix shell-style wildcards module called fnmatch which supports * for matching everything.

codescanning:
  conditions:
    ids:
      - '*/sql-injection'

Time to Remediate

The feature allows a user to define a time frame to which a security alert/vulnerability of a certain severity has before the alert triggered a violation in the Action.

By default, if this section is not defined in any part of the policy then no checks are done. Existing policy files should act the same without the new section.

general:
  # All other blocks will be inheriting the remediate section if they don't have 
  #  their own defined.
  remediate:
    # Only `error`'s and above have got 7 days to remediate according to the 
    #  policy. Any time before that, nothing will occur and post the remediation 
    #  time frame the alert will be raised. 
    error: 7

codescanning:
  # the `codescanning` block will inherit the `general` block
  # ...

dependabot:
  remediate:
    # high and critical security issues
    high: 7
    # moderate security issues
    moderate: 30
    # all other security issues
    all: 90

secretscanning:
  remediate:
    # All secrets by default are set to 'critical' severity so only `critical` 
    #  or `all` will work
    critical: 7
Time to Remediate Examples

Data Importing

Some things to consider when using imports:

  • Imports appending to existing lists and do not replace a previously generated list.
  • Imports are relative to:
    • Working Directory
    • GitHub Action / CLI directory
    • Cloned Repository Directory
  • Imports are only allowed from a number of predefined paths to prevent loading data on the system (AKA, path traversal).

Licensing Notice

MIT License

Copyright (c) 2021 Mathew Payne

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Comments
  • allow list

    allow list

    Description

    I am trying to define an allow list of licenses but using * under conditions isn't giving the desired result.

    image

    Propose Solution

    if I do the below the ignores are not actually ignoring anything as I am still

    licensing:
      # The four main rules types to do everything you need to do for all things
      #  compliance
    
      # Warnings will always occur if the rule applies and continues executing to
      #  other rules.
      warnings:
        ids:
          - other
          - na
    
      # Ignores are run next so if an ignored rule is hit that matches the level,
      #  it will be skipped
      ignores:
        ids:
          - apache license 2.0
          - bsd 3-clause "new" or "revised" license
          - mit license
    
      # Conditions will only trigger and raise an error when an exact match is hit
      conditions:
        # note using 'names' here instead of `ids` has the same result
        ids:
          - "*"
    
    enhancement 
    opened by lsmith77 4
  • Unknown Exception was hit, Error: Query failed to run

    Unknown Exception was hit, Error: Query failed to run

    Describe the bug Running this action on our workflow we get an error we can't understand.

    To Reproduce Steps to reproduce the behavior:

    1. Add action "build-and-test.yaml" to workflow
    2. With the following code: " advancesecurityComplience: runs-on: ubuntu-latest name: Advanced Security Complience steps:
    3. See error

    Dependabot Results Error: {"data": {"repository": {"vulnerabilityAlerts": null}}, "errors": [{"type": "FORBIDDEN", "path": ["repository", "vulnerabilityAlerts"], "extensions": {"saml_failure": false}, "locations": [{"line": 3, "column": 9}], "message": "Resource not accessible by integration"}]} Error: Unknown Exception was hit, please repo this to https://github.com/GeekMasher/advanced-security-Compliance Error: Query failed to run

    Expected behavior Dependabot to block the PR if finds a critical or high risk vulnerability.

    bug 
    opened by hmarnd 4
  • Add GitHub App API token authentication to clone custom policy inside a private repository

    Add GitHub App API token authentication to clone custom policy inside a private repository

    As stated in issue #50, the custom policy clone using GitHub App API token is not possible as x-access-tokenusername need to be set in the https clone link.

    I've added an optionnal argument --is-github-app-token to specify if the authentication token is a GitHub App API token, and set the x-access-token username needed to clone the policy.

    I've also added the branch argument to Policy()call, as it was actually never used.

    opened by 4bg0P 4
  • Dependabot scan fails with the default policy

    Dependabot scan fails with the default policy

    Describe the bug The Dependabot scan fails with the default policy. The repository does not have any open dependabot alerts, is that why?

    To Reproduce Steps to reproduce the behavior:

    1. Run the default action configuration
    jobs:
      compliance:
        name: Compliance
        runs-on: ubuntu-latest
        steps:
        - name: Advanced Security Compliance Action
          uses: GeekMasher/[email protected]
    

    Expected behavior Dependabot violations should be 0.

    Screenshots If applicable, add screenshots to help explain your problem. Screenshot 2021-10-23 at 15 09 13

    Additional context The compliance job is run as a reusable workflow from another repository.

    opened by leostolyarov 4
  • `policy-branch` argument does not work as expected

    `policy-branch` argument does not work as expected

    Describe the bug Action parameter policy-branch is not working as intended. No matter what value is set, it seems to be always using the default branch.

    To Reproduce Setup action with the following params:

    security-compliance:
        runs-on: ubuntu-latest
        needs:
          - codeql
        steps:
          - name: Advance Security Compliance Action
            uses: GeekMasher/[email protected]
            with:
              token: ${{ secrets.GITHUB_PERSONAL_TOKEN }}
              policy: myTestRepo/github-actions
              policy-path: security/policies/default.yml
              policy-branch: security
    

    Expected behavior Action should checkout the branch defined policy-branch

    Screenshots image

    Desktop (please complete the following information): N/A

    Smartphone (please complete the following information): N/A

    Additional context none

    opened by jlouros 4
  • GHAS Compliance Action Default Branch Limitation

    GHAS Compliance Action Default Branch Limitation

    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.

    enhancement 
    opened by HaleenUptain 3
  • GitHub Enterprise seems to not support ...

    GitHub Enterprise seems to not support ...

    Describe the bug We have updated to the v1.6.3.
    This newer version gives the following error "message": "Field 'dependencyGraphManifests' doesn't exist on type 'Repository'"

    We used the following command line options to disable licensing ( --disable-dependency-licensing --disable-dependencies) and got the same error.

    We grabbed the GraphQL GRAPHQL_DEPENDENCY_INFO from dependency.py and got the same error calling the GraphQL API directly.

    We compared the GitHub Cloud API (https://docs.github.com/en/graphql/overview/schema-previews) with the GitHut Enterprise API (https://docs.github.com/en/[email protected]/graphql/overview/schema-previews).

    GitHub Cloud API has a section called 'Access to a repositories dependency graph preview'. GitHub Enterprise API does NOT have this section.

    Are we correct in assuming this functionality has not been released for GitHub Enterprise yet?

    Is this functionality required for dependabot policy functionality? If it is, which GitHub Enterprise version will support 'Access to a repositories dependency graph preview'?

    To Reproduce Steps to reproduce the behavior:

    1. Run action with dependabot enabled on GitHub Enterprise @3.6.2

    Expected behavior Dependabot policy functionality works as it already does on GitHub Cloud

    bug 
    opened by midwestKC-coder 3
  • Documentation - Using GitHub App with Action

    Documentation - Using GitHub App with Action

    Description

    We need some introductional docs on how to setup and use this Action using a GitHub App.

    Related:

    • #50
      • #51

    +cc @4bg0P

    Propose Solution

    documentation 
    opened by GeekMasher 3
  • License Scanning and Policy : manage unknown license with local file

    License Scanning and Policy : manage unknown license with local file

    Dependabot sometimes fails to get the license information as it is not well documented in a repository for example:

    • https://github.com/pugjs/pug
    • https://github.com/jrburke/amdefine

    The idea would be to:

    • each time we do a test and the licence is unknown:
      • log an issue/contribution in the source repository to allow Dependabot to recognize the license
      • add an entry in a this Action project that will be the list of project/url without license
      • use the information in the policy management with clear information about the fact that it is coming from local scann
    enhancement 
    opened by tgrall 3
  • Change

    Change "conditions" for a more meaningful name

    Description

    As a noob I find confusing the term "conditions" because I don't know if it is a condition to fail or to pass.

    Propose Solution

    Instead of "ignore" and "conditions", can we find something that clearly states what will happen like allow/disallow or similar? I understand this will cause a compatibility issue with existing license policies, but you could warn that there will be a breaking change during a time window to allow everyone to change it.

    @romanoroth, @Padi-owasp

    enhancement 
    opened by jmservera 2
  • Dependabot not supporting GitHub Enterprise

    Dependabot not supporting GitHub Enterprise

    Describe the bug The change to support GitHub enterprise missed changing dependabot.py. It is still using direct GitHub cloud reference: instance = "https://api.github.com/graphql"

    To Reproduce Steps to reproduce the behavior:

    1. Code inspection dependabot.py Line 80 - instance = "https://api.github.com/graphql"

    Expected behavior Dependabot should use the GitHub enterprise URL and not the GitHub Cloud URL

    This change was missed with the merge (https://github.com/GeekMasher/advanced-security-compliance/pull/31) that added support for GitHub Enterprise.

    bug 
    opened by midwestKC-coder 2
  • Deprecation Notice

    Deprecation Notice

    This repository has been moved to a new policy-as-code repository.

    Please migrate all workflows to using the new repository as this repository is no longer receiving updates.

    opened by GeekMasher 0
Releases(v1.7.0)
Owner
Mathew Payne
Security guy with developer tendencies
Mathew Payne
xray多线程批量扫描工具

Auto_xray xray多线程批量扫描工具 简介 xray社区版貌似没有批量扫描,这就让安服仔使用起来很不方便,扫站得一个个手动添加,非常难受 Auto_xray目录下记得放xray,就跟平时一样的。 选项1:oneforall+xray 输入一个主域名,自动采集子域名然后添加到xray任务列表

1frame 13 Nov 09, 2022
KeyKatcher is a keylogger that records keystrokes made on a computer and sends to the E-Mail.

What is a keylogger? A keylogger is a software application or piece of hardware that monitors and records keystrokes made on a computer keyboard. The

Himank_Jain 7 Sep 19, 2022
log4j burp scanner

log4jscanner log4j burp插件 特点如下: 0x01 基于Cookie字段、XFF头字段、UA头字段发送payload 0x02 基于域名的唯一性,将host带入dnslog中 插件主要识别五种形式: 1.get请求,a=1&b=2&c=3 2.post请求,a=1&b=2&c=

1 Jun 30, 2022
Safe Policy Optimization with Local Features

Safe Policy Optimization with Local Feature (SPO-LF) This is the source-code for implementing the algorithms in the paper "Safe Policy Optimization wi

Akifumi Wachi 6 Jun 05, 2022
Tool To generate Stable Undetected Payload

windowsPayload Tool To generate Stable Undetected Payload Don t Upload to Virus Total :) Follow on Social Media Platforms ScreenShots How to install +

youhacker55 117 Dec 30, 2022
Exploiting CVE-2021-44228 in VMWare Horizon for remote code execution and more.

Log4jHorizon Exploiting CVE-2021-44228 in VMWare Horizon for remote code execution and more. BLOG COMING SOON Code and README.md this time around are

96 Dec 14, 2022
Sudo Baron Samedit Exploit

CVE-2021-3156 (Sudo Baron Samedit) This repository is CVE-2021-3156 exploit targeting Linux x64. For writeup, please visit https://datafarm-cybersecur

Worawit Wang 559 Jan 03, 2023
Fast Fb Cracking Tool

fb-brute Fast Fb Cracking Tool 🏆

Aryan 8 Jun 29, 2022
Chrome Post-Exploitation is a client-server Chrome exploit to remotely allow an attacker access to Chrome passwords, downloads, history, and more.

ChromePE [Linux/Windows] Chrome Post-Exploitation is a client-server Chrome exploit to remotely allow an attacker access to Chrome passwords, download

Finn Lancaster 3 Oct 05, 2022
VPN Overall Reconnaissance, Testing, Enumeration and eXploitation Toolkit

Vortex VPN Overall Reconnaissance, Testing, Enumeration and Exploitation Toolkit Overview A very simple Python framework, inspired by SprayingToolkit,

315 Dec 28, 2022
Driver Buddy Reloaded is an IDA Pro Python plugin that helps automate some tedious Windows Kernel Drivers reverse engineering tasks.

Driver Buddy Reloaded Quickstart Table of Contents Installation Usage About Driver Buddy Reloaded Finding DispatchDeviceControl Labelling WDM & WDF St

Paolo 'VoidSec' Stagno 199 Jan 04, 2023
Crowbar - A windows post exploitation tool

Crowbar - A windows post exploitation tool Status - ✔️ This project is now considered finished. Any updates from now on will most likely be new script

29 Nov 20, 2022
Profil3r is an OSINT tool that allows you to find potential profiles of a person on social networks, as well as their email addresses 🕵️

Profil3r is an OSINT tool that allows you to find potential profiles of a person on social networks, as well as their email addresses. This program also alerts you to the presence of a data leak for

1.1k Aug 24, 2021
Extendable payload obfuscation and delivery framework

NSGenCS What Is? An extremely simple, yet extensible framework to evade AV with obfuscated payloads under Windows. Installation Requirements Currently

123 Dec 19, 2022
A secure way of storing your passwords.

StrongBox 🔐 A secure way of storing your passwords. 🔑 Why to use StrongBox? StrongBox makes it possible to have a random generated strong password i

Dylan Tintenfich 5 Dec 25, 2021
A curated list of amazingly awesome Cybersecurity datasets

A curated list of amazingly awesome Cybersecurity datasets

758 Dec 28, 2022
DepFine Is a tool to find the unregistered dependency based on dependency confusion valunerablility and lead to RCE

DepFine DepFine Is a tool to find the unregistered dependency based on dependency confusion valunerablility and lead to RCE Installation: You Can inst

Hossam mesbah 14 Nov 11, 2022
A python package with tools to read and postprocess the output of the channel DNS-solver (davecats/channel), as well as its associated postprocessing tools.

Python tools for davecats/channel A python package with tools to read and postprocess the output of the channel dns solver, as well as its associated

Andrea Andreolli 1 Dec 13, 2021
RapiDAST provides a framework for continuous, proactive and fully automated dynamic scanning against web apps/API.

RapiDAST RapiDAST provides a framework for continuous, proactive and fully automated dynamic scanning against web apps/API. Its core engine is OWASP Z

Red Hat Product Security 17 Nov 11, 2022
PoC for CVE-2021-26855 -Just a checker-

CVE-2021-26855 PoC for CVE-2021-26855 -Just a checker- Usage python3 CVE-2021-26855.py -u https://mail.example.com -c example.burpcollaborator.net # C

Abdullah AlZahrani 17 Dec 22, 2022