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
Fetch Chrome, Firefox, WiFi password and system info

DISCLAIMER : OUR TOOLS ARE FOR EDUCATIONAL PURPOSES ONLY. DON'T USE THEM FOR ILLEGAL ACTIVITIES. YOU ARE THE ONLY RESPONSABLE FOR YOUR ACTIONS! OUR TO

Genos 59 Nov 17, 2022
Password-Manager - This app can generate ,save , find and delete passwords.

Password-Manager This app can generate ,save , find and delete passwords. In the StartUp() Function , there are three buttons to choose from : Generat

1 Jan 01, 2022
Aiminsun 165 Dec 21, 2022
Fast Fb Cracking Tool

fb-brute Fast Fb Cracking Tool 🏆

Aryan 8 Jun 29, 2022
Patching - Interactive Binary Patching for IDA Pro

Patching - Interactive Binary Patching for IDA Pro Overview Patching assembly code to change the behavior of an existing program is not uncommon in ma

589 Dec 30, 2022
A tool to crack a wifi password with a help of wordlist

A tool to crack a wifi password with a help of wordlist. This may take long to crack a wifi depending upon number of passwords your wordlist contains. Also it is slower as compared to social media ac

Saad 144 Dec 29, 2022
Compilation of resources and insights that helped me on my journey to data scientist

Compilation of resources and insights that helped me on my journey to data scientist

Conor Dewey 1.5k Jan 02, 2023
🔎 Most Advanced Open Source Intelligence (OSINT) Framework for scanning IP Address, Emails, Websites, Organizations.

🔎 Most Advanced Open Source Intelligence (OSINT) Framework for scanning IP Address, Emails, Websites, Organizations.

BhavKaran 1.5k Dec 28, 2022
xray多线程批量扫描工具

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

1frame 13 Nov 09, 2022
Provides script to download and format public IP lists related to the Log4j exploit.

Provides script to download and format public IP lists related to the Log4j exploit. Current format includes: plain list, Cisco ASA Network Group.

Gianluca Ulivi 1 Jan 02, 2022
对安卓APP注入MSF PAYLOAD,并且对手机管家进行BYPASS。

520_APK_HOOK 介绍 将msf生成的payload,注入到一个正常的apk文件中,重新打包后进行加固,bypass手机安全管家的检测。 项目地址: https://github.com/cleverbao/520apkhook 作者: BaoGuo 优点 相比于原始的msf远控,此版本ap

BaoGuo 368 Jan 02, 2023
CVE-2021-22986 & F5 BIG-IP RCE

Vuln Impact This vulnerability allows for unauthenticated attackers with network access to the iControl REST interface, through the BIG-IP management

Al1ex 85 Dec 02, 2022
Scan all java processes on your host to check weather it's affected by log4j2 remote code execution

Log4j2 Vulnerability Local Scanner (CVE-2021-45046) Log4j 漏洞本地检测脚本,扫描主机上所有java进程,检测是否引入了有漏洞的log4j-core jar包,是否可能遭到远程代码执行攻击(CVE-2021-45046)。上传扫描报告到指定的服

86 Dec 09, 2022
Confluence Server Webwork OGNL injection

CVE-2021-26084 - Confluence Server Webwork OGNL injection An OGNL injection vulnerability exists that would allow an authenticated user and in some in

Fellipe Oliveira 295 Jan 06, 2023
Find exposed API keys based on RegEx and get exploitation methods for some of keys that are found

dora Features Blazing fast as we are using ripgrep in backend Exploit/PoC steps for many of the API key, allowing to write a good report for bug bount

Siddharth Dushantha 243 Dec 27, 2022
Experimental musig2 python code, not for production use!

musig2-py Experimental musig2 python code, not for production use! This is just for testing things out. All public keys are encoded as 32 bytes, assum

Samuel Dobson 14 Jul 08, 2022
This a simple tool XSS Detection Suite for CTFs games

This a simple tool XSS Detection Suite for CTFs games

Mostafa 2 Nov 24, 2021
open detection and scanning tool for discovering and fuzzing for Log4J RCE CVE-2021-44228 vulnerability

CVE-2021-44228-log4jVulnScanner-metasploit open detection and scanning tool for discovering and fuzzing for Log4J RCE CVE-2021-44228 vulnerability pre

Taroballz 7 Nov 09, 2022
Ensure secure infrastructure and consistency with the firewall rules

Python Port Scanner This script tries to check if it's possible to make a connection with the specific endpoint port. This is very useful to ensure se

Allan Avelar 7 Feb 26, 2022