Skip to content

Commit

Permalink
Scan new gitlab-project assets + fix CLI examples
Browse files Browse the repository at this point in the history
- Support checking project visibility on the projects
- Fix old CLI examples
- Minor copy updates

Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 committed Sep 18, 2023
1 parent 392c569 commit e200bce
Showing 1 changed file with 38 additions and 9 deletions.
47 changes: 38 additions & 9 deletions core/mondoo-gitlab-security.mql.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
policies:
- uid: mondoo-gitlab-security
name: GitLab Security
version: 1.2.0
version: 1.3.0
license: MPL-2.0
tags:
mondoo.com/category: security
Expand All @@ -10,22 +10,26 @@ policies:
- name: Mondoo, Inc
email: [email protected]
docs:
desc: "## Overview\n\nThe GitLab Security by Mondoo policy bundle provides guidance for establishing minimum recommended security and operational best practices for GitLab. This policy is early access.\n\n## Remote scan\n\nRemote scans use native transports in `cnspec` to provide on demand scan results without the need to install any agents, or integration. \n\nFor a complete list of native transports run: \n\n```bash\ncnspec scan --help\n``` \n\n### Prerequisites\n\nRemote scans of GitLab requires a [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with access to the group.\n\n### Run a scan of a GitLab group\n\nOpen a terminal and configure an environment variable with your GitLab personal access token:\n\n```bash\nexport GITLAB_TOKEN=<your personal access token> \n```\n\nRun a remote scan of your GitLab group: \n\n```bash\ncnspec scan gitlab --group <group_name>\n``` \n \n## Join the community!\n\nOur goal is to build policies that are simple to deploy, accurate, and actionable. \n\nIf you have any suggestions on how to improve this policy, or if you need support, [join the community](https://github.com/orgs/mondoohq/discussions) in GitHub Discussions."
desc: "## Overview\n\nThe GitLab Security by Mondoo policy bundle provides guidance for establishing minimum recommended security and operational best practices for GitLab groups and projects. This policy is early access.\n\n## Remote scan\n\nRemote scans use native transports in `cnspec` to provide on demand scan results without the need to install any agents, or integration. \n\nFor a complete list of native transports run: \n\n```bash\ncnspec scan --help\n``` \n\n### Prerequisites\n\nRemote scans of GitLab requires a [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with access to the group.\n\n### Run a scan of a GitLab group\n\nOpen a terminal and configure an environment variable with your GitLab personal access token:\n\n```bash\nexport GITLAB_TOKEN=<your personal access token> \n```\n\nRun a remote scan of your GitLab group: \n\n```bash\ncnspec scan gitlab --group <group_name>\n``` \n \n## Join the community!\n\nOur goal is to build policies that are simple to deploy, accurate, and actionable. \n\nIf you have any suggestions on how to improve this policy, or if you need support, [join the community](https://github.com/orgs/mondoohq/discussions) in GitHub Discussions."
groups:
- title: GitLab
- title: GitLab Group
filters: asset.platform == "gitlab" || asset.platform == "gitlab-group"
checks:
- uid: mondoo-gitlab-security-private-group
- uid: mondoo-gitlab-security-private-projects
- uid: mondoo-gitlab-security-require-two-factor
- title: GitLab Project
filters: asset.platform == "gitlab-project"
checks:
- uid: mondoo-gitlab-security-private-project
queries:
- uid: mondoo-gitlab-security-private-group
title: Ensure the group is private
mql: |
gitlab.group.visibility != "public"
docs:
desc: |
GitLab allows users with the Owner role to set a project's or group's visibility as:
GitLab allows users with the Owner role to set a group's visibility as:
- Public
- Internal
Expand All @@ -38,7 +42,7 @@ queries:
__cnspec Shell__
1. Open a Terminal.
2. Connect cnspec shell to GitLab `cnspec shell gitlab --option token=${GITLAB_TOKEN} --option group=<group name>`
2. Connect cnspec shell to GitLab `cnspec shell gitlab --token ${GITLAB_TOKEN} --group <group name>`
3. Run the following query
```mql
Expand All @@ -57,7 +61,7 @@ queries:
__cnspec Shell__
1. Open a Terminal.
2. Connect cnspec shell to GitLab `cnspec shell gitlab --option token=${GITLAB_TOKEN} --option group=<group name>`
2. Connect cnspec shell to GitLab `cnspec shell gitlab --token ${GITLAB_TOKEN} --group <group name>`
3. Run the following query
```mql
Expand All @@ -70,25 +74,50 @@ queries:
mql: gitlab.group.projects { visibility != "public" }
docs:
desc: |
GitLab allows users with the Owner role to set a project's or group's visibility as:
GitLab allows users with the Owner role to set a project's visibility as:
- Public
- Internal
- Private
These visibility levels affect who can see the project in the public access directory (/public for your GitLab instance). For example, https://gitlab.com/public. You can control the visibility of individual features with project feature settings.
Private projects can only be cloned and viewed by project members (except for guests). They appear in the public access directory (`/public``) for project members only.
audit: |
__cnspec Shell__
1. Open a Terminal.
2. Connect cnspec shell to GitLab `cnspec shell gitlab --token ${GITLAB_TOKEN} --group <group name>`
3. Run the following query
```mql
gitlab.group.projects { visibility != "public" }
```
remediation: |
To make the visibility of a GitLab project private, see [Change project visibility](https://docs.gitlab.com/ee/user/public_access.html#change-project-visibility).
- uid: mondoo-gitlab-security-private-project
title: Ensure the project is private
mql: gitlab.project { visibility != "public" }
docs:
desc: |
GitLab allows users with the Owner role to set a project's visibility as:
- Public
- Internal
- Private
These visibility levels affect who can see the project in the public access directory (/public for your GitLab instance). For example, https://gitlab.com/public. You can control the visibility of individual features with project feature settings.
Private projects can only be cloned and viewed by project members (except for guests). They appear in the public access directory (`/public``) for project members only.
audit: |
__cnspec Shell__
1. Open a Terminal.
2. Connect cnspec shell to GitLab `cnspec shell gitlab --option token=${GITLAB_TOKEN} --option group=<group name>`
2. Connect cnspec shell to GitLab `cnspec shell gitlab --token ${GITLAB_TOKEN} --group <group name> --project <project name>`
3. Run the following query
```mql
gitlab.group.visibility
gitlab.project.visibility
```
remediation: |
To make the visibility of a GitLab project private, see [Change project visibility](https://docs.gitlab.com/ee/user/public_access.html#change-project-visibility).

0 comments on commit e200bce

Please sign in to comment.