From 8b78620c2c39c996007212616a586a8644ae7e33 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Mon, 7 Apr 2025 22:52:59 -0500 Subject: Gitlab enhancements (#2) * add various in-progress scripts for gitlab * Commit from GitHub Actions (Ruff) * add gitlab results for free-tier tools * Commit from GitHub Actions (Ruff) * add gitlab results for ultimate-tier tools * Commit from GitHub Actions (Ruff) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- applications/gitlab/passwords.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 applications/gitlab/passwords.py (limited to 'applications/gitlab/passwords.py') diff --git a/applications/gitlab/passwords.py b/applications/gitlab/passwords.py new file mode 100644 index 0000000..84ab107 --- /dev/null +++ b/applications/gitlab/passwords.py @@ -0,0 +1,29 @@ +""" +Verify if password policies are enforced in a self-hosted GitLab instance. + + Ref: https://docs.gitlab.com/api/settings/ +""" + +import requests + +BASE_URL = "https://gitlab.com/api/v4" +PRIVATE_TOKEN = "your_access_token" +TIMEOUT = 30 + +URL = f"{BASE_URL}/application/settings" +HEADERS = {"PRIVATE-TOKEN": PRIVATE_TOKEN} + +if __name__ == "__main__": + # Get application settings + response = requests.get(URL, headers=HEADERS, timeout=TIMEOUT) + if response.status_code == 200: + settings = response.json() + password_length = settings.get("password_length", "Not set") + password_complexity = settings.get("password_complexity", "Not set") + + print(f"Password Length: {password_length}") + print(f"Password Complexity: {password_complexity}") + else: + print( + f"Failed to fetch application settings: {response.status_code}, {response.text}" + ) -- cgit v1.2.3-70-g09d2