A Go tool for scanning organisation repositories for blacklisted modules
Report Bug
·
Request Feature
Table of Contents
When maintaining lots of repos, it is often necessary to find a list of repos containing modules that have out-of-date dependencies. This tool will scan all of an organisation's repos looking for go.mod files, and will parse those files looking for modules that need to be removed or updated.
Here's why:
- You have updated a module with a breaking change, and want to ensure that all projects that depend upon it have been updated
- You have identified a security, license, or some other issue with a dependency and wish to make sure that none of your repos depend upon it (including at least one step indirectly)
- You have tried to use GitHub's search to help find these issues and value your sanity enough to use some proper tooling instead 😄
Use go install.
go install github.com/humn-ai/banish@latestRunning banish without any arguments will output usage information.
A simple scan of all repositories might look like this:
banish -github-token <your token> -org humn-ai -modules github.com/gogo/protobufMultiple repositories can be provided with CSV, and minimum versions can be provided with @:
banish \
-github-token <your token> \
-org humn-ai \
-modules github.com/gogo/protobuf,github.com/rs/zerolog@1.0.0To use a file with a line for each entry to search for, standard POSIX comes in handy. Also note that an environment variable of GITHUB_TOKEN can be used to improve the security of your token handling. Here pass is used to store a token encrypted and avoid leaving it laying around in terminal history or environment variables, and a line-by-line blacklist file is converted to CSV:
GITHUB_TOKEN=$(pass tokens/github-ro) banish \
-org humn-ai \
-modules $(cat blacklist.txt | tr '\n' ',')Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue. Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt for more information.
Project Link: https://github.com/humn-ai/banish
Humn - https://www.humn.ai
John Anthony - https://jo.hnanthony.com - john.anthony@humn.ai, john@jo.hnanthony.com
