Skip to content

Commit d95d46a

Browse files
authored
feat(auth): Replace granular scopes with wildcard scope (#1612)
## Summary Instead or updating the scopes all the time, proposing we use a single `*` wildcard scope in PostHog OAuth. Bumps `OAUTH_SCOPE_VERSION` from 3 to 4, forcing existing sessions to re-authenticate with the new scope --- _Created with_ [_PostHog Code_](https://posthog.com/code?ref=pr)
1 parent 24ac14e commit d95d46a

2 files changed

Lines changed: 4 additions & 68 deletions

File tree

apps/code/src/shared/constants/oauth.test.ts

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,9 @@ describe("OAUTH_SCOPES guard", () => {
88
scopes: OAUTH_SCOPES,
99
}).toMatchInlineSnapshot(`
1010
{
11-
"scopeVersion": 3,
11+
"scopeVersion": 4,
1212
"scopes": [
13-
"user:read",
14-
"user:write",
15-
"project:read",
16-
"task:write",
17-
"llm_gateway:read",
18-
"integration:read",
19-
"introspection",
20-
"action:read",
21-
"action:write",
22-
"dashboard:read",
23-
"dashboard:write",
24-
"error_tracking:read",
25-
"error_tracking:write",
26-
"event_definition:read",
27-
"event_definition:write",
28-
"experiment:read",
29-
"experiment:write",
30-
"feature_flag:read",
31-
"feature_flag:write",
32-
"insight:read",
33-
"insight:write",
34-
"logs:read",
35-
"organization:read",
36-
"property_definition:read",
37-
"query:read",
38-
"survey:read",
39-
"survey:write",
40-
"warehouse_table:read",
41-
"warehouse_view:read",
42-
"external_data_source:read",
43-
"external_data_source:write",
13+
"*",
4414
],
4515
}
4616
`);

apps/code/src/shared/constants/oauth.ts

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,9 @@ export const POSTHOG_EU_CLIENT_ID = "AIvijgMS0dxKEmr5z6odvRd8Pkh5vts3nPTzgzU9";
55
export const POSTHOG_DEV_CLIENT_ID = "DC5uRLVbGI02YQ82grxgnK6Qn12SXWpCqdPb60oZ";
66

77
// Bump OAUTH_SCOPE_VERSION below whenever OAUTH_SCOPES changes to force re-authentication
8-
export const OAUTH_SCOPES = [
9-
// PostHog Code app needs
10-
"user:read",
11-
"user:write",
12-
"project:read",
13-
"task:write",
14-
"llm_gateway:read",
15-
"integration:read",
16-
"introspection",
17-
// MCP server scopes
18-
"action:read",
19-
"action:write",
20-
"dashboard:read",
21-
"dashboard:write",
22-
"error_tracking:read",
23-
"error_tracking:write",
24-
"event_definition:read",
25-
"event_definition:write",
26-
"experiment:read",
27-
"experiment:write",
28-
"feature_flag:read",
29-
"feature_flag:write",
30-
"insight:read",
31-
"insight:write",
32-
"logs:read",
33-
"organization:read",
34-
"property_definition:read",
35-
"query:read",
36-
"survey:read",
37-
"survey:write",
38-
"warehouse_table:read",
39-
"warehouse_view:read",
40-
"external_data_source:read",
41-
"external_data_source:write",
42-
];
8+
export const OAUTH_SCOPES = ["*"];
439

44-
export const OAUTH_SCOPE_VERSION = 3;
10+
export const OAUTH_SCOPE_VERSION = 4;
4511

4612
export const REGION_LABELS: Record<CloudRegion, string> = {
4713
us: "🇺🇸 US Cloud",

0 commit comments

Comments
 (0)