Skip to content

Instantly share code, notes, and snippets.

@tuladhar
tuladhar / dodgy.yaml
Created June 17, 2023 13:42
Bypassing Branch Protections with Github Actions (CI/CD) - https://www.youtube.com/watch?v=UbfhVXJn6fk
# Disclaimer: This code is provided for educational and research purposes only.
# It is not intended, nor should it be used, for malicious activities.
# The author and distributor of this code do not endorse or promote the
# unauthorized penetration of computer systems or networks
name: APPROVE
on: pull_request
permissions:
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: github-actions
region: us-east-1
nodeGroups:
- name: ng-1
instanceType: c6g.large
desiredCapacity: 1
volumeSize: 14
# This is a basic workflow to help you get started with Actions
name: Hello World
# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
name: runner-deployment
spec:
template:
spec:
repository: tuladhar/self-hosted-runner
---
apiVersion: actions.summerwind.dev/v1alpha1
#!/usr/bin/env python
import json
import sys
for k, v in json.load(sys.stdin).items():
print("{}='{}' export {};".format(k, v, k))
[zram0]
zram-fraction = 1
max-zram-size=none
package main
import (
"time"
"encoding/json"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-lambda-go/events"
)
package main
import (
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-lambda-go/events"
)
func handler(snsEvent events.SNSEvent) (error) {
return nil
}
Outputs:
TopicArn:
Value: !Ref Topic
Export:
Name: !Sub "${EnvironmentName}:ElastiCache:Events:TopicArn"
LambdaPermission:
Type: AWS::Lambda::Permission
Properties:
Action: 'lambda:InvokeFunction'
FunctionName: !Ref LambdaFunction
Principal: sns.amazonaws.com
SourceArn: !Ref Topic