Skip to content

Instantly share code, notes, and snippets.

@mattatsnyk
mattatsnyk / snyk_iac_with_uid.sh
Last active March 7, 2024 21:23
A script to run IaC+ scans and retrieve the unique ID associated with them
#!/usr/bin/env bash
set -o nounset -o pipefail
# Run the snyk scan and save exit code
snyk iac test --org=c6605e26-42f6-4c23-a347-72827bdab7cd --report --json > iac-results.json
exit_code=$?
# Query API for ID of previous scan and append to file
curl -s -L 'https://api.snyk.io/rest/orgs/c6605e26-42f6-4c23-a347-72827bdab7cd/cloud/scans?version=2024-02-28~beta&environment_id=58e8a75b-bd88-488c-9eb5-8b2ea8bef0a6' \
--header "authorization: $snyk_token" | jq '.data[0].id' >> iac-results.json
@mattatsnyk
mattatsnyk / get_snyk_ignores.py
Created January 22, 2024 20:22
A simple script to pull down snyk ignores for an organization
#!/opt/homebrew/bin/python3
import requests
# Replace with the relevant snyk api token and org ID
api_token = ""
org_id = ""
issuesPerPage = 100
api_version = "2024-01-04"
@mattatsnyk
mattatsnyk / Jenkinsfile.groovy
Created April 7, 2023 15:45
example-jenkinsfile-for-.NET
pipeline {
agent any
// Requires a configured NodeJS installation via https://plugins.jenkins.io/nodejs/
tools { nodejs "NodeJS 18.4.0" }
stages {
stage('git clone') {
steps {
git url: 'https://github.com/mattatsnyk/TodoList-.net'
@mattatsnyk
mattatsnyk / accept.json
Created August 31, 2022 13:12
GitHubEnterprise-code-snippets-accept.json
{
"public": [
{
"//": "used for pushing up webhooks from github",
"method": "POST",
"path": "/webhook/github",
"valid": [
{
"//": "accept all pull request state changes (these don't have files in them)",
"path": "pull_request.state",
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.25.0
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
ignore:
'snyk:lic:golang:symbol:MPL-2.0':
- '*':
reason: this license is fine for keptn
created: 2022-07-12T09:35:29.655Z
patch: {}
exclude:
@mattatsnyk
mattatsnyk / gist:23a4e0cd067c85943813a067e22b347c
Created July 18, 2022 14:11
accept.json for Bitbucket Server with Code Snippets and IaC added to private array
{
"public":[
{
"//":"used for pushing up webhooks from bitbucket-server",
"method":"POST",
"path":"/webhook/bitbucket-server/:webhookId"
}
],
"private":[
{