Stacs-ci - A set of modules to enable integration of STACS with commonly used CI / CD systems

Overview

Shield Shield Shield Shield Shield Shield




Static Token And Credential Scanner
CI Integrations

What is it?

STACS is a YARA powered static credential scanner which supports source code, binary file formats, analysis of nested archives, composable rule-sets and ignore lists, and SARIF reporting.

This repository contains a set of modules to enable integration of STACS with commonly used CI / CD systems. Currently, supported is:

  • Github Actions

    • Fails the build on unsuppressed findings.
    • Automatically annotates pull requests with findings.
    • Automatically loads suppressions from a stacs.ignore.json in the root of the repository.
  • Generic CI Systems

    • Fails the build on unsuppressed findings.
    • Outputs findings to the console in formatted plain-text.
    • Automatically loads suppressions from a stacs.ignore.json in the scan directory.

Github Actions

This Github action enables running STACS as a Github action. This can be used to identify credentials committed in both source code, or even credentials accidentally compiled into binary artifacts - such as Android APKs, Docker images, RPM packages, ZIP files, and more!

If run as part of a pull request, this action automatically annotates a pull request with findings to allow simplified review integrated with existing code-review processes. As this integration does not use the Github security events framework, no additional subscription to Github is required, even for private repositories!

This action can also be used as part of a release event. Allowing scanning of binaries before publishing to catch credentials which may have been accidentally generated or included as part of the build process.

Additionally, this action can 'fail the build' if any static tokens and credentials are detected.

Appearance

If STACS detects a static credential during a pull request, a review comment will be added to the line containing the static credential:

Github Comment of finding

The STACS Github integration will even check the pull request to see whether there is an existing comment for this finding, preventing multiple comments being added to the same pull request on subsequent commits.

If the credential is found inside of an archive, in a part of a file not modified by the pull request, then a regular comment will be added to the triggering pull request.

Inputs

scan-directory

An optional sub-directory to scan, relative to the repository root. This allows scanning to be limited to a specific directory under the repository root.

Defaults to the repository root.

fail-build

Defines whether this action should 'fail the build' if any static token or credentials are detected. This will take any suppressed / ignore listed entries into account, allowing consumers to ignore known false positives - such as test fixtures.

Defaults to true

Example Usage

The following example scans the currently checked out commit and adds review comments for findings to an associated pull-request (see "Permissions" section below). If the trigger was not a pull-request, findings will instead be printed to the console and STACS CI will exit with a non-zero status (100) if unsupressed findings were present.

uses: stacscan/[email protected]

The following example scans a sub-directory in the repository. In this example the binaries/ sub-directory contains binary objects, compiled for release by another step of a Github actions pipeline.

uses: stacscan/[email protected]
with:
    scan-directory: 'binaries/'

The following example disables 'failing the build' if there are findings which have not been ignored / suppressed.

uses: stacscan/[email protected]
with:
    fail-build: false

Permissions

Please be aware that in order to annotate pull requests with comments, the action must also be granted write permissions to pull-requests. This can be done by adding the following to the respective job in your Github actions pipeline.

permissions:
    contents: read         # Required to read the repository contents (checkout).
    pull-requests: write   # Required to annotate pull requests with comments.

This is only required if running in response to pull-request triggers.

Generic CI

This repository can be integrated with a number of common CI systems using the provided Docker image, or Python module.

The pre-built Docker image greatly simplifies this process and provides a mechanism to quickly execute a STACS scan against a given directory, print the results in an actionable manner, and signal to the CI system that the build should fail on findings.

Appearance

If STACS detects a static credential, a results block will be printed to the console with information required to identify its location:

Terminal output of findings

If the credential is found within an archive, STACS will print a file tree to allow quick identification of exactly where the credential is.

Basic

The simplest form of executing the Generic CI integration can be performed using the following Docker command from the directory to be scanned. Using this default configuration Docker will complete with a non-zero exit code if any unsuppressed findings are found:

docker run -it -v $(pwd):/mnt/stacs/input stacscan/stacs-ci:latest

To prevent a non-zero exit code on unsuppressed findings, such as for initial 'dry run' style operation, the following command can be run:

