Repository navigation
Add Alice/Bob access control demo (Step 10) — scope-based access differentiation - #140
1 commit merged into
Conversation
3e95432 to
2855452
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds Step 10: Access Control — Alice vs Bob to the GitHub Issue Agent demo, demonstrating scope-based access differentiation through AuthBridge. The demo introduces two test users (Alice and Bob) who authenticate with different OAuth scopes to demonstrate public vs. privileged GitHub API access. Step 10 is added identically to both the manual deployment guide (demo-manual.md) and UI deployment guide (demo-ui.md), with sub-steps 10a-10f.
The PR also adds the REQUIRED_SCOPE environment variable to the GitHub tool deployment, enabling it to select different GitHub PATs based on whether tokens contain the github-full-access scope. However, full functionality depends on scope forwarding (issue #139) which is not yet implemented - currently all exchanged tokens include github-full-access regardless of original user scopes.
Changes:
- Added
REQUIRED_SCOPE: "github-full-access"environment variable to GitHub tool deployment - Added Step 10 (10a-10f) to both
demo-manual.mdanddemo-ui.mdwith Alice/Bob access control demonstration - Updated
demo.mdoverview to mention access control as item 6 - Fixed
bobuser description in Keycloak setup table to clarify scope is requested, not auto-assigned - Added WORKAROUND markers linking to issue #139 for scope forwarding dependency
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
k8s/github-tool-deployment.yaml |
Add REQUIRED_SCOPE env var to enable scope-based PAT selection |
demo-manual.md |
Add Step 10 (Alice/Bob demo), update user descriptions, add WORKAROUND notes |
demo-ui.md |
Add Step 10 (Alice/Bob demo), update user descriptions, add WORKAROUND notes |
demo.md |
Add access control overview item, update table to show UI deployment link |
AuthBridge/README.md |
Add link to UI deployment guide in demos list |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| The flow: | ||
| 1. User authenticates with Keycloak using `password` grant | ||
| 2. Alice requests a token **without** `github-full-access`; Bob requests **with** it | ||
| 3. AuthBridge exchanges the token — the exchanged token preserves the scope difference |
There was a problem hiding this comment.
This line claims that "the exchanged token preserves the scope difference" but this directly contradicts the Known Limitation note above (lines 803-808) which states that scope forwarding is NOT implemented yet and all exchanged tokens include github-full-access regardless of the original user's scopes. This step describes the intended future behavior once issue #139 is implemented, not the current behavior. Consider revising to: "AuthBridge exchanges the token — once scope forwarding is implemented (#139), the exchanged token will preserve the scope difference" or move this line under a "Future behavior" heading.
There was a problem hiding this comment.
Addressed — replaced "the exchanged token preserves the scope difference" with an explicit note that this depends on scope forwarding (#139):
3. AuthBridge exchanges the token — once scope forwarding is implemented
(#139), the exchanged token will preserve the scope difference
The Known Limitation callout at the top of Step 10 was already accurate; now the flow description is consistent with it.
| The flow: | ||
| 1. User authenticates with Keycloak using `password` grant | ||
| 2. Alice requests a token **without** `github-full-access`; Bob requests **with** it | ||
| 3. AuthBridge exchanges the token — the exchanged token preserves the scope difference |
There was a problem hiding this comment.
This line claims that "the exchanged token preserves the scope difference" but this directly contradicts the Known Limitation note above (lines 734-739) which states that scope forwarding is NOT implemented yet and all exchanged tokens include github-full-access regardless of the original user's scopes. This step describes the intended future behavior once issue #139 is implemented, not the current behavior. Consider revising to: "AuthBridge exchanges the token — once scope forwarding is implemented (#139), the exchanged token will preserve the scope difference" or move this line under a "Future behavior" heading.
There was a problem hiding this comment.
Addressed — same fix applied to demo-ui.md. The flow description now explicitly references #139 as a dependency for scope preservation.
| 3. **Transparent token exchange** — When the agent calls the GitHub tool, AuthBridge exchanges the token automatically | ||
| 4. **Subject preservation** — The end user's identity (`sub` claim) is preserved through the exchange | ||
| 5. **Scope-based access** — The tool uses token scopes to determine public or privileged GitHub API access | ||
| 6. **Access control (Alice vs Bob)** — Two users with different scopes get different GitHub API access levels: Alice (public only) cannot access private repos, while Bob (privileged) can access both |
There was a problem hiding this comment.
This line claims that Alice and Bob "get different GitHub API access levels" but according to the Known Limitation notes in Step 10 of both demo files, scope forwarding is NOT yet implemented (issue #139). Currently, all exchanged tokens include github-full-access regardless of the original user's scopes, so Alice and Bob would currently get the same access level. This describes the intended future behavior. Consider adding a note here about the dependency on issue #139, similar to the workaround notes in the demo files.
There was a problem hiding this comment.
Addressed — added (requires scope forwarding: kagenti-extensions#139) to the overview line in demo.md so the dependency is visible at a glance.
| -d "grant_type=password" \ | ||
| -d "username=bob" \ | ||
| -d "password=bob123" \ | ||
| -d "scope=openid github-full-access" \ |
There was a problem hiding this comment.
why is github-full-access scope requested for bob but not alice. If alice has a lesser role, this should still work as expected and get an access token without the scope.
There was a problem hiding this comment.
Good question. github-full-access is configured as a realm OPTIONAL scope in Keycloak (set up by setup_keycloak.py). Keycloak only includes optional scopes in a token when they are explicitly requested in the scope parameter of the token request.
- Alice omits the
scopeparameter, so she gets only the default scopes (openid email profile+ the agent audience scope). Nogithub-full-access. - Bob explicitly passes
scope=openid github-full-access, so Keycloak includes it.
This is standard Keycloak behavior for optional vs default scopes — it's not a role difference, it's a request-time choice. Both users could request the scope, but the demo shows the difference when one does and one doesn't.
Updated the flow description to clarify this:
2. Alice requests a token **without** github-full-access; Bob explicitly requests **with** it
(github-full-access is a realm OPTIONAL scope — Keycloak only includes it when the
token request contains scope=openid github-full-access)
…cess Add Step 10 to both demo-manual.md and demo-ui.md demonstrating scope-based access control: Alice (public only) vs Bob (privileged) through AuthBridge token exchange. - Add REQUIRED_SCOPE env var to github-tool-deployment.yaml - Add Step 10 (10a-10f) with Alice/Bob access control walkthrough - Update demo.md overview with access control description - Clarify scope forwarding dependency (#139) in flow description - Explain why Bob explicitly requests github-full-access (realm OPTIONAL scope) - Update all Keycloak URLs from demo realm to kagenti realm Depends on: kagenti-extensions#139 (scope forwarding) Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: Mariusz Sabath <mrsabath@gmail.com>
2855452 to
a530ce4
Compare
Summary
Extends the GitHub Issue Agent demo with Step 10: Access Control — Alice vs Bob, demonstrating scope-based access differentiation through AuthBridge.
github-full-accessscope -> tool usesPUBLIC_ACCESS_PAT-> can access public repos onlyscope=openid github-full-access-> tool usesPRIVILEGED_ACCESS_PAT-> can access both public and private reposBoth manual (
demo-manual.md) and UI (demo-ui.md) guides include identical Step 10 sections with sub-steps 10a-10f.Changes
k8s/github-tool-deployment.yamlREQUIRED_SCOPE: "github-full-access"env vardemo-manual.mddemo-ui.mddemo.mdbobuser description (Copilot review: scope is requested, not auto-assigned)WORKAROUNDmarker + user-visible note linking to #139Dependencies
github-issue-demo-ui) — must merge firstTARGET_SCOPES, so all exchanged tokens includegithub-full-access. Full Alice/Bob differentiation requires the scope forwarding feature. A workaround note is included in both demo files.Test plan
github-full-access