Skip to content

Add Alice/Bob access control demo (Step 10) — scope-based access differentiation - #140

Merged
1 commit merged into
rossoctl:mainfrom
mrsabath:alice-bob-access-control
Mar 10, 2026
Merged

1 commit merged into
rossoctl:mainfrom
mrsabath:alice-bob-access-control

Conversation

@mrsabath

Copy link
Copy Markdown
Member

Summary

Extends the GitHub Issue Agent demo with Step 10: Access Control — Alice vs Bob, demonstrating scope-based access differentiation through AuthBridge.

  • Alice authenticates without the github-full-access scope -> tool uses PUBLIC_ACCESS_PAT -> can access public repos only
  • Bob authenticates with scope=openid github-full-access -> tool uses PRIVILEGED_ACCESS_PAT -> can access both public and private repos

Both manual (demo-manual.md) and UI (demo-ui.md) guides include identical Step 10 sections with sub-steps 10a-10f.

Changes

File Change
k8s/github-tool-deployment.yaml Add REQUIRED_SCOPE: "github-full-access" env var
demo-manual.md Add Step 10 (10a-10f): Alice/Bob access control demo
demo-ui.md Add Step 10 (10a-10f): Alice/Bob access control demo
demo.md Update overview to mention access control as item 6
Both demo files Fix bob user description (Copilot review: scope is requested, not auto-assigned)
Both demo files Add WORKAROUND marker + user-visible note linking to #139

Dependencies

Test plan

  • Deploy the full demo stack (Keycloak, webhook, agent, tool)
  • Run Step 10a-10b: verify test-client can retrieve agent credentials from Keycloak
  • Run Step 10c: verify Alice can query public repos but fails on private repos
  • Run Step 10d: verify Bob can query both public and private repos
  • Run Step 10e: verify tool logs show different scope-based PAT selection
  • After #139 lands: verify Alice's exchanged token omits github-full-access

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md and demo-ui.md with Alice/Bob access control demonstration
  • Updated demo.md overview to mention access control as item 6
  • Fixed bob user 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

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed — same fix applied to demo-ui.md. The flow description now explicitly references #139 as a dependency for scope preservation.

Comment thread AuthBridge/demos/github-issue/demo.md Outdated
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

Copilot AI Feb 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 scope parameter, so she gets only the default scopes (openid email profile + the agent audience scope). No github-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)

@mrsabath
mrsabath marked this pull request as draft March 9, 2026 15:55
…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>
@mrsabath
mrsabath force-pushed the alice-bob-access-control branch from 2855452 to a530ce4 Compare March 9, 2026 16:00
@mrsabath mrsabath closed this pull request by merging all changes into rossoctl:main in 938dbf2 Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants