|
1 | | -# floss-toolbox (version 2.4.0) |
| 1 | +# floss-toolbox (version 2.5.0) |
2 | 2 |
|
3 | 3 | Toolbox to help developers and open source referents to have cleaner projects in GitHub organizations. |
4 | 4 |
|
@@ -427,4 +427,67 @@ brew install gitleaks |
427 | 427 |
|
428 | 428 | You need to define in the _configuration.rb_ files the Github organisation at **GITHUB_ORGANIZATION_NAME** and also your GitHub personal token at ** GITHUB_PERSONAL_ACCESS_TOKEN**. |
429 | 429 |
|
430 | | -**You should also have your _git_ environment ready i.e. add your SSH private key if you clone by SSH for example. _gh_ must be installed, and _python3_ be ready. Obvisously _gitleaks_ must be installed** |
| 430 | +**You should also have your _git_ environment ready i.e. add your SSH private key if you clone by SSH for example. _gh_ must be installed, and _python3_ be ready. Obviously _gitleaks_ must be installed** |
| 431 | + |
| 432 | +# Play with GitLab web API |
| 433 | + |
| 434 | +## Prerequisites |
| 435 | + |
| 436 | +- Ruby Gem: `git 1.8.1` |
| 437 | +- Python3 |
| 438 | + |
| 439 | +- Create a [GitLab personal token](https://gitlab.com/-/profile/personal_access_tokens) and define it in the _configuration.rb_ file for the `GILAB_PERSONAL_ACCESS_TOKEN` variable. |
| 440 | +- Define the GitLab organization id in the _configuration.rb_ file for the `GITLAB_ORGANIZATION_ID` variable. It will allow to send requests to query and modify your organization. |
| 441 | + |
| 442 | +## Prepare project |
| 443 | + |
| 444 | +```ruby |
| 445 | +gem install git |
| 446 | +``` |
| 447 | + |
| 448 | +## Features |
| 449 | + |
| 450 | +### Make a backup of organization repositories |
| 451 | + |
| 452 | +_Keywords: #organisation #GitLab #repositories #clones #dump_ |
| 453 | + |
| 454 | +This feature allows to clone all repositories of the defined GitLab organization (groups and subgroups incldued) and save them in a specific folder. |
| 455 | + |
| 456 | +Run the following command: |
| 457 | +```shell |
| 458 | +bash GitLabWizard.sh backup-all-repositories-from-org |
| 459 | +``` |
| 460 | + |
| 461 | +This script will get configuation details picked from the Ruby configuration file; and triggers another Shell script to make a CURL request to the GitLab endpoint. A Python code will be called so as to extract repositories URLbefoire the cloning operation. |
| 462 | + |
| 463 | +You need to define in the _configuration.rb_ files the GitLab organisation ID at **GITLAB_ORGANIZATION_ID**. |
| 464 | +You have to also define the location to store clones at **REPOSITORIES_CLONE_LOCATION_PATH** and the access token at **GILAB_PERSONAL_ACCESS_TOKEN**. |
| 465 | + |
| 466 | +**You should also have your _git_ environment ready, i.e. add your SSH private key if you clone by SSH for example.** |
| 467 | + |
| 468 | +### Check if there are leaks in organisation repositories (using gitleaks) |
| 469 | + |
| 470 | +_Keywords: #organisation #GitLab #repositories #leaks #gitleaks_ |
| 471 | + |
| 472 | +**Warning: This operation can take long time because of both Git histories and file trees parsing** |
| 473 | + |
| 474 | +This feature allows to check in all repositories of the GitHub organisation if there are leaks using the _gitleaks_ tool. |
| 475 | + |
| 476 | +Run the following command: |
| 477 | +```shell |
| 478 | +bash GitLabWizard.sh look-for-leaks |
| 479 | +``` |
| 480 | + |
| 481 | +This script needs a GitLab personal access otken to make requests to GitLab API and also the GitLab group ID to use to get projects under it. |
| 482 | +The wizard Shell script will pick configuration details from the Ruby configuration file ; and triggers another Shell script for the data process. A Python code will be called too to process JSON sent by GItLab API.. |
| 483 | + |
| 484 | +The [gitleaks](https://github.com/zricethezav/gitleaks) tool will be used to look inside the repository. To install it: |
| 485 | + |
| 486 | +```shell |
| 487 | +brew install gitleaks |
| 488 | +``` |
| 489 | + |
| 490 | +You need to define in the _configuration.rb_ files the GitLab organisation ID at **GITLAB_ORGANIZATION_ID**. |
| 491 | +You have to also define the location to store clones at **REPOSITORIES_CLONE_LOCATION_PATH** and the access token at **GILAB_PERSONAL_ACCESS_TOKEN**. |
| 492 | + |
| 493 | +**You should also have your _git_ environment ready i.e. add your SSH private key if you clone by SSH for example. _gh_ must be installed, and _python3_ be ready. Obviously _gitleaks_ must be installed** |
0 commit comments