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
BMW TechOffice MUNICH 148 Dec 21, 2022
A PyTorch Image-Classification With AlexNet And ResNet50.

PyTorch 图像分类 依赖库的下载与安装 在终端中执行 pip install -r -requirements.txt 完成项目依赖库的安装 使用方式 数据集的准备 STL10 数据集 下载:STL-10 Dataset 存储位置:将下载后的数据集中 train_X.bin,train_y.b

FYH 4 Feb 22, 2022
The code of NeurIPS 2021 paper "Scalable Rule-Based Representation Learning for Interpretable Classification".

Rule-based Representation Learner This is a PyTorch implementation of Rule-based Representation Learner (RRL) as described in NeurIPS 2021 paper: Scal

Zhuo Wang 53 Dec 17, 2022
cisip-FIRe - Fast Image Retrieval

Fast Image Retrieval (FIRe) is an open source image retrieval project release by Center of Image and Signal Processing Lab (CISiP Lab), Universiti Malaya. This project implements most of the major bi

CISiP Lab 39 Nov 25, 2022
Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting

Autoformer (NeurIPS 2021) Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting Time series forecasting is a c

THUML @ Tsinghua University 847 Jan 08, 2023
This MVP data web app uses the Streamlit framework and Facebook's Prophet forecasting package to generate a dynamic forecast from your own data.

📈 Automated Time Series Forecasting Background: This MVP data web app uses the Streamlit framework and Facebook's Prophet forecasting package to gene

Zach Renwick 42 Jan 04, 2023
Pytorch implementation of the paper Time-series Generative Adversarial Networks

TimeGAN-pytorch Pytorch implementation of the paper Time-series Generative Adversarial Networks presented at NeurIPS'19. Jinsung Yoon, Daniel Jarrett

Zhiwei ZHANG 21 Nov 24, 2022
Implementation of a memory efficient multi-head attention as proposed in the paper, "Self-attention Does Not Need O(n²) Memory"

Memory Efficient Attention Pytorch Implementation of a memory efficient multi-head attention as proposed in the paper, Self-attention Does Not Need O(

Phil Wang 180 Jan 05, 2023
Temporal-Relational CrossTransformers

Temporal-Relational Cross-Transformers (TRX) This repo contains code for the method introduced in the paper: Temporal-Relational CrossTransformers for

83 Dec 12, 2022
Software & Hardware to do multi color printing with Sharpies

3D Print Colorizer is a combination of 3D printed parts and a Cura plugin which allows anyone with an Ender 3 like 3D printer to produce multi colored

343 Jan 06, 2023
8-week curriculum for AI Builders

curriculum 8-week curriculum for AI Builders สารบัญ บทที่ 1 - Machine Learning คืออะไร บทที่ 2 - ชุดข้อมูลมหัศจรรย์และถิ่นที่อยู่ บทที่ 3 - Stochastic

AI Builders 134 Jan 03, 2023
LONG-TERM SERIES FORECASTING WITH QUERYSELECTOR – EFFICIENT MODEL OF SPARSEATTENTION

Query Selector Here you can find code and data loaders for the paper https://arxiv.org/pdf/2107.08687v1.pdf . Query Selector is a novel approach to sp

MORAI 62 Dec 17, 2022
Unofficial Implementation of Oboe (SIGCOMM'18').

Oboe-Reproduce This is the unofficial implementation of the paper "Oboe: Auto-tuning video ABR algorithms to network conditions, Zahaib Akhtar, Yun Se

Tianchi Huang 13 Nov 04, 2022
Powerful unsupervised domain adaptation method for dense retrieval.

Powerful unsupervised domain adaptation method for dense retrieval

Ubiquitous Knowledge Processing Lab 191 Dec 28, 2022
Hi Guys, here I am providing examples, which will help you in Lerarning Python

LearningPython Hi guys, here I am trying to include as many practice examples of Python Language, as i Myself learn, and hope these will help you in t

4 Feb 03, 2022
Attention Probe: Vision Transformer Distillation in the Wild

Attention Probe: Vision Transformer Distillation in the Wild Jiahao Wang, Mingdeng Cao, Shuwei Shi, Baoyuan Wu, Yujiu Yang In ICASSP 2022 This code is

Wang jiahao 3 Oct 31, 2022
Official PyTorch implementation of RIO

Image-Level or Object-Level? A Tale of Two Resampling Strategies for Long-Tailed Detection Figure 1: Our proposed Resampling at image-level and obect-

NVIDIA Research Projects 17 May 20, 2022
Large scale and asynchronous Hyperparameter Optimization at your fingertip.

Syne Tune This package provides state-of-the-art distributed hyperparameter optimizers (HPO) where trials can be evaluated with several backend option

Amazon Web Services - Labs 236 Jan 01, 2023
Pytorch Implementation of DiffSinger: Diffusion Acoustic Model for Singing Voice Synthesis (TTS Extension)

DiffSinger - PyTorch Implementation PyTorch implementation of DiffSinger: Diffusion Acoustic Model for Singing Voice Synthesis (TTS Extension). Status

Keon Lee 152 Jan 02, 2023
Radar-to-Lidar: Heterogeneous Place Recognition via Joint Learning

radar-to-lidar-place-recognition This page is the coder of a pre-print, implemented by PyTorch. If you have some questions on this project, please fee

Huan Yin 37 Oct 09, 2022