Coder Social home page Coder Social logo

isabella232 / github-webhook-rotate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from buildkite/github-webhook-rotate

0.0 0.0 0.0 21 KB

A utility for rotating the pipeline webhooks used by github triggering builds

License: MIT License

Go 100.00%

github-webhook-rotate's Introduction

Buildkite Webhook Rotate for Github

This is a utility for rotating the secret webhooks used for triggering builds in a Buildkite Pipeline.

Whilst these webhooks verify the source address belongs to GitHub, if they are disclosed we recommend rotation.

This tools requires a Github Personal Access Token with admin:repo_hook and a Buildkite GraphQL API token.

Installation

This uses Go 1.12 with modules enabled.

go get -u github.com/buildkite/github-webhook-rotate

Running

By default the tool will prompt before each change that is made.

export GRAPHQL_TOKEN="...."
export GITHUB_TOKEN="..."

github-webhook-rotate \
  --buildkite-org="<my-org>" \
  --graphql-token "$GRAPHQL_TOKEN" \
  --github-token "$GITHUB_TOKEN"

How it works

  • Enumerate all Buildkite pipelines via GraphQL
  • For each Pipeline, infer the GitHub repository
  • For each GitHub Repository, enumerate Buildkite hooks and build a mapping
  • For each Pipeline
    • Rotate the build webhook with the pipelineRotateWebhookURL GraphQL mutation
    • Update all Github Repository webhooks that refer to the updated webhook

Copyright

Copyright (c) 2019 Buildkite Pty Ltd. See LICENSE for details.

github-webhook-rotate's People

Contributors

lox avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.