{"id":17685967,"url":"https://github.com/geekmasher/advanced-security-compliance","last_synced_at":"2025-03-30T01:32:21.662Z","repository":{"id":44771588,"uuid":"372449229","full_name":"GeekMasher/advanced-security-compliance","owner":"GeekMasher","description":"GitHub Advance Security Compliance Action","archived":false,"fork":false,"pushed_at":"2022-12-14T13:49:41.000Z","size":502,"stargazers_count":131,"open_issues_count":1,"forks_count":29,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-09-20T00:48:21.214Z","etag":null,"topics":["code-scanning","devsecops","ghas","security","security-automation"],"latest_commit_sha":null,"homepage":"https://geekmasher.github.io/advanced-security-compliance/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GeekMasher.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2021-05-31T09:18:09.000Z","updated_at":"2024-07-17T13:18:21.000Z","dependencies_parsed_at":"2022-08-29T00:50:44.544Z","dependency_job_id":null,"html_url":"https://github.com/GeekMasher/advanced-security-compliance","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeekMasher%2Fadvanced-security-compliance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeekMasher%2Fadvanced-security-compliance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeekMasher%2Fadvanced-security-compliance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeekMasher%2Fadvanced-security-compliance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GeekMasher","download_url":"https://codeload.github.com/GeekMasher/advanced-security-compliance/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221305349,"owners_count":16795120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-scanning","devsecops","ghas","security","security-automation"],"created_at":"2024-10-24T10:29:35.209Z","updated_at":"2024-10-24T10:29:35.640Z","avatar_url":"https://github.com/GeekMasher.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":":warning: This repository is no longer maintained after v1.7.0! :warning:\n\n# advanced-security-compliance\n\nPlease use the [GitHub Advanced Security Policy as Code](https://github.com/advanced-security/policy-as-code) action / repository instead.\n\nThis Action was designed to allow users to configure their Risk threshold for security issues reported by [GitHub Code Scanning](https://docs.github.com/en/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning), [Secret Scanning](https://docs.github.com/en/code-security/secret-security/about-secret-scanning) and [Dependabot Security](https://docs.github.com/en/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/configuring-dependabot-security-updates#about-configuring-dependabot-security-updates).\n\n## Capability Demonstration\n\nhttps://user-images.githubusercontent.com/2083085/131956624-e3f5140a-40e6-4067-9377-1093775aaa01.mp4\n\n\n## Setup\n\n### Action\n\nHere is how you can quickly setup advanced-security-compliance. \n\n```yaml\n# Compliance\n- name: Advance Security Compliance Action\n  uses: GeekMasher/advanced-security-compliance@v1.7.0\n```\n\n#### Action Examples\n\n- [General Security](examples/workflows/security.yml)\n- [Full Example with Details](examples/workflows/full.yml)\n- [Licensing Compliance](examples/workflows/licensing.yml)\n- [Policy as Code Compliance](examples/workflows/licensing.yml)\n\n### CLI\n\nThe CLI tool primarily using pipenv to manage dependencies and pip virtual environments to not mismatch dependencies.\n\n```bash\n# Install dependencies and virtual environment\npipenv install\n# [option] Install system wide\npipenv install --system\n```\n\nOnce installed, you can just call the module using the following command(s):\n\n```bash\n# Using pipenv script\npipenv run main --help\n# ... or\npipenv run python -m ghascompliance\n```\n\n#### CLI Examples\n\n- [Code Scanning](examples/scripts/codescanning.sh)\n- [Dependencies](examples/scripts/dependencies.sh)\n- [Policies](examples/scripts/policies.sh)\n\n## Policy as Code / PaC\n\nHere is an example of using a simple yet cross-organization using Policy as Code:\n\n```yaml\n# Compliance\n- name: Advance Security Compliance Action\n  uses: GeekMasher/advanced-security-compliance@v1.7.0\n  with:\n    # The owner/repo of where the policy is stored  \n    policy: GeekMasher/security-queries\n    # The local (within the workspace) or repository\n    policy-path: policies/default.yml\n    # The branch you want to target\n    policy-branch: main\n```\n\n\n### PaC Configuration file\n\nThe 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.\n\n```yaml\n# This is the technology you want to write a rule for\nlicensing:\n  # The four main rules types to do everything you need to do for all things \n  #  compliance\n\n  # Warnings will always occur if the rule applies and continues executing to \n  #  other rules.\n  warnings:\n    ids:\n      - Other\n      - NA\n  # Ignores are run next so if an ignored rule is hit that matches the level, \n  #  it will be skipped\n  ignores:\n    ids:\n      - MIT License\n  # Conditions will only trigger and raise an error when an exact match is hit\n  conditions:\n    ids:\n      - GPL-2.0\n    names:\n      - tunnel-agent\n\n  # The simplest and ultimate rule which checks the severity of the alert and\n  #  reports an issue if the level matches or higher (see PaC Levels for more info)\n  level: error\n```\n\n\n#### PaC Levels\n\nThere are many different levels of severities with the addition of `all` and `none` (self explanatory).\nWhen a level is selected like for example `error`, all higher level severities (`critical` and `high` in this example) will also be added.\n\n```yml\n- critical\n- high\n- error\n- medium\n- moderate\n- low\n- warning\n- notes\n```\n\n\n#### PaC Rule Blocks\n\nFor each rule you can choose either or both of the two different criteria's matches; `ids` and `names`\n\nYou can also use `imports` to side load data from other files to supplement the data already in the rule block\n\n```yaml\ncodescanning:\n  conditions:\n    # When the `ids` of the technologies/tool alert matches any one of the ID's in \n    #  the list specified, the rule will the triggered and report the alert.\n    ids:\n      # In this example case, the CodeQL rule ID below will always be reported if \n      #  present event if the severity is low or even note.\n      - js/sql-injection\n\n      # Side note: Check to see what different tools consider id's verses names,\n      #  for example `licensing` considers the \"Licence\" name itself as the id \n      #  while the name of the package/library as the \"name\"\n    \n    # `names` allows you to specify the names of alerts or packages.\n    names:\n      - \"Missing rate limiting\"\n\n    # The `imports` allows you to supplement your existing data with a list\n    #  from a file on the system. \n    imports:\n     ids: \"path/to/ids/supplement/file.txt\"\n     names: \"path/to/names/supplement/file.txt\"\n\n```\n\n\n#### Wildcards\n\nFor both types of criteria matching you can use wildcards to easily match requirements in a quicker way.\nThe matching is done using a Unix shell-style wildcards module called [fnmatch](https://docs.python.org/3/library/fnmatch.html) which supports `*` for matching everything.\n\n```yaml\ncodescanning:\n  conditions:\n    ids:\n      - '*/sql-injection'\n```\n\n\n#### Time to Remediate\n\nThe 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.\n\nBy default, if this section is not defined in any part of the policy then no checks are done.\nExisting policy files should act the same without the new section.\n\n\n```yaml\ngeneral:\n  # All other blocks will be inheriting the remediate section if they don't have \n  #  their own defined.\n  remediate:\n    # Only `error`'s and above have got 7 days to remediate according to the \n    #  policy. Any time before that, nothing will occur and post the remediation \n    #  time frame the alert will be raised. \n    error: 7\n\ncodescanning:\n  # the `codescanning` block will inherit the `general` block\n  # ...\n\ndependabot:\n  remediate:\n    # high and critical security issues\n    high: 7\n    # moderate security issues\n    moderate: 30\n    # all other security issues\n    all: 90\n\nsecretscanning:\n  remediate:\n    # All secrets by default are set to 'critical' severity so only `critical` \n    #  or `all` will work\n    critical: 7\n```\n\n##### Time to Remediate Examples\n\n- [Time to Remediate Example](examples/policies/time-to-remediate.yml)\n\n\n#### Data Importing\n\nSome things to consider when using imports:\n\n- Imports appending to existing lists and do not replace a previously generated list.\n- Imports are relative to:\n  - `Working Directory`\n  - `GitHub Action / CLI directory`\n  - `Cloned Repository Directory`\n- Imports are only allowed from a number of predefined paths to prevent loading data on the system (AKA, path traversal). \n\n\n## Dependency Typosquatting\n\nDependency Typosquatting is a package or library with malicious intent to compromise supply chains or CI systems by extracting data from the environment to a threat actor.\n\nBuilt into this tool is the ability to look up every package known in your supply chain from the GitHub Dependency Graph and check if it matches against [a list of know malicious packages](ghascompliance/defaults/typosquatting.txt).\n\n\n## Licensing Notice\n\n```\nMIT License\n\nCopyright (c) 2021 Mathew Payne\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeekmasher%2Fadvanced-security-compliance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeekmasher%2Fadvanced-security-compliance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeekmasher%2Fadvanced-security-compliance/lists"}