docker run -it -e FAIL_BUILD=false -v $(pwd):/mnt/stacs/input stacscan/stacs-ci:latest

Jenkins

To be added.

Circle CI

To be added.

Comments
  • [0.1.6] Update to the latest STACS container.

    [0.1.6] Update to the latest STACS container.

    Overview

    Upgrades to the latest STACS container. See the STACS release notes for the new version for a list of changes in this container. Only changes to STACS-CI will be included below.

    🛠️ New Features

    • N/A

    🍩 Improvements

    • N/A

    🐛 Bug Fixes

    • N/A
    opened by darkarnium 2
  • [0.1.5] Update to the latest STACS container.

    [0.1.5] Update to the latest STACS container.

    Overview

    PLEASE NOTE: There is a potentially breaking change as part of this update, as the Stripe rule has been relocated under SaaS. This modifies its reference to now be CredentialSaaSStripeAPI. Any previously suppressed findings for this rule will need to be updated to reflect this new identifier.

    🛠️ New Features

    • Upgrade to the latest STACS rules, which includes new rules for
      • PyPI Token
      • Slack Token
        • User (xoxp-...)
        • Bot (xoxb-...)
      • NPM
        • authToken
        • password
      • PKCS#12 / PFX
      • DER format RSA keys.
        • Detects keys with exponents 3 / 65537, and modulous sizes 64 / 128 / 256 / 512 / 1024.

    🍩 Improvements

    • Minor changes to AWS rule.
    • Simplify matching criteria for a number of rules.

    🐛 Bug Fixes

    • N/A
    opened by darkarnium 2
  • [0.1.4] Github annotation off-by-one bug fix.

    [0.1.4] Github annotation off-by-one bug fix.

    Overview

    🛠️ New Features

    • N/A

    🍩 Improvements

    • Pulls in latest STACS rules (r57ce3ce).

    🐛 Bug Fixes

    • Fix off-by-one edge case which caused Github pull-request annotation to fail.
      • This was triggered when a new file was added in a pull-request containing a credential on the first line.
    opened by darkarnium 1
  • [0.1.3] Update to the latest version of STACS.

    [0.1.3] Update to the latest version of STACS.

    Overview

    🛠️ New Features

    🍩 Improvements

    • Tweak to STACS-CI deployment pipeline to simplify testing prior to release.

    🐛 Bug Fixes

    • N/A
    opened by darkarnium 1
  • [0.1.1] Use latest STACS release, absolute URLs for images

    [0.1.1] Use latest STACS release, absolute URLs for images

    Overview

    🛠️ New Features

    🍩 Improvements

    • N/A

    🐛 Bug Fixes

    • Ensures that file with the finding appears in the change set.
      • This prevents attempts to add a review comment for a file which is already in the target branch.
      • In these cases a comment will be added instead.
    opened by darkarnium 1
  • [0.1.0] Change container tag format, add Action.

    [0.1.0] Change container tag format, add Action.

    Overview

    Unfortunately, Docker does not support + characters in tag names, so we cannot use semver package numbering to indicate rule version.

    🛠️ New Features

    • Add Github Action YAML.
    • Update STACS Rules on STACS CI release.

    🍩 Improvements

    • N/A

    🐛 Bug Fixes

    • N/A
    opened by darkarnium 0
  • [0.1.0] Initial implementation of STACS CI

    [0.1.0] Initial implementation of STACS CI

    Overview

    Initial release of STACS CI Integrations.

    🛠️ New Features

    • Generic CI integration
    • Github Actions integration

    🍩 Improvements

    • N/A

    🐛 Bug Fixes

    • N/A
    opened by darkarnium 0
  • Backport CI UI into STACS

    Backport CI UI into STACS

    Overview

    The STACS-CI UI should be moved back into STACS, removing th need for this repository to contain more than a Github action for STACS execution.

    opened by darkarnium 0
  • Documentation of the stacs.ignore.json

    Documentation of the stacs.ignore.json

    Hi!

    Great tool you are building here - happy with it working so well in a CI context and ease of config.

    I have searched a lot through your repos and am struggling to find docs on the ignore file? Some of the things you describe sound awesome but I am yet to find anything on how to do it :)

    Thanks in advance!

    documentation 
    opened by erzz 5
