Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(api): add file system and persisted folder API scopes (#58312)

Jovan Sakovic5d5fb1b8ac3d
diff --git a/frontend/src/lib/scopes.tsx b/frontend/src/lib/scopes.tsx
index 7c17faa2197f..b6623bb604f7 100644
--- a/frontend/src/lib/scopes.tsx
+++ b/frontend/src/lib/scopes.tsx
@@ -41,6 +41,16 @@ export const API_SCOPES: APIScope[] = [
{ key: 'external_data_source', objectName: 'External data source', objectPlural: 'external data sources' },
{ key: 'export', objectName: 'Export', objectPlural: 'exports' },
{ key: 'feature_flag', objectName: 'Feature flag', objectPlural: 'feature flags' },
+ {
+ key: 'file_system',
+ objectName: 'File system',
+ objectPlural: 'file system items',
+ // Read-only for now: the file-system delete path cascades into the backing
+ // object (dashboard, insight, cohort, feature flag, hog function, ...), so a
+ // `file_system:write` token would bypass the more specific resource scopes.
+ disabledActions: ['write'],
+ },
+ { key: 'file_system_shortcut', objectName: 'File system shortcut', objectPlural: 'file system shortcuts' },
{ key: 'group', objectName: 'Group', objectPlural: 'groups' },
{ key: 'health_issue', objectName: 'Health issue', objectPlural: 'health issues' },
{ key: 'heatmap', objectName: 'Heatmap', objectPlural: 'heatmaps' },
@@ -81,6 +91,7 @@ export const API_SCOPES: APIScope[] = [
},
},
{ key: 'person', objectName: 'Person', objectPlural: 'persons' },
+ { key: 'persisted_folder', objectName: 'Persisted folder', objectPlural: 'persisted folders' },
{ key: 'customer_profile_config', objectName: 'Customer profile config', objectPlural: 'customer profile configs' },
{ key: 'plugin', objectName: 'Plugin', objectPlural: 'plugins' },
{ key: 'product_tour', objectName: 'Product tour', objectPlural: 'product tours' },
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 6510bc39c330..0e3d43bffb34 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -5305,6 +5305,8 @@ export type APIScopeObject =
| 'external_data_source'
| 'export'
| 'feature_flag'
+ | 'file_system'
+ | 'file_system_shortcut'
| 'group'
| 'health_issue'
| 'heatmap'
@@ -5326,6 +5328,7 @@ export type APIScopeObject =
| 'organization_integration'
| 'organization_member'
| 'person'
+ | 'persisted_folder'
| 'plugin'
| 'product_tour'
| 'project'