Skip to main content

Audit Repository Cloner

This repository contains a Python package to clone a repo and automatically prepare it for Cyfrin audit report generation.

What it does

It will take the following steps:

  1. Take the source repository you want to set up for audit
  2. Take the target repository name you want to use for the private --repo
  3. Add an issue_template to the repo, so issues can be formatted as audit findings, like:
**Description:**
**Impact:**
**Proof of Concept:**
**Recommended Mitigation:**
**[Project]:** 
**Cyfrin:**
  1. Update labels to label issues based on severity and status
  2. Create an audit tag at the given commit hash (full SHA)
  3. Create branches for each of the auditors participating
  4. Create a branch for the final report
  5. Add the report-generator-template to the repo to make it easier to compile the report, and add a button in GitHub actions to re-generate the report on-demand
  6. Attempt to set up a GitHub project board

Note: Changes to report-generator-template can be pulled into the generated repo by running:

git subtree pull --prefix cyfrin-report/report-generator-template https://github.com/Cyfrin/report-generator-template main --squash

Getting Started

Requirements

  • git
    • You'll know you did it right if you can run git --version and you see a response like git version x.x.x
  • Python
    • You'll know you've installed python right if you can run:
      • python --version or python3 --version and get an ouput like: Python x.x.x
  • pip
    • You'll know you did it right if you can run pip --version or pip3 --version and get an output like pip x.x from /some/path/here (python x.x)

Installation

To install from source:

git clone https://github.com/Cyfrin/audit-repo-cloner
cd audit-repo-cloner
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

To install from pipx:

pipx install audit-repo-cloner

And if installing from source with pipx package already installed, install in editable mode:

pip install -e .

You'll know you've installed it correctly if you can run:

audit_repo_cloner --version

And get an output like:

audit_repo_cloner, version 0.2.2

Getting a GitHub token

To use this, you'll need a github personal access token. Please view the docs to set one up.

You can then set it as an environment variable or input it via the CLI:

export ACCESS_TOKEN=xxxxxx

Note: this access token is only used to create the repo initially. To allow the GitHub Action to run the report generator (fetching issues) in CI, be sure to set appropriate permissions for the global GITHUB_TOKEN secret.

Usage

Note: $ denotes a command to run in the terminal

Help

audit_repo_cloner --help

As a single command

From source:

python ./create_audit_repo.py`

Otherwise (pipx):

audit_repo_cloner --source-url https://github.com/PatrickAlphaC/hardhat-smartcontract-lottery-fcc --target-repo-name "" --commit-hash 5e4872358cd2bda1936c29f460ece2308af4def6 --auditors "tricky-p blue-frog-man giiioooooooo" --organization cyfrin --github-token <YOUR_ACCESS_TOKEN>
$ audit_repo_cloner 
"Hello! This script will clone the source repository and prepare it for a Cyfrin audit. Please enter the following details:

1) Source repo url: 

Enter: https://github.com/Cyfrin/foundry-full-course-f23

2) Target repo name (leave blank to use source repo name):

Enter: ""

3) Audit commit hash: 

Enter: 25d62b685857f5c1906675a3876d7d7773a8b3bd

4) Enter the names of the auditors (separated by spaces):

Enter: "tricky-p blue-frog-man giiioooooooo"

5) Enter the name of the organization to create the audit repository in:

Enter: <YOUR_ORG_NAME>

And you'll get a loooong output, but, hopefully, you'll have a repo ready for audit!

Metadata

Release files for audit-repo-clone-test 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for audit-repo-clone-test 0.2.0
File Size Uploaded Provenance Actions
audit_repo_clone_test-0.2.0.tar.gz 13.3 kB Without provenance Details for audit_repo_clone_test-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for audit-repo-clone-test 0.2.0
File Interpreter ABI Platform Actions
audit_repo_clone_test-0.2.0-py3-none-any.whl Python 3 none any Details for audit_repo_clone_test-0.2.0-py3-none-any.whl

Total release size: 25.9 kB

Release files / audit_repo_clone_test-0.2.0.tar.gz

Download URL audit_repo_clone_test-0.2.0.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
eff8002d6fad3cb44657add49c43b7f68bcca77d2dc5dee105dd4f7aea5b5fe0
BLAKE2b-256 checksum
How to use checksums
da339d0d8d9e3d0ff2ebb3c3d339f21edf152ae29e2fa64af2f9517befcdeb5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Release files / audit_repo_clone_test-0.2.0-py3-none-any.whl

Download URL audit_repo_clone_test-0.2.0-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cd6b694605329dd76268a7ce8e2e5581d38fd8d67f6f490db65073147d60323
BLAKE2b-256 checksum
How to use checksums
92d61f550c5e0b0cdf22e3fa01346c31d371461c61eaa14e313e8247888cd549
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.7

Security for audit-repo-clone-test 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page