Releases(0.1.6)
  • 0.1.6(Mar 4, 2022)

    Overview

    Upgrades to the latest STACS container. See the STACS release notes for the new version for a list of changes in this container. Only changes to STACS-CI will be included below.

    🛠️ New Features

    • N/A

    🍩 Improvements

    • N/A

    🐛 Bug Fixes

    • N/A
    Source code(tar.gz)
    Source code(zip)
  • 0.1.5(Jan 18, 2022)

    Overview

    PLEASE NOTE: There is a potentially breaking change as part of this update, as the Stripe rule has been relocated under SaaS. This modifies its reference to now be CredentialSaaSStripeAPI. Any previously suppressed findings for this rule will need to be updated to reflect this new identifier.

    🛠️ New Features

    • Upgrade to the latest STACS rules, which includes new rules for
      • PyPI Token
      • Slack Token
        • User (xoxp-...)
        • Bot (xoxb-...)
      • NPM
        • authToken
        • password
      • PKCS#12 / PFX
      • DER format RSA keys.
        • Detects keys with exponents 3 / 65537, and modulous sizes 64 / 128 / 256 / 512 / 1024.

    🍩 Improvements

    • Minor changes to AWS rule.
    • Simplify matching criteria for a number of rules.

    🐛 Bug Fixes

    • N/A
    Source code(tar.gz)
    Source code(zip)
  • 0.1.4(Jan 11, 2022)

    Overview

    🛠️ New Features

    • N/A

    🍩 Improvements

    • Pulls in latest STACS rules (r57ce3ce).

    🐛 Bug Fixes

    • Fix off-by-one edge case which caused Github pull-request annotation to fail.
      • This was triggered when a new file was added in a pull-request containing a credential on the first line.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.3(Jan 10, 2022)

    Overview

    🛠️ New Features

    🍩 Improvements

    • Tweak to STACS-CI deployment pipeline to simplify testing prior to release.

    🐛 Bug Fixes

    • N/A
    Source code(tar.gz)
    Source code(zip)
  • 0.1.2(Jan 7, 2022)

  • 0.1.1(Jan 4, 2022)

    Overview

    🛠️ New Features

    🍩 Improvements

    • N/A

    🐛 Bug Fixes

    • Ensures that file with the finding appears in the change set.
      • This prevents attempts to add a review comment for a file which is already in the target branch.
      • In these cases a comment will be added instead.
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Jan 2, 2022)

    Overview

    Initial release of STACS CI Integrations.

    🛠️ New Features

    • Github Actions

      • Fails the build on unsuppressed findings.
      • Automatically annotates pull requests with findings.
      • Automatically loads suppressions from a stacs.ignore.json in the root of the repository.
    • Generic CI Systems

      • Fails the build on unsuppressed findings.
      • Outputs findings to the console in formatted plain-text.
      • Automatically loads suppressions from a stacs.ignore.json in the scan directory.

    🍩 Improvements

    • N/A

    🐛 Bug Fixes

    • N/A
    Source code(tar.gz)
    Source code(zip)
Owner
STACS
Static Token And Credential Scanner
STACS
Automatically download the cwru data set, and then divide it into training data set and test data set

Automatically download the cwru data set, and then divide it into training data set and test data set.自动下载cwru数据集,然后分训练数据集和测试数据集

null 6 Jun 27, 2022
Voxel Set Transformer: A Set-to-Set Approach to 3D Object Detection from Point Clouds (CVPR 2022)

Voxel Set Transformer: A Set-to-Set Approach to 3D Object Detection from Point Clouds (CVPR2022)[paper] Authors: Chenhang He, Ruihuang Li, Shuai Li, L

Billy HE 141 Dec 30, 2022
Script that receives an Image (original) and a set of images to be used as "pixels" in reconstruction of the Original image using the set of images as "pixels"

picinpics Script that receives an Image (original) and a set of images to be used as "pixels" in reconstruction of the Original image using the set of

RodrigoCMoraes 1 Oct 24, 2021
Pytorch modules for paralel models with same architecture. Ideal for multi agent-based systems

