Skip to content

Instantly share code, notes, and snippets.

View joshjohanning's full-sized avatar
:octocat:

Josh Johanning joshjohanning

:octocat:
View GitHub Profile
@joshjohanning
joshjohanning / action.yml
Created January 12, 2022 23:13
use an app id, installation id, and private key to clone a repo with github apps
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
@joshjohanning
joshjohanning / vulnerability.js
Created January 13, 2022 17:31
introduce code vulnerability in ghas
function endsWith(x,y) {
let index = x.lastIndexOf(y);
return x.lastIndexOf(y) === x.length - y.length;
}
// comment
@joshjohanning
joshjohanning / action.yml
Last active January 31, 2022 19:31
Workflow dispatch inputs and defaults with other on: trigger events
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
build_run_id_to_deploy:
description: 'the build run id to download for deploy'
required: true
default: '1703586018'
env:
build_run_id_to_deploy: '1703586018'
@joshjohanning
joshjohanning / generate-release-notes.ps1
Created March 1, 2022 23:56
generate-release-notes
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Accept", "application/vnd.github.v3+json")
$headers.Add("Authorization", "Bearer <add your PAT here>")
$headers.Add("Content-Type", "application/json")
$body = "{ `n `"tag_name`": `"newest`",`n `"previous_tag_name`": `"newer`"`n}"
$response = Invoke-RestMethod 'https://api.github.com/repos/services-octoshift-demo/Test-Octoshift-2/releases/generate-notes' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
@joshjohanning
joshjohanning / actions-runner-controller-self-signed-certs.md
Last active June 28, 2022 23:06
self-signed certs for actions-runner-controller
  1. Create RSA keys for CA cert, server cert - this will output ca-key.key and server-key.key
openssl genrsa -out ca.key 4096
openssl genrsa -out server.key 4096
  1. Create a ca.conf ca config file
@joshjohanning
joshjohanning / runner.yaml
Created June 28, 2022 23:15
runner.yaml for actions-runner-controller with org runners and metric-based scaling
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
name: joshjohanning-org-runner
spec:
replicas: 1
template:
spec:
organization: joshjohanning-org
group: k8s-group
@joshjohanning
joshjohanning / configuration.json
Last active August 3, 2022 11:52
configuration.json for nkdAgility/azure-devops-migration-tools - v11.9.33
{
"Version": "11.9",
"ChangeSetMappingFile": null,
"Source": {
"$type": "TfsTeamProjectConfig",
"Collection": "https://dev.azure.com/SOURCE_ORG",
"Project": "Demos",
"ReflectedWorkItemIDFieldName": "Custom.ReflectedWorkItemId",
"AllowCrossProjectLinking": false,
"AuthenticationMode": "Prompt",
@joshjohanning
joshjohanning / New.cs
Created August 24, 2022 16:31
sample vulnerable .NET C# code for CodeQL
using System;
using System.Security.Cryptography;
class WeakEncryption
{
public static byte[] encryptString()
{
SymmetricAlgorithm serviceProvider = new DESCryptoServiceProvider();
byte[] key = { 16, 22, 240, 11, 18, 150, 192, 21 };
serviceProvider.Key = key;
ICryptoTransform encryptor = serviceProvider.CreateEncryptor();
@joshjohanning
joshjohanning / Add-Vulnerable-NuGet-Package.sh
Created August 24, 2022 16:56
Sample vulnerable NuGet package for Dependabot
dotnet add src/MyProject.csproj package Microsoft.Data.OData -v 5.0.1
@joshjohanning
joshjohanning / github-advanced-security-resources.md
Last active September 16, 2022 17:51
GitHub Advanced Security Resources