Restrict a Composio GitHub session to a read-only tool

Limit a test session to one GitHub read action and verify which operations the agent can use.

Updated

Goal: one permitted GitHub operation

Use a test repository and a known issue number. This guide extends a working Composio setup; it is not a standalone agent program. It distinguishes three boundaries: session tools, GitHub account permissions and the repository your application allows the user to read.

1. Create a narrow session

After initializing the composio Python client according to the Quickstart, use the following configuration fragment. The sandbox is disabled because this read does not require remote code execution. The fragment contains neither a key nor an executed issue read.

session = composio.sessions.create(
    user_id="qailt_test_user",
    toolkits=["github"],
    tools={"github": {"enable": ["GITHUB_GET_AN_ISSUE"]}},
    sandbox={"enable": False},
)

2. Understand what this does not restrict

GITHUB_GET_AN_ISSUE reads an issue. A tool allowlist alone does not constrain arguments to a particular repository: your application must validate owner, repository and issue number before execution. Nor does it retroactively reduce GitHub OAuth grants. Review those permissions separately. Changing scopes in an auth configuration affects existing connections only after reconnection.

3. Check the boundary without writing

Inspect the configuration and application tools the session can discover and execute. Read the known issue and compare its number and title with GitHub. Confirm that create, close and edit operations are not permitted. Connection-management helpers can remain present: do not mistake these helpers for permission to write to GitHub.

Expected result and stop conditions

Keep a test record containing identity, allowed repository, expected issue, permitted tool and read result. If another GitHub tool is executable, do not release the agent before fixing the policy. Test write rejection in an isolated environment or policy test, never by attempting a destructive operation on a production repository. Observing no writes in one trial does not itself prove writes are impossible.