Skip to content

Instantly share code, notes, and snippets.

@garethr
garethr / snyk-spdx.json
Created June 11, 2021 16:11
An example output from snyk2spdx
{
"id": "SPDXRef-todo-list",
"name": "todo-list",
"specVersion": "SPDX-3.0",
"profile": [
"base",
"vulnerabilities"
],
"dataLicense": "CC0-1.0",
"creator": "Organization: Snyk Ltd",
@garethr
garethr / gist:6a517651b62cb43ac3c8a0f9c4ab561d
Created November 6, 2019 14:23
Testinga Clojure project with Snyk
$ lein new reagent-frontend myproject
Retrieving reagent-frontend/lein-template/0.1.55/lein-template-0.1.55.pom from clojars
Retrieving reagent-frontend/lein-template/0.1.55/lein-template-0.1.55.jar from clojars
Generating fresh 'lein new' Reagent frontend project.
$ cd myproject
$ lein pom
Retrieving lein-cljsbuild/lein-cljsbuild/1.1.7/lein-cljsbuild-1.1.7.pom from clojars
Retrieving fs/fs/1.1.2/fs-1.1.2.pom from clojars
Retrieving lein-figwheel/lein-figwheel/0.5.19/lein-figwheel-0.5.19.pom from clojars
@garethr
garethr / kubernetes.rego
Last active August 23, 2022 10:27
Collecting together Kubernetes rego examples, including porting the https://kubesec.io rules to rego
package kubernetes
name = input.metadata.name
kind = input.kind
is_service {
kind = "Service"
}
{
"id":"https://schema.management.azure.com/schemas/2018-05-01/policyDefinition.json#",
"$schema":"http://json-schema.org/draft-04/schema#",
"title":"Policy Definition",
"description":"This schema defines Azure resource policy definition, please see https://azure.microsoft.com/en-us/documentation/articles/resource-manager-policy/ for more details.",
"type":"object",
"properties":{
"if":{
"oneOf":[
{
@garethr
garethr / README.md
Last active May 30, 2022 14:10
Applications demonstrating various Cloud Native tools with Snyk

A set of hello world applications, mainly used for demonstraing Snyk. Although the applications themselves are trivial, each repository contains a toolchain using a variety of Cloud Native tools for building container images and deploying to Kubernetes or other platforms. The current set of applications consists of:

A demo of all the different Snyk products (nearly):

  • Java
  • Maven
  • SpringBoot
  • Kubernetes
@garethr
garethr / load_snyk_db.py
Created June 30, 2019 16:45
An example using the new Python Snky API client to populate a sqlite database for use for datasette
#!/bin/env python3
"""
This script provides a basic example of using the pysnyk Snyk API client
to populate a SQLite database, currently with a list of organizations,
members, projects, vulnerabilies and dependencies.
This is particularly useful combined with datasette, which provides a
handy interface for exploring the data.
@garethr
garethr / purl2snyk.py
Last active February 25, 2022 13:06
A quick example of a shim for PURL for the Snyk APIs
"""
This python scipt is a basic demonstration of providing a shim for the Snyk test APIs for PURL.
This provides a nicer, higher level interface. It was predominantly written to demonstrate
the simplicity of mapping (most of) PURL to the existing Snyk test APIs.
Usage
> purl2snyk test pkg:pypi/django@1.11.1
> purl2snyk test pkg:maven/org.apache.logging.log4j/log4j-core@2.14.0
@garethr
garethr / LICENSE
Last active January 21, 2022 21:33
A script for customers to use the Snyk API to get a list of projects impacted by the Log4Shell vulnerability
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@garethr
garethr / convert.py
Last active July 7, 2021 02:40 — forked from phaer/convert.py
kubernetes open api to hcl2 spec
import sys
import json
from collections import OrderedDict
from contextlib import contextmanager
def resolve_json_pointer(spec, reference):
prefix, definitions, name = reference.split('/')
return spec.get(definitions).get(name)
@garethr
garethr / build.xml
Created March 20, 2011 15:07
Sample ant build file for running rsync and scp base flat file deployment
<project name="{{ name }}" default="help" basedir=".">
<property name="username" value="{{ username }}"/>
<property name="host" value="{{ host }}"/>
<property name="dir" value="/srv/{{ path }}/"/>
<tstamp>
<format property="TODAY_UK" pattern="yyyyMMddhhmmss" locale="en,UK"/>
</tstamp>