10BC0 👨‍🏭 Git-Repo-Scanner Refactoring by paulschmelzer · Pull Request #358 · secureCodeBox/secureCodeBox · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cf2d4a2
Added a new configuration option to obay the GitHub and GitLab rateli…
rfelber Mar 13, 2021
8cf7bb1
Updating Helm Docs
Mar 13, 2021
d6d696c
Added a new configuration option to filter git repos by latest acivit…
rfelber Mar 14, 2021
b1ac751
Updating Helm Docs
Mar 14, 2021
22aea9e
Fixing missing python requirements bug in docker image.
rfelber Mar 14, 2021
0b87d3a
Fixing failed pytest.
rfelber Mar 14, 2021
a3a777c
git-repo-scanner refactor
Mar 26, 2021
a789d76
Updating Helm Docs
paulschmelzer Mar 26, 2021
2e927cc
revert new structure
Mar 26, 2021
09706c3
Fix wrong indention for python files
twwd Mar 26, 2021
54b8ca5
Split up files and implement and optimize GitLabScanner
twwd Mar 26, 2021
d86c38e
Ignore Python cache directories
twwd Mar 29, 2021
d34711d
git-repo-scanner refactor
Mar 30, 2021
4fd515c
Merge remote-tracking branch 'origin/git-repo-scanner-refactoring' in…
Mar 30, 2021
e042463
adds github class
Mar 30, 2021
7498796
- finishes refactoring
Mar 31, 2021
643a44e
Fix missing elif that rendered starting for "gitlab" unreachable
twwd Apr 8, 2021
6eb7612
Use correct work dir so that Python can find the module
twwd Apr 8, 2021
0d8542f
little fixes
Apr 8, 2021
4d37261
little fixes
Apr 8, 2021
5d65796
fixes tests
Apr 8, 2021
3d6ad3c
Ignore Python bytecode and pytest cache directories in Docker build
twwd Apr 9, 2021
37f3dbd
Remove unnecessary test dependencies
twwd Apr 9, 2021
08482a2
Merge branch 'main' into git-repo-scanner-refactoring
rfelber Apr 9, 2021
a8f3763
Merge branch 'main' into git-repo-scanner-refactoring
rfelber Apr 11, 2021
4fca197
Added integration test for git-repo-scanner.
rfelber Apr 12, 2021
4457a3c
Updated integration test for git-repo-scanner.
rfelber Apr 12, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@ indent_size = 2
[*.go]
indent_style = tab

[*.py]
indent_size = 4

[Makefile]
indent_style = tab
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
working-directory: scanners/git-repo-scanner/scanner/
run: |
pip install pytest
pytest ${{ matrix.unit }}_test.py
pytest

# ---- Unit-Test | JavaScript ----

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ coverage/
**.log
**/*.monopic
.s3_credentials
**/__pycache__


### IntelliJ IDEA ###
.idea
Expand Down
32 changes: 21 additions & 11 deletions scanners/git-repo-scanner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,32 @@ or
```

#### GitHub
For type github you can use the following options:
- `--organization`: The name of the github organization you want to scan.
- `--url`: The url of the api for a github enterprise server. Skip this option for repos on <https://github.com>.
- `--access-token`: Your personal github access token.
- `--ignore-repos`: A list of github repository ids you want to ignore
For type GitHub you can use the following options:
- `--organization`: The name of the GitHub organization you want to scan.
- `--url`: The url of the api for a GitHub enterprise server. Skip this option for repos on <https://github.com>.
- `--access-token`: Your personal GitHub access token.
- `--ignore-repos`: A list of GitHub repository ids you want to ignore
- `--obey-rate-limit`: True to obey the rate limit of the GitHub server (default), otherwise False
- `--activity-since-duration`: Return git repo findings with repo activity (e.g. commits) more recent than a specific date expresed by an duration (now + duration). A duration string is a possibly signed sequence of decimal numbers, each
with optional fraction and a unit suffix, such as '1h' or '2h45m'. Valid time units are 'm', 'h', 'd', 'w'.
- `--activity-until-duration`: Return git repo findings with repo activity (e.g. commits) older than a specific date expresed by an duration (now + duration). A duration string is a possibly signed sequence of decimal numbers, each with
optional fraction and a unit suffix, such as '1h' or '2h45m'. Valid time units are 'm', 'h', 'd', 'w'.

For now only organizations are supported so the option is mandatory. We **strongly recommend** providing an access token
for authentication. If not provided the rate limiting will kick in after about 30 repositories scanned.

#### GitLab
For type gitlab you can use the following options:
- `--url`: The url of the gitlab server.
- `--access-token`: Your personal gitlab access token.
- `--group`: A specific gitlab group id you want to san, including subgroups.
- `--ignore-groups`: A list of gitlab group ids you want to ignore
- `--ignore-repos`: A list of gitlab project ids you want to ignore
For type GitLab you can use the following options:
- `--url`: The url of the GitLab server.
- `--access-token`: Your personal GitLab access token.
- `--group`: A specific GitLab group id you want to san, including subgroups.
- `--ignore-groups`: A list of GitLab group ids you want to ignore
- `--ignore-repos`: A list of GitLab project ids you want to ignore
- `--obey-rate-limit`: True to obey the rate limit of the GitLab server (default), otherwise False
- `--activity-since-duration`: Return git repo findings with repo activity (e.g. commits) more recent than a specific date expresed by an duration (now + duration). A duration string is a possibly signed sequence of decimal numbers, each
with optional fraction and a unit suffix, such as '1h' or '2h45m'. Valid time units are 'm', 'h', 'd', 'w'.
- `--activity-until-duration`: Return git repo findings with repo activity (e.g. commits) older than a specific date expresed by an duration (now + duration). A duration string is a possibly signed sequence of decimal numbers, each with
optional fraction and a unit suffix, such as '1h' or '2h45m'. Valid time units are 'm', 'h', 'd', 'w'.

For gitlab the url and the access token is mandatory. If you don't provide a specific group id all projects
on the gitlab server are going to be discovered.
Expand Down
33 changes: 22 additions & 11 deletions scanners/git-repo-scanner/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,33 @@ or
```

