doc/user/gitlab_duo/prompt_guardrails.md
GitLab Duo has foundational prompt guardrails. These guardrails rely on structured prompts, enforced context boundaries, and filtering tools, which help:
These safeguards support compliance with common regulatory standards, like GDPR, by helping to minimize risks associated with AI-driven workflows.
[!note] While these guardrails may reduce risks, they do not eliminate all vulnerabilities. No system can guarantee complete protection against all misuse or sophisticated attacks.
The prompts used by GitLab Duo aim to:
<log> tags, helping to ensure the model focuses only on the provided context without making unrelated assumptions.Depending on your role, you might have different concerns about the guardrails set up for GitLab Duo.
<selected_code>, <git_diff>, and <log>
encourage the model to focus strictly on the code or content you provide, helping reduce the risk of prompt injection.Individual features include specific prompt instructions to help limit exposure. The prompt instructions adhere to the following principles.
Isolates untrusted content to help prevent prompt injection.
On the AI Gateway, detects prompt injection attempts and logs or blocks them.
Responses should remain on-topic, constructive, and non-abusive. Personality shifts, role play, or malicious instructions are discouraged. Focusing on user-provided content helps reduce injection risk.
Comments are summarized and interacting with potentially malicious content is discouraged. The user should be warned about suspicious comments without revealing or replicating them.
Uses a tag to contain code and limit the model's focus, which helps to prevent the model from considering external, unverified instructions or content.
Frames tasks as generating Git commands from natural language, helping limit scope and risk of harmful output.
Isolates the code to help prevent prompt injection.
Isolates the code to help prevent prompt injection.
Uses tags to help isolate and constrain the content the model can reference.
Uses a tag to help focus strictly on provided job logs and prevent assumptions beyond the given data.
Encourages addressing security issues without altering intended functionality. The model is instructed to focus on the provided code diff to help prevent changes to code.