Safeguard
Security Guides•

GitLab CI include: project, remote or template, which is safer?

Prefer include:project over include:remote for shared GitLab CI config, point it at a fixed ref you control, and review shared file changes like code.

Safeguard Security Team
3 min read

Prefer include:project over include:remote. GitLab's documentation recommends fetching shared configuration from another project on the same instance when possible, because it avoids an external HTTP request. Whichever you use, point it at a fixed ref you control and review changes to the shared file as you would application code.

What each include type does

include:local pulls a file from the same repository.

include:project fetches a file from another project on your GitLab instance. You name the project, a ref and the file path.

include:remote fetches a file over HTTP or HTTPS from a URL.

include:template pulls a template that GitLab provides.

Why this is a security question

An included file becomes part of your pipeline. Whoever can change that file can change what your jobs run, including scripts that see your variables. So the question is not only where the file lives, but who can edit it and whether you pick up edits automatically.

The GitLab page notes that remote fetches can fail for connectivity reasons and that remote hosts may rate-limit requests. It does not describe an integrity or checksum option for remote includes, so treat a remote URL as content you do not control unless you control the host.

Comparison

TypeWhere the file livesWho can change itMain concern
localSame repoAnyone who can merge thereNormal code review applies
projectAnother project on your instanceThat project's maintainersChanges flow to every consumer
remoteAny URLWhoever controls the hostNo integrity check described, availability
templateProvided by GitLabGitLab, via product upgradesBehaviour can change on upgrade

Steps for a safer shared config

  1. Host shared config in a project you own, and use include:project.
  2. Set the ref deliberately. The documentation example uses a branch. A branch moves every time someone pushes to it. Check which ref types your GitLab version accepts and prefer a tag or commit you control for stable pipelines.
  3. Protect that project. Require merge request approval, and limit who can push to the branch or tag you reference.
  4. Avoid remote includes from hosts you do not control.
  5. Keep secrets out of shared files, and keep deploy jobs in the project that owns them.

Common mistakes

  • Pointing a shared include at a branch that many people can push to, so one careless push changes every pipeline that uses it.
  • Letting a template project sit with default permissions while dozens of pipelines depend on it.
  • Putting deploy logic in a shared template that any project can include, rather than in the project that owns the deployment.
  • Forgetting that a change to a shared file affects every consumer at once, so test changes in a staging project first and announce them.

Quick check

Is include:project always safe?

No. It moves the trust to whoever maintains that project. Protect the branch or tag you reference.

Should I host shared CI config on GitLab Pages?

GitLab's documentation says to avoid it, because GitLab.com Pages is rate limited. Use include:project instead.

Safeguard can enforce policies and gates on merge requests and scan the dependencies those pipelines build. The free scan shows what a repository pulls in.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.