Skip to content

Sub Access Graph entitlement#63117

Open
emargetis wants to merge 2 commits intomasterfrom
erikmargetis/access-graph-entitlement
Open

Sub Access Graph entitlement#63117
emargetis wants to merge 2 commits intomasterfrom
erikmargetis/access-graph-entitlement

Conversation

@emargetis
Copy link
Contributor

@emargetis emargetis commented Jan 23, 2026

Summary

This PR substitutes the now deprecated Policy entitlement for the new Access Graph entitlement. It also swaps out all usages in Teleport of Policy for Access Graph.

Note: The Access Graph entitlement has a structure of {Enabled: bool, Limit: num} while Policy only had {Enabled: bool}. While this PR is a 1:1 swap that only passes through the Enabled flag, the Limit value may want to be used in the future, 0 indicating a dedicated instance and 1 indicating a shared instance.

https://github.com/gravitational/teleport.e/pull/7898 will be similar to this PR


Merge order of PRs:

  1. https://github.com/gravitational/teleport.e/pull/7929
  2. Add access graph entitlement #64340
  3. (current) Sub Access Graph entitlement #63117
  4. https://github.com/gravitational/teleport.e/pull/7898

Supports https://github.com/gravitational/cloud/issues/16130


Manual Test Plan

Test Environment

I deployed a dev build with these changes alone to cloud staging (erik-ag-partial) and verified that toggling Access Graph from the SC UI provides and removes access in the product. Though you still need to roll the pods to see the expected UI.

Test Cases

  • Toggling on and rolling pods enables access graph
  • Toggling off and rolling pods disables access graph

Local Entitlement Testing

Prep

  1. Check out this branch and the corresponding e branch
  2. Create and run a local enterprise cloud tenant against a local salescenter instance
  3. Add this print statement on the Teleport side in feature.go to verify entitlements received by Teleport:
fmt.Printf("DEBUG GetCloudFeatures: entitlements=%v\n", resp.Entitlements)

Test AccessGraph entitlement independently

Enabled
  1. Add this code snippet just before the response from the handler and rebuild SC
// test AccessGraph entitlement works independently
e["Policy"] = &v1.EntitlementInfo{Enabled: false}
  1. Toggle on the Access Graph feature for the tenant in the SC UI
  2. Restart local tenant, visit the access graph page (/web/accessgraph), and verify you see the following error:
image
  1. Verify in the Teleport logs that Policy was not enabled and AccessGraph was set to enabled:true in the response
Disabled
  1. Toggle off Access Graph in the SC UI
  2. Restart the tenant to make sure it has the latest license updates, visit the access graph page, and verify you see a trial ad instead of the error above:
image
  1. Verify in the Teleport logs that Policy was not enabled and AccessGraph entitlement was not enabled in the response

Test Policy entitlement independently for backward compatibility (simulating old licenses)

Enabled
  1. Replace the code snippet from the previous test in the handlerwith the following and rebuild SC:
// test Policy entitlement still works independently
e["AccessGraph"] = &v1.EntitlementInfo{Enabled: false}  
  1. Toggle on Access Graph in the SC UI
  2. Restart local tenant, visit the access graph page (/web/accessgraph), and verify you see the same connection error again
  3. Verify in the Teleport logs that AccessGraph was not enabled and Policy was set to enabled:true in the response
Disabled
  1. Toggle off Access Graph in the SC UI
  2. Restart the tenant to make sure it has the latest license updates, visit the access graph page, and verify you see the trial ad instead of the error above
  3. Verify in the Teleport logs that AccessGraph was not enabled and Policy was not enabled in the response

@emargetis emargetis force-pushed the erikmargetis/access-graph-entitlement branch from c7c444c to 4154e68 Compare January 23, 2026 23:41
@emargetis emargetis changed the title Replacing policy with access graph entitlement Adding access graph entitlement Jan 26, 2026
@emargetis emargetis force-pushed the erikmargetis/access-graph-entitlement branch 2 times, most recently from 9bdf0fd to a48bdf9 Compare January 28, 2026 04:55
@emargetis emargetis changed the title Adding access graph entitlement Adding Access Graph entitlement Jan 28, 2026
@emargetis emargetis marked this pull request as ready for review January 30, 2026 19:50
@github-actions github-actions bot requested review from avatus and charlestp January 30, 2026 19:50
@emargetis emargetis added the no-changelog Indicates that a PR does not require a changelog entry label Jan 30, 2026
Copy link
Collaborator

@zmb3 zmb3 left a comment

Choose a reason for hiding this comment

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

I didn't get all the way through the review, but I've noticed that there are some things that make this PR hard to understand.

It looks like we used to have a "feature" for TAG/Policy/AccessGraph, and then we switched to entitlements, but we also kept the feature for compatibility.

