Eliminating the AI Blast Radius in CI/CD: Atomic Pre-Mutation Token Authorization for MCP A GitLab engineer detailed a fix in MR !270865 that enforces atomic pre-mutation authorization for the company's MCP server, requiring the composite permission set [:play_job, :read_job, :read_pipeline] in find_job! before any GraphQL mutation executes. Previously, a granular PAT holding only :run_job could pass the guard, trigger a production CI/CD job, then fail on response-field reads and return an error to the AI agent—prompting a catastrophic retry loop. The change rejects partial tokens with :unauthorized while leaving the job in manual status, backed by service and request-level RSpec coverage. What happens when an autonomous AI agent calls a CI/CD tool with a fine-grained token that has permission to trigger a production pipeline job, but lacks permission to read the resulting job object? In a naive GraphQL wrapper, the production deployment fires, the response query fails, and the AI agent thinks the call failed—setting up a catastrophic retry loop. When exposing CI/CD state mutations to AI agents via MCP, authorization cannot be treated as a single flat check. In GitLab's MCP server, the save pipeline job tool Mcp::Tools::Jobs::SavePipelineJobTool executes a GraphQL mutation jobPlay or jobRetry that both transitions a pipeline job's state and selects fields on the mutated CiJob and its parent Pipeline such as stage metadata to return structured confirmation to the agent. While working on Issue 639861 and authoring MR 270865 test mcp : add granular token authorization coverage for save pipeline job https://gitlab.com/gitlab-org/gitlab/-/merge requests/270865 , I analyzed the authorization boundary for GitLab's fine-grained Personal Access Tokens granular PATs . A granular PAT configured with the :run job permission expands internally to :play job and :retry job . If the pre-execution guard in find job only validates authorize granular token project, :play job , a token holding :run job alone passes the gate and invokes GitlabSchema.execute . Inside GraphQL, the mutation succeeds and enqueues the manual CI/CD job on a runner—a permanent side effect. Immediately afterward, GraphQL attempts to resolve the returned job and pipeline stage fields, which require :read job and :read pipeline permissions. Because the token lacks those read scopes, GraphQL redacts the return node to nil , and the MCP tool surfaces "Operation returned no job data" isError: true back to the agent after the job is already running. In MR 270865 https://gitlab.com/gitlab-org/gitlab/-/merge requests/270865 , we enforced atomic pre-mutation authorization by requiring the complete composite permission set— authorize granular token project, :play job, :read job, :read pipeline —inside find job before GitlabSchema.execute is ever invoked, accompanied by full service and request-level RSpec suites proving that partial granular tokens :run job without :read job and :read pipeline are rejected with :unauthorized while the manual job remains untouched in manual status. GitLab's granular Personal Access Token architecture and MCP security layer MR 270865 https://gitlab.com/gitlab-org/gitlab/-/merge requests/270865 enforce composite pre-flight permission verification across mutation and response-projection boundaries, ensuring AI agents never trigger silent, unobservable CI/CD pipeline executions. When an AI tool executes a GraphQL mutation and projects fields from the mutated graph, pre-authorize the union of both mutation permissions and response-graph read permissions before executing the mutation—otherwise read redaction looks like a failed write to an autonomous agent.