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

Related tags

Deep Learningstacs-ci
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
This project deploys a yolo fastest model in the form of tflite on raspberry 3b+. The model is from another repository of mine called -Trash-Classification-Car

Deploy-yolo-fastest-tflite-on-raspberry 觉得有用的话可以顺手点个star嗷 这个项目将垃圾分类小车中的tflite模型移植到了树莓派3b+上面。 该项目主要是为了记录在树莓派部署yolo fastest tflite的流程 (之后有时间会尝试用C++部署来提升

7 Aug 16, 2022
Implementation of Advantage-Weighted Regression: Simple and Scalable Off-Policy Reinforcement Learning

advantage-weighted-regression Implementation of Advantage-Weighted Regression: Simple and Scalable Off-Policy Reinforcement Learning, by Peng et al. (

Omar D. Domingues 1 Dec 02, 2021
A distributed deep learning framework that supports flexible parallelization strategies.

FlexFlow FlexFlow is a deep learning framework that accelerates distributed DNN training by automatically searching for efficient parallelization stra

528 Dec 25, 2022
Convert human motion from video to .bvh

video_to_bvh Convert human motion from video to .bvh with Google Colab Usage 1. Open video_to_bvh.ipynb in Google Colab Go to https://colab.research.g

Dene 306 Dec 10, 2022
On Out-of-distribution Detection with Energy-based Models

On Out-of-distribution Detection with Energy-based Models This repository contains the code for the experiments conducted in the paper On Out-of-distr

Sven 19 Aug 07, 2022
STEAL - Learning Semantic Boundaries from Noisy Annotations (CVPR 2019)

STEAL This is the official inference code for: Devil Is in the Edges: Learning Semantic Boundaries from Noisy Annotations David Acuna, Amlan Kar, Sanj

469 Dec 26, 2022
A Simulated Optimal Intrusion Response Game

Optimal Intrusion Response An OpenAI Gym interface to a MDP/Markov Game model for optimal intrusion response of a realistic infrastructure simulated u

Kim Hammar 10 Dec 09, 2022
A tool to visualise the results of AlphaFold2 and inspect the quality of structural predictions

AlphaFold Analyser This program produces high quality visualisations of predicted structures produced by AlphaFold. These visualisations allow the use

Oliver Powell 3 Nov 13, 2022
sequitur is a library that lets you create and train an autoencoder for sequential data in just two lines of code

sequitur sequitur is a library that lets you create and train an autoencoder for sequential data in just two lines of code. It implements three differ

Jonathan Shobrook 305 Dec 21, 2022
Official PyTorch Implementation of HELP: Hardware-adaptive Efficient Latency Prediction for NAS via Meta-Learning (NeurIPS 2021 Spotlight)

[NeurIPS 2021 Spotlight] HELP: Hardware-adaptive Efficient Latency Prediction for NAS via Meta-Learning [Paper] This is Official PyTorch implementatio

42 Nov 01, 2022
PyGCL: Graph Contrastive Learning Library for PyTorch

PyGCL: Graph Contrastive Learning for PyTorch PyGCL is an open-source library for graph contrastive learning (GCL), which features modularized GCL com

GCL: Graph Contrastive Learning Library for PyTorch 594 Jan 08, 2023
Final project for machine learning (CSC 590). Detection of hepatitis C and progression through blood samples.

Hepatitis C Blood Based Detection Final project for machine learning (CSC 590). Dataset from Kaggle. Using data from previous hepatitis C blood panels

Jennefer Maldonado 1 Dec 28, 2021
AdelaiDepth is an open source toolbox for monocular depth prediction.

AdelaiDepth is an open source toolbox for monocular depth prediction.

Adelaide Intelligent Machines (AIM) Group 743 Jan 01, 2023
Deploy optimized transformer based models on Nvidia Triton server

Deploy optimized transformer based models on Nvidia Triton server

Lefebvre Sarrut Services 1.2k Jan 05, 2023
Code for "Steerable Pyramid Transform Enables Robust Left Ventricle Quantification"

Code for "Steerable Pyramid Transform Enables Robust Left Ventricle Quantification" This is an end-to-end framework for accurate and robust left ventr

2 Jul 09, 2022
A pytorch implementation of Reading Wikipedia to Answer Open-Domain Questions.

DrQA A pytorch implementation of the ACL 2017 paper Reading Wikipedia to Answer Open-Domain Questions (DrQA). Reading comprehension is a task to produ

Runqi Yang 394 Nov 08, 2022
FinRL­-Meta: A Universe for Data­-Driven Financial Reinforcement Learning. 🔥

FinRL-Meta: A Universe of Market Environments. FinRL-Meta is a universe of market environments for data-driven financial reinforcement learning. Users

AI4Finance Foundation 543 Jan 08, 2023
GARCH and Multivariate LSTM forecasting models for Bitcoin realized volatility with potential applications in crypto options trading, hedging, portfolio management, and risk management

Bitcoin Realized Volatility Forecasting with GARCH and Multivariate LSTM Author: Chi Bui This Repository Repository Directory ├── README.md

Chi Bui 113 Dec 29, 2022
Python scripts for performing 3D human pose estimation using the Mobile Human Pose model in ONNX.

Python scripts for performing 3D human pose estimation using the Mobile Human Pose model in ONNX.

Ibai Gorordo 99 Dec 31, 2022
An implementation of a discriminant function over a normal distribution to help classify datasets.

CS4044D Machine Learning Assignment 1 By Dev Sony, B180297CS The question, report and source code can be found here. Github Repo Solution 1 Based on t

Dev Sony 6 Nov 09, 2021