This means there are a bunch of places where we're checking both the feature and the entitlement.

Now we're adding a third thing to check (an additional entitlement). That's a lot of combinations to test and verify that everything is working correctly.

Entitlements have been out for long enough now that we should be able to simplify this by removing the features so the entitlement becomes a single source of truth.

What do you think?

Comment on lines +933 to +934
// If the policy feature is disabled in the license, return a disabled response. if cloud, return the response to allow demo mode enabling
if !modules.GetModules().Features().GetEntitlement(entitlements.Policy).Enabled && !modules.GetModules().Features().AccessGraph && !modules.GetModules().Features().Cloud {
if !modules.GetModules().Features().GetEntitlement(entitlements.AccessGraph).Enabled && !modules.GetModules().Features().AccessGraph && !modules.GetModules().Features().Cloud {
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • I would update the comment here since it talks about the [deprecated] policy feature.
  • This if statement is also pretty hard to follow. I wonder if we can make it so that we can only check the AccessGraph entitlement here, and have the code that sets features handle the compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, right now the entitlement and feature serve somewhat unique purposes. The AccessGraph entitlement ensures the customer has access to the feature while the AccessGraph feature ensures the same AND that the TAG resource was connected (see code). I had a draft branch to decouple that feature but it's a bit more involved and not on the critical path for this PR.

@emargetis emargetis marked this pull request as draft March 5, 2026 13:38
@emargetis
Copy link
Contributor Author

Moving to draft while PR is rebased

@emargetis emargetis changed the title Adding Access Graph entitlement Swapping Access Graph entitlement Mar 5, 2026
@emargetis emargetis changed the title Swapping Access Graph entitlement Swap Access Graph entitlement Mar 5, 2026
@emargetis emargetis changed the title Swap Access Graph entitlement Sub Access Graph entitlement Mar 5, 2026
@emargetis emargetis changed the base branch from master to erikmargetis/add-access-graph-entitlement March 5, 2026 22:51
@emargetis emargetis force-pushed the erikmargetis/access-graph-entitlement branch from be45c44 to 7265e5f Compare March 5, 2026 23:34
@emargetis emargetis force-pushed the erikmargetis/add-access-graph-entitlement branch from eed9a9b to be4ca92 Compare March 6, 2026 23:24
@emargetis emargetis force-pushed the erikmargetis/access-graph-entitlement branch 2 times, most recently from d52cf07 to 0d28b8d Compare March 9, 2026 17:22
@emargetis emargetis marked this pull request as ready for review March 12, 2026 21:14
@github-actions github-actions bot requested review from kimlisa and rudream March 12, 2026 21:15
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d28b8d6f7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// If the policy feature is disabled in the license, return a disabled response. if cloud, return the response to allow demo mode enabling
if !modules.GetModules().Features().GetEntitlement(entitlements.Policy).Enabled && !modules.GetModules().Features().AccessGraph && !modules.GetModules().Features().Cloud {
// If the access graph feature is disabled in the license, return a disabled response. if cloud, return the response to allow demo mode enabling
if !modules.GetModules().Features().GetEntitlement(entitlements.AccessGraph).Enabled && !modules.GetModules().Features().AccessGraph && !modules.GetModules().Features().Cloud {

Choose a reason for hiding this comment

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

P1 Badge Keep Policy fallback in Access Graph authz gates

This gate now ignores the legacy Policy entitlement, so a cluster with Policy=true, AccessGraph=false, and Features.AccessGraph=false will be treated as unlicensed and denied (GetClusterAccessGraphConfig returns disabled, and update/upsert/reset paths now return AccessDenied). That is a regression during the deprecation window because Policy is still carried in entitlements and other paths still treat it as valid compatibility input.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

@emargetis emargetis Mar 13, 2026

Choose a reason for hiding this comment

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

Features.AccessGraph will be updated to be enabled if either AccessGraph or Policy entitlement is enabled in e.#7898.

AccessGraph entitlementsis also enabled if either AccessGraph or Policy is enabled for self-hosted licenses (GetSelfHostedLicenseFeatures) and legacy licenses (setLegacyLogic) in the same file.

For cloud, no fallback is needed as it always sets AccessGraph and Policy to the same value here

Base automatically changed from erikmargetis/add-access-graph-entitlement to master March 12, 2026 21:47
@emargetis emargetis force-pushed the erikmargetis/access-graph-entitlement branch from 0d28b8d to 115ab82 Compare March 12, 2026 21:58
@michellescripts michellescripts requested a review from tigrato March 12, 2026 22:03
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 115ab82766

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

discovery no-changelog Indicates that a PR does not require a changelog entry size/sm ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants