{"id":49504,"date":"2026-11-23T22:06:15","date_gmt":"2026-11-23T22:06:15","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=49504"},"modified":"2026-11-23T22:06:15","modified_gmt":"2026-11-23T22:06:15","slug":"gitlab-faq","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/gitlab-faq\/","title":{"rendered":"Gitlab FAQ"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">GitLab cannot restrict who reads or edits a single file in a repository. Access is granted per project. You can still stop secrets from reaching the repository and control who changes sensitive paths by combining push rules, secret detection, protected branches and CODEOWNERS approvals. This page corrects the examples below, adds working configuration for each control, and explains what to do when a secret has already been committed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Security<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">GitLab <strong>does not provide true file-level access control<\/strong> (like \u201conly Alice can read <code>secrets.yml<\/code>\u201d) \u2014 but it <strong>does provide tools<\/strong> to <strong>restrict access and prevent exposure<\/strong> of sensitive files using:<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u2705 What You <strong>Can<\/strong> Do in GitLab (SaaS and Self-managed)<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">1. \u2705 <strong>Push Rules for Sensitive Files<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Prevent commits that contain secrets, keys, passwords, or specific file names<\/strong>.<\/li>\n\n\n\n<li>Configure under:<br><code>Settings \u2192 Repository \u2192 Push Rules<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Reject commits with <code>.env<\/code> or <code>*.pem<\/code> files:<\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">Forbidden file names: ^(.env|.*\\.pem)$\n<\/code><\/span><\/pre>\n\n\n<ul class=\"wp-block-list\">\n<li>Reject commits with AWS keys using regex:<\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">Secret detection regex: AKIA&#91;0-9A-Z]{16}\n<\/code><\/span><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">2. \u2705 <strong>Protected Branches<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Prevent unauthorized push\/merge to sensitive branches like <code>main<\/code>, <code>release<\/code>, etc.<\/li>\n\n\n\n<li>Set under:<br><code>Settings \u2192 Repository \u2192 Protected Branches<\/code><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">3. \u2705 <strong>Code Owners for Sensitive Files<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Define <strong>ownership for sensitive files<\/strong> using a <a href=\"https:\/\/www.devopsschool.com\/blog\/gitlab-codeowners-file-enforce-code-reviews-approvals-and-accountability\/\"><code>CODEOWNERS<\/code> <\/a>file.<\/li>\n\n\n\n<li>Prevent changes to specific paths unless approved by listed owners.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example:<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">\/secrets<span class=\"hljs-comment\">\/*  <span class=\"hljs-doctag\">@devops<\/span>-lead <span class=\"hljs-doctag\">@security<\/span>-team\n<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">4. \u2705 <strong>Secret Detection (SAST\/Static Scanning)<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>GitLab CI\/CD <strong>automatically scans<\/strong> for hardcoded secrets and keys.<\/li>\n\n\n\n<li>Available in GitLab <strong>Ultimate<\/strong> and in some parts of Premium.<\/li>\n\n\n\n<li>Found under: <code>Security &amp; Compliance \u2192 Vulnerability Report<\/code><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">5. \u2705 <strong>File Pattern Merge Request Rules<\/strong> (Paid)<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use <strong>merge request approval rules<\/strong> for changes to specific file paths (e.g., secrets, configs).<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example:<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">Rule: <span class=\"hljs-keyword\">If<\/span> \/infra\/keys<span class=\"hljs-comment\">\/* is changed \u2192 require <span class=\"hljs-doctag\">@security<\/span>-team to approve\n<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u274c What You <strong>Cannot<\/strong> Do Directly in GitLab<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Feature<\/th><th>GitLab Status<\/th><\/tr><\/thead><tbody><tr><td>Per-file access control (ACL-style)<\/td><td>\u274c Not supported<\/td><\/tr><tr><td>Per-user permission to view\/edit specific files<\/td><td>\u274c Not supported<\/td><\/tr><tr><td>Encryption-at-rest per file inside repo<\/td><td>\u274c Not native (requires external tools)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udd10 Recommended Best Practices<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Goal<\/th><th>GitLab Feature to Use<\/th><\/tr><\/thead><tbody><tr><td>Prevent secrets in repo<\/td><td>Push rules + Secret detection + <code>.gitignore<\/code><\/td><\/tr><tr><td>Limit merge to sensitive files<\/td><td>CODEOWNERS + Approval Rules<\/td><\/tr><tr><td>Block commits with unsafe patterns<\/td><td>Push Rules + Pre-commit Hooks (externally)<\/td><\/tr><tr><td>Enforce audits of sensitive changes<\/td><td>Merge request rules with approval<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Why GitLab has no per-file access control<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Git copies the whole repository to every clone, so any user who can clone a project can read every file in it. In GitLab, permission to read code comes from project or group membership and the project&#039;s visibility setting. It is never set per file or per folder. If someone has read access, every path is visible to them, <code>secrets\/<\/code> included.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The controls in the example above cover different jobs. Push rules and secret detection stop sensitive content from entering the repository. Protected branches and CODEOWNERS control who can <strong>change<\/strong> sensitive paths. None of them hides a file from someone who already has read access.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> If some files really must be readable by fewer people, move them to a separate project or group with tighter membership. That project can be consumed as a Git submodule or as a pipeline dependency. See <a href=\"https:\/\/www.devopsschool.com\/blog\/gitlab-hierarchy-organization-namespace-group-project\/\">GitLab Hierarchy: Organization, Namespace, Group &amp; Project<\/a> for how membership is inherited.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Corrections to the examples above<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Original<\/th><th>Problem<\/th><th>Corrected<\/th><\/tr><\/thead><tbody><tr><td><code>Forbidden file names: ^(.env|.*\\.pem)$<\/code><\/td><td>The field is called <strong>Prohibited file names<\/strong>. The regex is matched against the full file path, so <code>^.env$<\/code> misses <code>config\/.env<\/code>. The unescaped <code>.<\/code> also matches any character.<\/td><td><code>(^|\/)\\.env$|\\.pem$<\/code><\/td><\/tr><tr><td><code>Secret detection regex: AKIA[0-9A-Z]{16}<\/code><\/td><td>Push rules have no content regex field. They check file names, branch names, commit messages and author emails, not what is inside a file.<\/td><td>Use <strong>secret push protection<\/strong> or pipeline secret detection, both of which already detect AWS access keys.<\/td><\/tr><tr><td><code>\/secrets\/*  @devops-lead @security-team<\/code><\/td><td>In CODEOWNERS, <code>\/secrets\/*<\/code> matches only files directly inside <code>secrets\/<\/code> and skips its subdirectories.<\/td><td><code>\/secrets\/  @devops-lead @security-team<\/code><\/td><\/tr><tr><td>Secret detection &quot;automatically scans&quot; and is Ultimate-only<\/td><td>Pipeline secret detection only runs after you enable it in <code>.gitlab-ci.yml<\/code> (or through Auto DevOps). The scan works on every tier. Ultimate adds the vulnerability report and the merge request widget.<\/td><td>Include the <code>Jobs\/Secret-Detection.gitlab-ci.yml<\/code> template.<\/td><\/tr><tr><td><code>Security &amp; Compliance \u2192 Vulnerability Report<\/code><\/td><td>Outdated menu path.<\/td><td><strong>Secure &gt; Vulnerability report<\/strong><\/td><\/tr><tr><td>&quot;File pattern merge request rules&quot;<\/td><td>GitLab approval rules have no file-path condition. Path-based approval comes from CODEOWNERS combined with the protected branch setting <strong>Require approval from code owners<\/strong>.<\/td><td>Use a CODEOWNERS section, as shown below.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> Push rules and CODEOWNERS approvals need GitLab Premium or Ultimate. On the Free tier, use pre-commit hooks and pipeline secret detection instead.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Configure push rules for sensitive file names<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the project and go to <strong>Settings &gt; Repository &gt; Push rules<\/strong>. To apply the same rules to every new project in a group, use the group-level push rules instead.<\/li>\n\n\n<li>Turn on <strong>Prevent pushing secret files<\/strong>. This built-in list rejects common credential file names, such as private SSH keys and <code>.pem<\/code> files.<\/li>\n\n\n<li>In <strong>Prohibited file names<\/strong>, enter a regex for anything the built-in list misses, for example <code>(^|\/)\\.env$|\\.pem$|(^|\/)secrets\\.ya?ml$<\/code>.<\/li>\n\n\n<li>Select <strong>Save push rules<\/strong>, then test by pushing a commit that adds a <code>.env<\/code> file. The server should reject the push.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Push rules check only new commits as they are pushed. Files that are already in the repository are not affected, so search the existing history separately (see the section on committed secrets below).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Detect secrets inside file contents<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">GitLab offers two content scanners. <strong>Secret push protection<\/strong> (Ultimate) checks pushed changes for high-confidence secret patterns, such as cloud provider keys and tokens, and blocks the push before the secret lands. Enable it in <strong>Secure &gt; Security configuration<\/strong>. On self-managed instances, an administrator must allow it for the instance first. <strong>Pipeline secret detection<\/strong> runs as a CI job after the commit has been pushed, and it works on every tier.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">stages:\n  - test\n\n<span class=\"hljs-keyword\">include<\/span>:\n  - template: Jobs\/Secret-Detection.gitlab-ci.yml\n\nsecret_detection:\n  variables:\n    <span class=\"hljs-comment\"># Scan the full Git history once; remove after the first run<\/span>\n    SECRET_DETECTION_HISTORIC_SCAN: <span class=\"hljs-string\">\"true\"<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">The template adds a <code>secret_detection<\/code> job to the <code>test<\/code> stage, so that stage must exist. The job writes a <code>gl-secret-detection-report.json<\/code> artifact. On Ultimate, the findings also appear in the merge request and under <strong>Secure &gt; Vulnerability report<\/strong>. Setting the historic scan variable once is a good way to find secrets that were committed before scanning was turned on.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To catch secrets before they leave a developer&#039;s machine, add a local hook such as gitleaks through the pre-commit framework:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-comment\"># .pre-commit-config.yaml<\/span>\nrepos:\n  - repo: https:<span class=\"hljs-comment\">\/\/github.com\/gitleaks\/gitleaks<\/span>\n    rev: vX.Y.Z   <span class=\"hljs-comment\"># replace with the current gitleaks release tag<\/span>\n    hooks:\n      - id: gitleaks\n\n<span class=\"hljs-comment\"># then run once per clone:<\/span>\n<span class=\"hljs-comment\"># pip install pre-commit &amp;&amp; pre-commit install<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> Local hooks are easy to bypass with <code>git commit --no-verify<\/code>. Use them for fast feedback only, and rely on the server-side controls for enforcement.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Require approval for sensitive paths with CODEOWNERS<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Place a <code>CODEOWNERS<\/code> file in the repository root, in <code>docs\/<\/code> or in <code>.gitlab\/<\/code>. Sections let you require more than one approval for a group of paths:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-comment\"># .gitlab\/CODEOWNERS<\/span>\n&#91;Security]&#91;<span class=\"hljs-number\">2<\/span>] @security-team\n\/secrets\/\n\/infra\/keys\/\n*.tfvars\n\n&#91;Platform] @devops-lead\n\/.gitlab-ci.yml\n\/infra\/<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\"><code>[Security][2]<\/code> sets <code>@security-team<\/code> as the default owner for the paths listed under it and requires two approvals from that team. A trailing slash such as <code>\/infra\/keys\/<\/code> matches everything below that directory, at any depth.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Commit the CODEOWNERS file to the default branch.<\/li>\n\n\n<li>Go to <strong>Settings &gt; Repository &gt; Protected branches<\/strong> and protect <code>main<\/code>. Set <strong>Allowed to push and merge<\/strong> to <strong>No one<\/strong>, so every change has to go through a merge request.<\/li>\n\n\n<li>Turn on <strong>Code owner approval<\/strong> for that branch.<\/li>\n\n\n<li>Open a test merge request that changes <code>\/infra\/keys\/<\/code> and confirm that the Security approval rule appears and blocks the merge.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Keep secrets out of the repository entirely<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The controls above stop mistakes. The lasting fix is to keep credentials outside Git altogether:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>CI\/CD variables<\/strong> (<strong>Settings &gt; CI\/CD &gt; Variables<\/strong>): mark them <strong>Masked<\/strong> so values are redacted in job logs, and <strong>Protected<\/strong> so they are available only to pipelines on protected branches and tags.<\/li>\n\n\n<li><strong>External secret managers<\/strong>: the <code>secrets:<\/code> keyword (Premium) fetches values from HashiCorp Vault and other providers at job runtime, authenticating with short-lived <code>id_tokens<\/code>.<\/li>\n\n\n<li><strong>Encrypted files<\/strong>: if configuration must live in Git, encrypt it with a tool such as SOPS or git-crypt, and keep the decryption keys out of the repository.<\/li>\n\n\n<li><strong><code>.gitignore<\/code><\/strong>: list <code>.env<\/code>, <code>*.pem<\/code> and local credential files, so they are never staged by accident.<\/li>\n<\/ul>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">deploy:\n  id_tokens:\n    VAULT_ID_TOKEN:\n      aud: https:<span class=\"hljs-comment\">\/\/vault.example.com<\/span>\n  secrets:\n    DATABASE_PASSWORD:\n      vault: production\/db\/password@ops   <span class=\"hljs-comment\"># path\/field@mount<\/span>\n      token: $VAULT_ID_TOKEN\n  script:\n    - .\/deploy.sh   <span class=\"hljs-comment\"># DATABASE_PASSWORD is written to a temp file; the variable holds its path<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">By default, a secret fetched this way is written to a file, and the variable holds that file&#039;s path. Add <code>file: false<\/code> under the secret if the script needs the value itself.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For more pipeline patterns, see <a href=\"https:\/\/www.devopsschool.com\/blog\/what-is-gitlab-ci-cd-and-use-cases-of-gitlab-ci-cd\/\">What is GitLab CI\/CD and use cases of GitLab CI\/CD?<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">If a secret was already committed<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Revoke and rotate the credential first.<\/strong> Assume it is compromised: clones, forks, CI logs and caches may already hold a copy.<\/li>\n\n\n<li>Remove the file from history in a fresh mirror clone, for example <code>git filter-repo --path config\/.env --invert-paths<\/code>.<\/li>\n\n\n<li>Force-push the rewritten branches and tags. Protected branches must temporarily allow force push for this step.<\/li>\n\n\n<li>In GitLab, go to <strong>Settings &gt; Repository &gt; Repository cleanup<\/strong> and upload the <code>commit-map<\/code> file that git-filter-repo generated, so GitLab removes the unreachable objects.<\/li>\n\n\n<li>Ask everyone to re-clone, and add the file pattern to push rules so it cannot come back.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> Rewriting history without rotating the credential does not make it safe. Anyone who copied the secret before the rewrite can still use it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Feature availability by tier<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Control<\/th><th>Free<\/th><th>Premium<\/th><th>Ultimate<\/th><\/tr><\/thead><tbody><tr><td>Protected branches<\/td><td>Yes<\/td><td>Yes<\/td><td>Yes<\/td><\/tr><tr><td>Masked and protected CI\/CD variables<\/td><td>Yes<\/td><td>Yes<\/td><td>Yes<\/td><\/tr><tr><td>Pipeline secret detection (job and report artifact)<\/td><td>Yes<\/td><td>Yes<\/td><td>Yes<\/td><\/tr><tr><td>Push rules, including prohibited file names<\/td><td>No<\/td><td>Yes<\/td><td>Yes<\/td><\/tr><tr><td>CODEOWNERS with required code owner approval<\/td><td>No<\/td><td>Yes<\/td><td>Yes<\/td><\/tr><tr><td><code>secrets:<\/code> keyword with external managers<\/td><td>No<\/td><td>Yes<\/td><td>Yes<\/td><\/tr><tr><td>Secret push protection, vulnerability report, MR security widget<\/td><td>No<\/td><td>No<\/td><td>Yes<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Tier packaging changes between releases, so check the current GitLab documentation for your edition before you plan a rollout.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently asked questions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Can I restrict who can view a specific file in a GitLab repository?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. Read access is granted per project, and anyone who can clone the repository can read every file in it. Move sensitive files to a separate project with restricted membership, or keep them out of Git and use CI\/CD variables or a secret manager.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Are GitLab push rules available on the Free tier?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. Push rules, including Prevent pushing secret files and Prohibited file names, require Premium or Ultimate. On Free, use pre-commit hooks and pipeline secret detection.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Does GitLab scan for secrets automatically?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pipeline secret detection runs only after you include the <code>Jobs\/Secret-Detection.gitlab-ci.yml<\/code> template or enable Auto DevOps. Secret push protection, which blocks secrets at push time, has to be switched on in Secure &gt; Security configuration and requires Ultimate.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I make the security team approve changes to certain folders?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">List the paths under a CODEOWNERS section owned by the security team, then turn on Code owner approval for the target protected branch. Merge requests that touch those paths cannot be merged until the required owners approve.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I remove a leaked secret from GitLab history?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Rotate the credential first. Then rewrite history with git filter-repo, force-push, and upload the generated commit-map in Settings &gt; Repository &gt; Repository cleanup so GitLab deletes the old objects.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related tutorials<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/gitlab-for-practical-pipelines-secure-delivery-and-faster-releases\/\">GitLab for Practical Pipelines, Secure Delivery, and Faster Releases<\/a><\/li>\n\n\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/what-is-gitlab-ci-cd-and-use-cases-of-gitlab-ci-cd\/\">What is GitLab CI\/CD and use cases of GitLab CI\/CD?<\/a><\/li>\n\n\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/gitlab-hierarchy-organization-namespace-group-project\/\">GitLab Hierarchy: Organization, Namespace, Group &amp; Project<\/a><\/li>\n\n\n<li><a href=\"https:\/\/www.devopsschool.com\/blog\/category\/devops\/gitlab\/\">More GitLab tutorials<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>GitLab cannot restrict who reads or edits a single file in a repository. Access is granted per project. You can still stop secrets from reaching the repository&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5112],"tags":[26293],"class_list":["post-49504","post","type-post","status-publish","format-standard","hentry","category-gitlab","tag-secrets-management"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/49504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=49504"}],"version-history":[{"count":4,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/49504\/revisions"}],"predecessor-version":[{"id":80178,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/49504\/revisions\/80178"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=49504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=49504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=49504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}