#### GitHub
For type github you can use the following options:
- `--organization`: The name of the github organization you want to scan.
- `--url`: The url of the api for a github enterprise server. Skip this option for repos on <https://github.com>.
- `--access-token`: Your personal github access token.
- `--ignore-repos`: A list of github repository ids you want to ignore
For type GitHub you can use the following options:
- `--organization`: The name of the GitHub organization you want to scan.
- `--url`: The url of the api for a GitHub enterprise server. Skip this option for repos on <https://github.com>.
- `--access-token`: Your personal GitHub access token.
- `--ignore-repos`: A list of GitHub repository ids you want to ignore
- `--obey-rate-limit`: True to obey the rate limit of the GitHub server (default), otherwise False
- `--activity-since-duration`: Return git repo findings with repo activity (e.g. commits) more recent than a specific date expresed by an duration (now + duration). A duration string is a possibly signed sequence of decimal numbers, each
with optional fraction and a unit suffix, such as '1h' or '2h45m'. Valid time units are 'm', 'h', 'd', 'w'.
- `--activity-until-duration`: Return git repo findings with repo activity (e.g. commits) older than a specific date expresed by an duration (now + duration). A duration string is a possibly signed sequence of decimal numbers, each with
optional fraction and a unit suffix, such as '1h' or '2h45m'. Valid time units are 'm', 'h', 'd', 'w'.

For now only organizations are supported so the option is mandatory. We **strongly recommend** providing an access token
for authentication. If not provided the rate limiting will kick in after about 30 repositories scanned.

#### GitLab
For type gitlab you can use the following options:
- `--url`: The url of the gitlab server.
- `--access-token`: Your personal gitlab access token.
- `--group`: A specific gitlab group id you want to san, including subgroups.
- `--ignore-groups`: A list of gitlab group ids you want to ignore
- `--ignore-repos`: A list of gitlab project ids you want to ignore
For type GitLab you can use the following options:
- `--url`: The url of the GitLab server.
- `--access-token`: Your personal GitLab access token.
- `--group`: A specific GitLab group id you want to san, including subgroups.
- `--ignore-groups`: A list of GitLab group ids you want to ignore
- `--ignore-repos`: A list of GitLab project ids you want to ignore
- `--obey-rate-limit`: True to obey the rate limit of the GitLab server (default), otherwise False
- `--activity-since-duration`: Return git repo findings with repo activity (e.g. commits) more recent than a specific date expresed by an duration (now + duration). A duration string is a possibly signed sequence of decimal numbers, each
with optional fraction and a unit suffix, such as '1h' or '2h45m'. Valid time units are 'm', 'h', 'd', 'w'.
- `--activity-until-duration`: Return git repo findings with repo activity (e.g. commits) older than a specific date expresed by an duration (now + duration). A duration string is a possibly signed sequence of decimal numbers, each with
optional fraction and a unit suffix, such as '1h' or '2h45m'. Valid time units are 'm', 'h', 'd', 'w'.


For gitlab the url and the access token is mandatory. If you don't provide a specific group id all projects
on the gitlab server are going to be discovered.
Expand Down
3 changes: 3 additions & 0 deletions scanners/git-repo-scanner/scanner/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/.pytest_cache
**/__pycache__
/tests
7 changes: 4 additions & 3 deletions scanners/git-repo-scanner/scanner/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM python:3.9.0-alpine
COPY git_repo_scanner.py /scripts/git_repo_scanner.py
RUN pip install PyGithub python-gitlab
COPY . /scripts/
RUN pip 3B0C install -r /scripts/requirements.txt
CMD ["/bin/sh"]
ENTRYPOINT ["python","/scripts/git_repo_scanner.py"]
WORKDIR /scripts
ENTRYPOINT ["python", "-m", "git_repo_scanner"]
Loading
0