WideLinears Pytorch parallel Neural Networks A package of pytorch modules for fast paralellization of separate deep neural networks. Ideal for agent-b

null 1 Dec 17, 2021
Western-3DSlicer-Modules - Point-Set Registrations for Ultrasound Probe Calibrations

Point-Set Registrations for Ultrasound Probe Calibrations -Undergraduate Thesis-

Matteo Tanzi 0 May 4, 2022
null 2 Jul 19, 2022
Code for Private Recommender Systems: How Can Users Build Their Own Fair Recommender Systems without Log Data? (SDM 2022)

Private Recommender Systems: How Can Users Build Their Own Fair Recommender Systems without Log Data? (SDM 2022) We consider how a user of a web servi

joisino 20 Aug 21, 2022
Magisk module to enable hidden features on Android 12 Developer Preview 1.

Android 12 Extensions This is a Magisk module that enables hidden features on Android 12 Developer Preview 1. Features Scrolling screenshots Wallpaper

Danny Lin 384 Jan 6, 2023
Bayesian-Torch is a library of neural network layers and utilities extending the core of PyTorch to enable the user to perform stochastic variational inference in Bayesian deep neural networks

Bayesian-Torch is a library of neural network layers and utilities extending the core of PyTorch to enable the user to perform stochastic variational inference in Bayesian deep neural networks. Bayesian-Torch is designed to be flexible and seamless in extending a deterministic deep neural network architecture to corresponding Bayesian form by simply replacing the deterministic layers with Bayesian layers.

Intel Labs 210 Jan 4, 2023
This repository is based on Ultralytics/yolov5, with adjustments to enable polygon prediction boxes.

Polygon-Yolov5 This repository is based on Ultralytics/yolov5, with adjustments to enable polygon prediction boxes. Section I. Description The codes a

xinzelee 226 Jan 5, 2023
This repository is based on Ultralytics/yolov5, with adjustments to enable rotate prediction boxes.

Rotate-Yolov5 This repository is based on Ultralytics/yolov5, with adjustments to enable rotate prediction boxes. Section I. Description The codes are

xinzelee 90 Dec 13, 2022
Simply enable or disable your Nvidia dGPU

EnvyControl (WIP) Simply enable or disable your Nvidia dGPU Usage First clone this repo and install envycontrol with sudo pip install . CLI Turn off y

Victor Bayas 292 Jan 3, 2023
SeisComP/SeisBench interface to enable deep-learning (re)picking in SeisComP

scdlpicker SeisComP/SeisBench interface to enable deep-learning (re)picking in SeisComP Objective This is a simple deep learning (DL) repicker module

Joachim Saul 6 May 13, 2022
The pyrelational package offers a flexible workflow to enable active learning with as little change to the models and datasets as possible

pyrelational is a python active learning library developed by Relation Therapeutics for rapidly implementing active learning pipelines from data management, model development (and Bayesian approximation), to creating novel active learning strategies.

Relation Therapeutics 95 Dec 27, 2022
This is our ARTS test set, an enriched test set to probe Aspect Robustness of ABSA.

This is the repository for our 2020 paper "Tasty Burgers, Soggy Fries: Probing Aspect Robustness in Aspect-Based Sentiment Analysis". Data We provide

null 35 Nov 16, 2022
Open-Set Recognition: A Good Closed-Set Classifier is All You Need

Open-Set Recognition: A Good Closed-Set Classifier is All You Need Code for our paper: "Open-Set Recognition: A Good Closed-Set Classifier is All You

null 194 Jan 3, 2023
This repository contains the implementations related to the experiments of a set of publicly available datasets that are used in the time series forecasting research space.

TSForecasting This repository contains the implementations related to the experiments of a set of publicly available datasets that are used in the tim

Rakshitha Godahewa 80 Dec 30, 2022
A library of extension and helper modules for Python's data analysis and machine learning libraries.

Mlxtend (machine learning extensions) is a Python library of useful tools for the day-to-day data science tasks. Sebastian Raschka 2014-2020 Links Doc

Sebastian Raschka 4.2k Jan 2, 2023