π OpenHands: AI-Driven Development
[Docs]: add info about lower scope tokens for gitlab (#9017)
Rohit Malhotra33b64786b094
diff --git a/docs/usage/cloud/gitlab-installation.mdx b/docs/usage/cloud/gitlab-installation.mdxindex 028b984fac..a2334d1e7c 100644--- a/docs/usage/cloud/gitlab-installation.mdx+++ b/docs/usage/cloud/gitlab-installation.mdx@@ -19,6 +19,12 @@ appropriate repository and branch you'd like OpenHands to work on. Then click on+## Using Tokens with Reduced Scopes++OpenHands requests an API-scoped token during OAuth authentication. By default, this token is provided to the agent.+To restrict the agent's permissions, you can define a custom secret `GITLAB_TOKEN`, which will override the default token assigned to the agent.+While the high-permission API token is still requested and used for other components of the application (e.g. opening merge requests), the agent will not have access to it.+## Next Steps- [Learn about the Cloud UI](/usage/cloud/cloud-ui).diff --git a/docs/usage/how-to/gui-mode.mdx b/docs/usage/how-to/gui-mode.mdxindex 0a96b34ebf..f82cb3fce1 100644--- a/docs/usage/how-to/gui-mode.mdx+++ b/docs/usage/how-to/gui-mode.mdx@@ -100,6 +100,11 @@ OpenHands automatically exports a `GITLAB_TOKEN` to the shell environment if pro- In the Settings page, navigate to the `Git` tab.- Paste your token in the `GitLab Token` field.- Click `Save Changes` to apply the changes.++ 3. **(Optional): Restrict agent permissions**+ - Create another PAT using Step 1 and exclude `api` scope .+ - In the Settings page, in the `Secrets` tab, create a new secret `GITLAB_TOKEN` and paste your lower scope token.+ - OpenHands will use the higher scope token, and the agent will use the lower scope token</Accordion><Accordion title="Troubleshooting">