Clear ownership tells you who may act. The next step is to limit what their work can reach. Start with the task you just defined and give it the files, APIs, credentials, tools and network destinations it needs, for only as long as it needs them. A task such as “update this supported dependency in these projects” gives you concrete limits to configure and check.
Begin in the application project by reviewing its runners and variables, restricting ad hoc pipeline variables, and limiting job-token access to other projects. You'll then check an allowed repository read and a denied cross-project read. These settings control GitLab access. The local-task and dedicated-runner examples later in this chapter address execution and network restrictions; a complete Isolate implementation also needs trusted control of filesystems, privileges, tools, dependency sources, images, secrets and network routes.
| Standard example control | Implementation steps |
|---|---|
| Isolated execution | Inspect execution inputs, restrict a local task, and configure a dedicated runner. |
| Trusted dependencies | Review dependency sources. Finding vulnerable dependencies through SCA is separate from controlling what enters a build. |
| Sanctioned tools and access paths | Review agent tools and restrict job-token access. |
Record the effective execution inputs
Use the trusted Owner session and the application project ID prepared earlier. Record the project settings and every runner GitLab can offer to the project:
Record project settings and offered runners
glab api --hostname gitlab.com "projects/${GSS_APP_ID}" \
| jq '{id, path_with_namespace, visibility, default_branch,
shared_runners_enabled, group_runners_enabled,
ci_pipeline_variables_minimum_override_role,
ci_push_repository_for_job_token_allowed,
ci_allow_fork_pipelines_to_run_in_parent_project}'
glab api --hostname gitlab.com --paginate \
"projects/${GSS_APP_ID}/runners?per_page=100" \
| jq --slurp '[.[][] | {id, description, runner_type, status, paused,
is_shared, online} ]'
The runner list includes project runners, inherited group runners and allowed instance runners. In Settings > CI/CD > Runners, reconcile the API result with the UI and identify which runner should execute this workflow. Record its owner, scope, executor, tags, protected-runner setting, whether it accepts untagged jobs, projects that can submit work to it, and the operating boundary supplied by the runner owner. GitLab's runner scope documentation explains who can create and share each runner type.
An application Maintainer can create, edit, pause and remove project runners. Treat a project runner administered inside the application project as application-controlled. A group runner administered by trusted group Owners can separate runner administration, but its executor and network still need their own documented controls. GitLab-hosted runners can run the non-secret exercise below; their use alone does not demonstrate the workflow's required filesystem, privilege or egress limits.
For this exercise, select GitLab's hosted Linux AMD64 runner with the saas-linux-small-amd64 job tag. GitLab documents a newly provisioned VM for each job, deletion after execution, blocked public inbound and inter-VM traffic, and permitted public-internet outbound traffic. The VM has passwordless sudo, and the Linux fleet supports privileged Docker-in-Docker. This is a useful disposable execution environment, but it does not restrict the job to approved network destinations, tools or images. Match those limits to the task before supplying credentials. See GitLab-hosted runners and the Linux runner configuration.
Next open Settings > CI/CD > Variables in the application project and its ancestor groups. Record each variable's key, source, environment scope, type, Protected flag and visibility without copying its value. Review applicable pipeline execution policy YAML with its owner for variables supplied by policy. Do not use the variables API for this inventory in a shared terminal recording, because its response includes values.
Project Maintainers can administer project variables, and masked values can still be disclosed by malicious job code. Protected variables limit availability to protected refs; they do not protect a secret from untrusted code that is allowed to run on such a ref. Keep a consequential credential out of this application project unless the identity controlling CI configuration, ref eligibility and runner execution is within the credential's trust boundary. GitLab's CI/CD variable guidance describes masking, hiding, protection and their limits.
Close pipeline-variable and job-token paths
In Settings > CI/CD > Variables, set Minimum role to use pipeline variables to no one allowed unless this workflow has a reviewed need for manually supplied pipeline variables. Once this value is set, only an Owner can change it. Read the effective value back:
glab api --hostname gitlab.com "projects/${GSS_APP_ID}" \
| jq '{id, ci_pipeline_variables_minimum_override_role}'
Check that ci_pipeline_variables_minimum_override_role is no_one_allowed. This blocks the pipeline, trigger, schedule and manual-run variables covered by the setting. Variables in .gitlab-ci.yml, project or group settings, and pipeline execution policies remain available through their own paths. The pipeline-variable restriction documents that distinction.
In the application project, open Settings > CI/CD > Job token permissions:
- Leave the CI/CD job-token allowlist enabled.
- Remove every group or project entry that this workflow does not require. The application project itself is implicit.
- Leave Allow Git push requests to the repository off unless job-token pushes are an explicitly reviewed part of the workflow.
- If the project is public or internal, open Settings > General > Visibility, project features, permissions and limit repositories, artifacts, registries, releases, deployments and environments to project members where unauthenticated or broadly authenticated access is not intended.
Read back the inbound setting and the project and group allowlists:
Read back job-token scope and allowlists
glab api --hostname gitlab.com \
"projects/${GSS_APP_ID}/job_token_scope" \
| jq '{inbound_enabled}'
glab api --hostname gitlab.com --paginate \
"projects/${GSS_APP_ID}/job_token_scope/allowlist?per_page=100" \
| jq --slurp '[.[][] | {id, path_with_namespace}]'
glab api --hostname gitlab.com --paginate \
"projects/${GSS_APP_ID}/job_token_scope/groups_allowlist?per_page=100" \
| jq --slurp '[.[][] | {id, name, web_url}]'
Check for inbound_enabled: true and confirm that every allowlist entry is needed. A group entry includes future projects created anywhere below that group, so prefer a project entry when only one project needs access. The CI/CD job-token scope API describes these settings and responses.
Repeat the same review in every private target project this workflow might read, including security-policy. The target project's allowlist controls inbound job-token access. The user who triggered the source job must also have permission to the requested target resource. An allowlist entry supplies neither that membership nor a general-purpose API token.
These settings are useful limits, but the application Maintainer can change the application project's allowlist and job-token push setting. Place a durable cross-project restriction in the target project or its trusted parent, outside application-Maintainer administration. The allowlist controls supported GitLab resources; it is not a network allowlist, process sandbox, or outbound egress control.
Verify job-token access
Now check how a job token behaves with those settings in place. Use harmless repository files: the application's README.md for the allowed read and a separate private project's README.md for the denied read. The application identity should have Reporter access to the target, while the target's job-token project and group allowlists exclude the application and its ancestors. This lets you distinguish a job-token restriction from an account that cannot read the target at all. The security-policy project prepared earlier is suitable if it meets these conditions.
The local commands below require Bash, glab, jq, and Python 3. Before the pipeline, read both files as the trusted Owner and read the target file as the application identity. Require successful reads and retain the target's main SHA and file digest. In the Owner session, run:
(
set -euo pipefail
export GSS_DENIED_PROJECT_ID="<numeric-private-target-project-id>"
GSS_APP_MAIN_SHA="$(glab api --hostname gitlab.com \
"projects/${GSS_APP_ID}/repository/branches/main" \
| jq -er '.commit.id')"
GSS_TARGET_SHA="$(glab api --hostname gitlab.com \
"projects/${GSS_DENIED_PROJECT_ID}/repository/branches/main" \
| jq -er '.commit.id')"
GSS_OWNER_APP_FILE="$(mktemp)"
GSS_OWNER_TARGET_FILE="$(mktemp)"
glab api --hostname gitlab.com \
"projects/${GSS_APP_ID}/repository/files/README.md/raw?ref=${GSS_APP_MAIN_SHA}" \
>"${GSS_OWNER_APP_FILE}"
glab api --hostname gitlab.com \
"projects/${GSS_DENIED_PROJECT_ID}/repository/files/README.md/raw?ref=${GSS_TARGET_SHA}" \
>"${GSS_OWNER_TARGET_FILE}"
GSS_OWNER_APP_SHA256="$(python3 -c \
'import hashlib, sys; print(hashlib.sha256(open(sys.argv[1], "rb").read()).hexdigest())' \
"${GSS_OWNER_APP_FILE}")"
GSS_OWNER_TARGET_SHA256="$(python3 -c \
'import hashlib, sys; print(hashlib.sha256(open(sys.argv[1], "rb").read()).hexdigest())' \
"${GSS_OWNER_TARGET_FILE}")"
printf 'application_main_sha=%s application_bytes=%s application_sha256=%s\ntarget_sha=%s target_bytes=%s target_sha256=%s\n' \
"${GSS_APP_MAIN_SHA}" "$(wc -c <"${GSS_OWNER_APP_FILE}" | tr -d ' ')" \
"${GSS_OWNER_APP_SHA256}" \
"${GSS_TARGET_SHA}" "$(wc -c <"${GSS_OWNER_TARGET_FILE}" | tr -d ' ')" \
"${GSS_OWNER_TARGET_SHA256}"
rm -f "${GSS_OWNER_APP_FILE}" "${GSS_OWNER_TARGET_FILE}"
unset GSS_OWNER_APP_FILE GSS_OWNER_TARGET_FILE
)
In the separately authenticated application-identity session, use the same recorded target SHA. This command must succeed without printing the file body:
(
set -euo pipefail
export GSS_DENIED_PROJECT_ID="<numeric-private-target-project-id>"
export GSS_TARGET_SHA="<target-main-sha-from-owner-read>"
glab api --hostname gitlab.com "projects/${GSS_DENIED_PROJECT_ID}" \
| jq -e --argjson id "${GSS_DENIED_PROJECT_ID}" \
'select(.id == $id) | {id, path_with_namespace, visibility}'
GSS_ACTOR_TARGET_FILE="$(mktemp)"
glab api --hostname gitlab.com \
"projects/${GSS_DENIED_PROJECT_ID}/repository/files/README.md/raw?ref=${GSS_TARGET_SHA}" \
>"${GSS_ACTOR_TARGET_FILE}"
GSS_ACTOR_TARGET_SHA256="$(python3 -c \
'import hashlib, sys; print(hashlib.sha256(open(sys.argv[1], "rb").read()).hexdigest())' \
"${GSS_ACTOR_TARGET_FILE}")"
printf 'ordinary_target_bytes=%s ordinary_target_sha256=%s\n' \
"$(wc -c <"${GSS_ACTOR_TARGET_FILE}" | tr -d ' ')" \
"${GSS_ACTOR_TARGET_SHA256}"
rm -f "${GSS_ACTOR_TARGET_FILE}"
unset GSS_ACTOR_TARGET_FILE
)
The application account and Owner must receive files with the same digest. Set the target's numeric ID in GSS_DENIED_PROJECT_ID in the YAML below. GitLab's policy configuration access setting can separately grant access to the CI/CD configuration referenced by a policy; it doesn't grant access to other policy-project contents. Use README.md for this check, never the referenced CI/CD configuration file.
Use an existing authenticated clone of the application project and confirm that its origin URL names that exact project. Starting from the current application main, create the fixed disposable branch gss-containment/job-token-check. Confirm that the remote branch does not already exist before creating it. Add this temporary job to the application project's .gitlab-ci.yml, replace the target-ID placeholder, and review the change before pushing it as the application identity. It does not need to merge into the default branch:
(
set -euo pipefail
case "$(git remote get-url origin)" in
"https://gitlab.com/${GSS_APP_PATH}.git"|"git@gitlab.com:${GSS_APP_PATH}.git") ;;
*) printf 'origin does not name the prepared application project; stop.\n' >&2; exit 1 ;;
esac
git fetch origin main
if test -n "$(git status --porcelain)"; then
printf 'The working tree is not clean; stop before creating the exercise branch.\n' >&2
exit 1
fi
if git ls-remote --exit-code --heads origin \
refs/heads/gss-containment/job-token-check >/dev/null 2>&1; then
printf 'The fixed exercise branch already exists; stop and reconcile it.\n' >&2
exit 1
else
GSS_LS_REMOTE_STATUS="$?"
test "${GSS_LS_REMOTE_STATUS}" -eq 2
fi
git switch --create gss-containment/job-token-check origin/main
test "$(git rev-parse HEAD)" = "$(git rev-parse origin/main)"
)
containment-boundary-check:
image: curlimages/curl@sha256:43ebaa53d3806db6b1ce4353b6b26ae638ec1c167ee351524b05690f988bb20d
variables:
GSS_DENIED_PROJECT_ID: "<numeric-private-target-project-id>"
tags:
- saas-linux-small-amd64
script:
- |
set -eu
allowed_status="$(curl --silent --show-error --max-time 20 --retry 0 \
--output allowed.txt --write-out '%{http_code}' \
--header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/files/README.md/raw?ref=${CI_COMMIT_SHA}")"
denied_status="$(curl --silent --show-error --max-time 20 --retry 0 \
--output denied.txt --write-out '%{http_code}' \
--header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
"${CI_API_V4_URL}/projects/${GSS_DENIED_PROJECT_ID}/repository/files/README.md/raw?ref=main")"
allowed_bytes="$(wc -c < allowed.txt | tr -d ' ')"
denied_bytes="$(wc -c < denied.txt | tr -d ' ')"
allowed_sha256="$(sha256sum allowed.txt | cut -d ' ' -f 1)"
denied_sha256="$(sha256sum denied.txt | cut -d ' ' -f 1)"
printf 'same_project=%s same_bytes=%s same_sha256=%s cross_project=%s cross_bytes=%s cross_sha256=%s runner=%s protected_ref=%s\n' \
"$allowed_status" "$allowed_bytes" "$allowed_sha256" \
"$denied_status" "$denied_bytes" "$denied_sha256" \
"$CI_RUNNER_ID" "$CI_COMMIT_REF_PROTECTED"
test "$allowed_status" = 200
test "$allowed_bytes" -gt 0
case "$denied_status" in
403|404)
printf 'cross_project_denial_body='
cat denied.txt
printf '\n'
;;
*)
printf 'Unexpected cross-project status; denial is unproved.\n' >&2
exit 1
;;
esac
rules:
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "gss-containment/job-token-check"'
Review and commit only the CI change, then push using the application identity's Git credentials:
(
set -euo pipefail
test "$(git branch --show-current)" = "gss-containment/job-token-check"
git diff -- .gitlab-ci.yml
git add -- .gitlab-ci.yml
git commit -m "test: exercise scoped job-token access"
git rev-parse HEAD
git push --set-upstream origin HEAD:refs/heads/gss-containment/job-token-check
)
Keep the commit SHA so you can find the resulting pipeline. If the push response is lost, compare the remote branch's SHA before retrying. Git and glab can use different credentials, so check that the pipeline below names the application account as its trigger identity.
The image digest identifies the Linux AMD64 build of curlimages/curl:8.17.0. If you change the image or runner, review the platform and repeat both access checks. A job tag selects eligible runners; compare the runner recorded on the job with the runner inventory to confirm which one executed it.
Find the single successful push pipeline for this commit, triggered by the application identity. The job must report same-project 200 with a nonzero file length, and cross-project 403 or 404. GitLab uses those denial statuses when a request is forbidden or the resource is absent or inaccessible to the caller. The job prints the harmless denial body only for those responses; it never prints the successful file body, headers or job token.
A 401, timeout, DNS or TLS failure, 5xx, or another unexpected response needs diagnosis; it doesn't confirm the intended restriction. In the Owner session, inspect the exact pipeline, job and runner records without printing either successful file body:
(
set -euo pipefail
export GSS_DENIED_PROJECT_ID="<numeric-private-target-project-id>"
export GSS_APPLICATION_ACTOR_ID="<numeric-application-actor-user-id>"
export GSS_EXERCISE_BRANCH="gss-containment/job-token-check"
GSS_ENCODED_BRANCH="gss-containment%2Fjob-token-check"
GSS_EXERCISE_SHA="$(glab api --hostname gitlab.com \
"projects/${GSS_APP_ID}/repository/branches/${GSS_ENCODED_BRANCH}" \
| jq -er '.commit.id')"
GSS_PIPELINES_FILE="$(mktemp)"
glab api --hostname gitlab.com --paginate \
"projects/${GSS_APP_ID}/pipelines?sha=${GSS_EXERCISE_SHA}&ref=${GSS_ENCODED_BRANCH}&source=push&per_page=100" \
| jq -s 'add' >"${GSS_PIPELINES_FILE}"
test "$(jq 'length' "${GSS_PIPELINES_FILE}")" -eq 1
GSS_PIPELINE_ID="$(jq -er '.[0].id' "${GSS_PIPELINES_FILE}")"
GSS_PIPELINE_FILE="$(mktemp)"
glab api --hostname gitlab.com \
"projects/${GSS_APP_ID}/pipelines/${GSS_PIPELINE_ID}" \
>"${GSS_PIPELINE_FILE}"
jq -e --arg sha "${GSS_EXERCISE_SHA}" --arg ref "${GSS_EXERCISE_BRANCH}" \
--argjson actor "${GSS_APPLICATION_ACTOR_ID}" \
'select(.sha == $sha and .ref == $ref and .source == "push" and
.status == "success" and .user.id == $actor)' \
"${GSS_PIPELINE_FILE}" >/dev/null
jq '{id, sha, ref, source, status, user}' "${GSS_PIPELINE_FILE}"
GSS_JOBS_FILE="$(mktemp)"
glab api --hostname gitlab.com --paginate \
"projects/${GSS_APP_ID}/pipelines/${GSS_PIPELINE_ID}/jobs?per_page=100" \
| jq -s 'add' >"${GSS_JOBS_FILE}"
jq '[.[] | select(.name == "containment-boundary-check") |
{id, name, status, commit, pipeline, runner, runner_manager}]' \
"${GSS_JOBS_FILE}"
test "$(jq '[.[] | select(.name == "containment-boundary-check" and .status == "success")] | length' \
"${GSS_JOBS_FILE}")" -eq 1
GSS_OWNER_APP_FILE="$(mktemp)"
GSS_OWNER_TARGET_FILE="$(mktemp)"
glab api --hostname gitlab.com \
"projects/${GSS_APP_ID}/repository/files/README.md/raw?ref=${GSS_EXERCISE_SHA}" \
>"${GSS_OWNER_APP_FILE}"
GSS_TARGET_SHA_AFTER="$(glab api --hostname gitlab.com \
"projects/${GSS_DENIED_PROJECT_ID}/repository/branches/main" \
| jq -er '.commit.id')"
glab api --hostname gitlab.com \
"projects/${GSS_DENIED_PROJECT_ID}/repository/files/README.md/raw?ref=${GSS_TARGET_SHA_AFTER}" \
>"${GSS_OWNER_TARGET_FILE}"
GSS_OWNER_APP_SHA256="$(python3 -c \
'import hashlib, sys; print(hashlib.sha256(open(sys.argv[1], "rb").read()).hexdigest())' \
"${GSS_OWNER_APP_FILE}")"
GSS_OWNER_TARGET_SHA256="$(python3 -c \
'import hashlib, sys; print(hashlib.sha256(open(sys.argv[1], "rb").read()).hexdigest())' \
"${GSS_OWNER_TARGET_FILE}")"
printf 'application_sha=%s application_readme_sha256=%s target_sha=%s target_readme_sha256=%s\n' \
"${GSS_EXERCISE_SHA}" \
"${GSS_OWNER_APP_SHA256}" \
"${GSS_TARGET_SHA_AFTER}" \
"${GSS_OWNER_TARGET_SHA256}"
printf 'target_project_allowlist='
glab api --hostname gitlab.com --paginate \
"projects/${GSS_DENIED_PROJECT_ID}/job_token_scope/allowlist?per_page=100" \
| jq -s -c 'add | map({id, path_with_namespace})'
printf 'target_group_allowlist='
glab api --hostname gitlab.com --paginate \
"projects/${GSS_DENIED_PROJECT_ID}/job_token_scope/groups_allowlist?per_page=100" \
| jq -s -c 'add | map({id, name, web_url})'
rm -f "${GSS_PIPELINES_FILE}" "${GSS_PIPELINE_FILE}" "${GSS_JOBS_FILE}" \
"${GSS_OWNER_APP_FILE}" "${GSS_OWNER_TARGET_FILE}"
unset GSS_PIPELINES_FILE GSS_PIPELINE_FILE GSS_JOBS_FILE \
GSS_OWNER_APP_FILE GSS_OWNER_TARGET_FILE
)
Keep the source SHA, pipeline and job IDs, runner ID, ref-protection value, status codes and file digests together. Compare the same-project digest with the Owner's application README digest at that source SHA. GSS_TARGET_SHA_AFTER and its README digest must still match the values recorded before the pipeline.
Check the target's complete project and group job-token allowlists again. They must exclude the application project and its containing groups. The target's implicit self-access may appear in the project allowlist, so the whole list needn't be empty.
The successful same-project read confirms that the job ran, had a working token and reached GitLab. The cross-project rejection is meaningful because you've also checked that the file exists, the application account can read it directly, and the target's allowlist excludes the application's jobs. A rejection on its own wouldn't tell you which restriction caused it.
This check uses the job's short-lived CI_JOB_TOKEN; it does not mint or persist a personal, project or group access token. Keep allowed.txt and denied.txt as temporary job files and do not publish them as artifacts.
The job-token endpoint list permits the repository-file raw endpoint, and GitLab's job-token troubleshooting guidance describes authorization failures as 404 Not Found or similar. The REST status reference defines 403 as a disallowed request and 404 as an inaccessible resource, including authorization failures. This checks one GitLab API permission. To control the job's other credentials, filesystem access and network routes, continue with the execution settings below.
Restrict a local task's execution
For work that needs neither credentials nor an external connection, the local container procedure shows how to restrict a small task on a Docker host. A trusted operator controls the Docker host, image, program and inputs. The application Maintainer must not be able to replace those controls.
Configure a read-only root filesystem and read-only program and input mounts. Run as a non-root user, drop Linux capabilities, enable no-new-privileges, disable networking, and give the task only a small temporary workspace. Set resource limits appropriate to the task. The procedure provides the container commands and a sample program that checks permitted local work and restricted access.
Confirm that the useful task completes, external access fails for the intended network reason, and writes stay within the temporary workspace. Inspect the container configuration as well as the program's output: a failed connection alone doesn't establish that the network is isolated. Remove the task container and its temporary resources when finished.
These controls share the host kernel and don't provide a complete sandbox for hostile code. They also don't configure GitLab CI jobs. Docker explains the mechanisms in Running containers, resource constraints, tmpfs mounts, and Docker Engine security.
Configure a runner outside application administration
A GitLab job needs connections for checkout and artifact upload. The dedicated group-runner procedure adds those connections while keeping runner administration outside the application project. Keep group-runner administration, the runner token, proxy configuration and Docker-host access with the platform owner. Application Maintainers must not receive those permissions.
The worked example uses a private project and a protected default branch that only the trusted Owner can update. Configure the runner while paused, preload the pinned images, and allow only the intended task image. Disable image pulls and services, run the build as a non-root user, drop capabilities, enable no-new-privileges, and set memory and CPU limits. The build and helper containers use an internal Docker network; a separate proxy permits HTTPS connections to GitLab. Only the trusted Runner manager receives the Docker socket.
Before accepting work, confirm the runner's scope, protected-ref eligibility, tag, manager identity and configuration. Run a job that performs a checkout and uploads an artifact, then inspect its actual runner and containers. Check that ordinary work succeeds while prohibited network connections are denied. A tag selects eligible runners; it doesn't prove which runner executed the job. The detailed procedure includes the commands, expected responses and troubleshooting steps.
This job establishes the behavior of the separate runner project only. Before adopting it for the selected application, the runner and service owners need to bind the application's required jobs to an eligible trusted runner and remove or constrain alternate runners that could accept the same work. Inspect scheduled, triggered, parent-child and policy pipelines as well as ordinary branch jobs. For DAP, inspect the actual authoring path: runner-executed flows need the intended runner eligibility and composite identity. Agentic Chat in the UI or IDE uses a different authorization model; inspect where its tools execute and which credentials they use. Repeat the permitted job and representative prohibited paths from the selected application before treating this runner as its execution control.
This Docker-executor configuration provides no PID ceiling. Build-container user settings also don't establish the helper's user identity. The shared host and allowed GitLab connection need to fit the task's risk; these settings alone aren't suitable isolation for arbitrary hostile code or production secrets. Review runner security when selecting the host and executor.
When retiring the runner, pause it and wait for active jobs to finish. Remove its host configuration and token as well as the GitLab runner record. Remove only its own containers, networks and volumes, preserving other work on the host.
Review dependency sources and agent tools
Review package registries, image registries, mirrors and outbound destinations with the runner owner. Check the dependency manifests and lockfiles, permitted registry endpoints and who can change them. The Standard's trusted-dependency example concerns control before packages reach the build. The SCA profile later in this guide reports vulnerable dependencies; enabling it doesn't install a dependency firewall or enforce registry routing.
For DAP, review the flow's execution environment and its project setup before it runs repository code or installs dependencies. A dedicated runner used for the example job isn't automatically the executor for every enabled flow. Inspect the actual flow's runner and access requirements, especially before adding credentials.
Inventory the tools and external connections the agent can use. Where available, use agent tool governance to configure those permissions and examine its supported clients and background-flow behavior. An interactive approval prompt cannot control an unattended action unless the execution path supports that decision. Test the intended restriction in that path before relying on it.
Apply those decisions to the selected workflow rather than stopping at an inventory. The dependency or platform owner should configure the permitted registries, mirrors, image references and outbound destinations on its real build path. The agent or flow owner should configure the allowed tools and credentials on its actual execution path. Record the effective settings and run one permitted dependency or tool action plus a representative prohibited action. If the product or client can't enforce the intended restriction, remove that dependency or tool from the delegated path, place an enforceable control around it, or keep the workflow's authority below the level that requires the restriction.
Check who can weaken the boundary
Before relying on the configuration, revisit the project, runner and job-token pages as the application Maintainer. Note which settings that account can edit, without changing them just to test the UI. GitLab gives Maintainers administration of project runners, project variables and job-token allowlists, so keep that authority in mind when choosing where to enforce a restriction.
Use the trusted Owner to check the controls outside the application role: group-runner administration in a trusted ancestor, the policy project's variables and job-token allowlist, protected policy refs, and the security-policy link. If an application Maintainer can replace, retag, share or reconfigure a required runner or credential, move its administration outside that role before relying on the restriction.
Before a pilot, test the actual permitted task and representative prohibited actions, including excess volume and affected-system scope. A denied action is useful only when the permitted task works. A broken runner, missing file or unreachable service can deny everything without proving a guardrail.
Diagnose and recover containment
- The same-project request fails: inspect the job trace, source SHA, runner eligibility, GitLab connectivity and exact encoded file path. Resolve that failure before interpreting the cross-project result; the job must first be able to read its own project.
- Both requests return
200: stop the exercise. Inspect the target project's project and group allowlists, the trigger user's membership, target visibility and feature visibility. Remove unintended target-side entries with the target owner, then repeat both checks. - The denied request returns neither
403nor404: preserve the status and safe diagnostics without printing credentials or a successful response body. A401,5xx, timeout, DNS or TLS failure is not the expected allowlist denial; resolve authentication, service or network health before repeating the check. - The job runs on an unexpected runner: cancel it, preserve the job's runner ID and trace, then reconcile tags, untagged-job settings, runner scope and inherited runners. Do not put a credential into the job until the intended runner is selected reliably.
- A protected variable appears on an unprotected branch: cancel the pipeline, remove or rotate the credential through its owner, preserve the job/ref/settings record, and resolve protected-ref eligibility before continuing.
- An unneeded allowlist entry or runner remains: remove or pause it with its trusted owner and read the complete paginated inventory again. Deleting a runner in GitLab does not remove its host configuration; the runner owner must also unregister or decommission that configuration.
After the exercise, retain the trace and state readbacks, confirm the pipeline is terminal, and remove the disposable source branch. Remove any membership granted solely for the exercise and revoke temporary access tokens using the response procedure below. If the job has already been merged, remove it through a reviewed merge request unless it will remain as an owned regression check. Restore temporary allowlist or runner changes with their owner; never restore broader access merely because it was the starting state. Keep temporary projects private, assign an owner and a review or deletion date, and preserve required logs before deleting a project.
Before extending this setup to untrusted application code, sensitive credentials or production systems, review the execution environment with its owner. The example shares a local Docker host and allows GitLab connections through a proxy. You still need to resolve alternative-runner eligibility, select the required kernel and tenant separation, and define secret delivery and allowed destinations. Check the permitted task and relevant prohibited actions again after those choices are implemented.