doc/security/responding_to_security_incidents.md
When a security incident occurs, you should primarily follow the processes defined by your organization. The GitLab Security Operations team created this guide:
Using this guide, you should feel confident in handling security incidents related to GitLab. Where necessary, the guide links to other parts of GitLab documentation.
[!warning] Use the suggestions/recommendations mentioned in this guide at your own risk.
This scenario refers to security events where sensitive authentication or authorization information has been exposed to the Internet due to misconfigurations or human errors. Such information might include:
This scenario might also include the exposure of sensitive information about third-party credentials through GitLab services. The exposure could occur through, for example, accidental commits to public GitLab projects, or misconfiguration of CI/CD settings. For more information, see:
Security incidents related to credentials exposure can vary in severity from low to critical, depending on the type of token and its associated permissions. When responding to such incidents, you should:
If you suspect that a user account or bot account has been compromised, you should:
Review the audit events available to you to identify any suspicious account behavior. For example:
CI/CD workflows are an integral part of modern day software development and primarily used by developers and SREs to build, test and deploy code to production. Because these workflows are attached to the production environments, they often require access to sensitive secrets within the CI/CD pipelines. Security incidents related to CI/CD might vary based on your setup, but they can be broadly classified as follows:
When a pipeline job is about to run, GitLab generates a unique token and injects it as the CI_JOB_TOKEN predefined variable. You can use a GitLab CI/CD job token to authenticate with specific API endpoints. This token has the same permissions to access the API as the user that caused the job to run. The token is valid only while the pipeline job runs. After the job finishes, the token expires and can no longer be used.
Under typical circumstances, the CI_JOB_TOKEN is not displayed in the job logs. However, you can expose this data unintentionally by:
In such instances, you should:
When secrets stored as CI variables are not masked, they might be exposed in the job logs. For example, echoing environment variables or encountering a verbose error message. Depending on the project visibility, the job logs might be accessible within your company or over the Internet if your project is public. To mitigate this type of security incident, you should:
GitLab Self-Managed customers and administrators are responsible for:
It is important to regularly update GitLab, update your operating system and its software, and harden your hosts in accordance with vendor guidance.
If you suspect that your GitLab instance has been compromised, you should:
Review system access audit events to determine any changes related to system settings, user permissions and user login events.
Security incidents can occur as a result of improperly configured project or group settings, potentially leading to unauthorized access to sensitive or proprietary data. These incidents may include but are not limited to:
If you suspect unauthorized modifications to project settings, consider taking the following steps:
target_type field. Based on the security incident context, apply a filter to this field to narrow down the scope.Before you ask GitLab for help, search the GitLab documentation. You should engage support once you have performed the preliminary investigation on your end and have additional questions or need of assistance. Eligibility for assistance from GitLab Support is determined by your license.
Review the GitLab Security documentation for suggestions on managing your environment.
For more information about improving the security posture of your GitLab environment, see the hardening recommendations.
You can also consider implementing abuse rate limiting as detailed in Git abuse rate limit. Setting abuse rate limits may be helpful to automatically mitigate certain types of security incidents.
GitLab SIRT maintains an active repository of detections in the GitLab SIRT public project.
The detections in this repository are based on the audit events and in the general Sigma rule format. You can use sigma rule converter to get the rules in your desired format. Visit the repository for more information about Sigma format and tools related to it. Make sure you have GitLab audit logs ingested to your SIEM. You should follow the audit event streaming guide for your self-managed instance or GitLab.com top-level group to stream audit events to your desired destination.