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(audit): record instance setting changes via DRF API (#59555)

Phil Haackb8c38c60ae6c
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 7253b900ea32..05d6d455df4b 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -5588,6 +5588,7 @@ export enum ActivityScope {
LOGS_ALERT_CONFIGURATION = 'LogsAlertConfiguration',
PRODUCT_TOUR = 'ProductTour',
TICKET = 'Ticket',
+ INSTANCE_SETTING = 'InstanceSetting',
}
export type CommentType = {
diff --git a/posthog/api/instance_settings.py b/posthog/api/instance_settings.py
index 1c3f1f7e81a8..d0c01ca89cdb 100644
--- a/posthog/api/instance_settings.py
+++ b/posthog/api/instance_settings.py
@@ -1,10 +1,16 @@
import re
import json
-from typing import Any, Optional, Union, get_args, get_origin
+from typing import Any, Optional, Union, cast, get_args, get_origin
+import structlog
+from loginas.utils import is_impersonated_session
from rest_framework import exceptions, mixins, permissions, serializers, viewsets
+from rest_framework.request import Request
from posthog.cloud_utils import is_cloud
+from posthog.email import is_email_available
+from posthog.models import User
+from posthog.models.activity_logging.activity_log import Change, Detail, log_activity
from posthog.models.instance_setting import (
get_instance_setting as get_instance_setting_raw,
set_instance_setting as set_instance_setting_raw,
@@ -16,8 +22,22 @@ from posthog.settings import (
SETTINGS_ALLOWING_API_OVERRIDE,
SKIP_ASYNC_MIGRATIONS_SETUP,
)
+from posthog.tasks.email import send_canary_email
from posthog.utils import str_to_bool
+logger = structlog.get_logger(__name__)
+
+REDACTED = "<redacted>"
+UNSET = "<unset>"
+
+
+def _redact_if_secret(key: str, value: Any) -> Any:
+ if key not in SECRET_SETTINGS:
+ return value
+ if value is None or value == "":
+ return UNSET
+ return REDACTED
+
def cast_str_to_desired_type(value: Any, target_type: type) -> Any:
if target_type is int:
@@ -111,6 +131,10 @@ class InstanceSettingsSerializer(serializers.Serializer):
if validated_data["value"] is None:
raise serializers.ValidationError({"value": "This field is required."}, code="required")
+ request = self.context.get("request")
+
+ before_value = get_instance_setting_raw(instance.key)
+
target_type: type = CONSTANCE_CONFIG[instance.key][2]
if target_type is bool and isinstance(validated_data["value"], bool):
new_value_parsed = validated_data["value"]
@@ -135,18 +159,59 @@ class InstanceSettingsSerializer(serializers.Serializer):
set_instance_setting_raw(instance.key, new_value_parsed)
instance.value = new_value_parsed
- if instance.key.startswith("EMAIL_") and "request" in self.context:
- from posthog.tasks.email import send_canary_email
+ if request is not None:
+ self._log_setting_change(request, instance.key, before_value, new_value_parsed)
- send_canary_email.apply_async(kwargs={"user_email": self.context["request"].user.email})
- elif instance.key.startswith("ASYNC_MIGRATION"):
+ if instance.key.startswith("EMAIL_"):
+ # Partial EMAIL_* updates (e.g. setting EMAIL_HOST_PASSWORD before EMAIL_HOST)
+ # would otherwise raise ImproperlyConfigured and fail the request with a 500.
+ if is_email_available(with_absolute_urls=True):
+ send_canary_email.apply_async(kwargs={"user_email": request.user.email})
+
+ if instance.key.startswith("ASYNC_MIGRATION") and not SKIP_ASYNC_MIGRATIONS_SETUP:
from posthog.async_migrations.setup import setup_async_migrations
- if not SKIP_ASYNC_MIGRATIONS_SETUP:
- setup_async_migrations()
+ setup_async_migrations()
return instance
+ def _log_setting_change(self, request: Request, key: str, before_value: Any, new_value: Any) -> None:
+ if before_value == new_value:
+ return
+
+ # IsAuthenticated + IsStaffUser permission classes guarantee this is a real User.
+ user = cast(User, request.user)
+ organization = user.organization
+ if organization is None:
+ logger.warning(
+ "instance_settings_audit_log_skipped_no_organization",
+ user_id=user.id,
+ key=key,
+ )
+ return
+
+ log_activity(
+ organization_id=organization.id,
+ team_id=None,
+ user=user,
+ was_impersonated=is_impersonated_session(request),
+ item_id=key,
+ scope="InstanceSetting",
+ activity="updated",
+ detail=Detail(
+ name=key,
+ changes=[
+ Change(
+ type="InstanceSetting",
+ field=key,
+ action="changed",
+ before=_redact_if_secret(key, before_value),
+ after=_redact_if_secret(key, new_value),
+ )
+ ],
+ ),
+ )
+
class InstanceSettingsViewset(
viewsets.GenericViewSet,
diff --git a/posthog/api/test/test_instance_settings.py b/posthog/api/test/test_instance_settings.py
index 38049b3972cf..d136137dbdd1 100644
--- a/posthog/api/test/test_instance_settings.py
+++ b/posthog/api/test/test_instance_settings.py
@@ -1,5 +1,8 @@
+import json
+
import unittest
from posthog.test.base import APIBaseTest
+from unittest.mock import patch
from django.core import mail
@@ -7,11 +10,15 @@ from parameterized import parameterized
from rest_framework import status
from posthog.api.instance_settings import (
+ REDACTED,
+ UNSET,
+ _redact_if_secret,
cast_str_to_desired_type,
get_instance_setting as get_instance_setting_helper,
)
+from posthog.models import ActivityLog
from posthog.models.instance_setting import get_instance_setting, override_instance_config, set_instance_setting
-from posthog.settings import CONSTANCE_CONFIG
+from posthog.settings import CONSTANCE_CONFIG, SECRET_SETTINGS, SETTINGS_ALLOWING_API_OVERRIDE
class TestCastStrToDesiredType(unittest.TestCase):
@@ -48,12 +55,73 @@ class TestCastStrToDesiredType(unittest.TestCase):
cast_str_to_desired_type(value, target_type)
+class TestSecretSettingsCoverage(unittest.TestCase):
+ SENSITIVE_NAME_SUBSTRINGS = ("SECRET", "PASSWORD", "KEY", "TOKEN")
+
+ def test_api_overridable_keys_with_sensitive_names_are_in_secret_settings(self) -> None:
+ offenders = [
+ key
+ for key in SETTINGS_ALLOWING_API_OVERRIDE
+ if any(s in key for s in self.SENSITIVE_NAME_SUBSTRINGS) and key not in SECRET_SETTINGS
+ ]
+ self.assertEqual(
+ offenders,
+ [],
+ (
+ f"Keys named like credentials must be redacted. Add {offenders} to SECRET_SETTINGS "
+ f"in posthog/settings/dynamic_settings.py, or rename them if they are not actually secrets."
+ ),
+ )
+
+ def test_every_secret_setting_exists_in_constance_config(self) -> None:
+ missing = [key for key in SECRET_SETTINGS if key not in CONSTANCE_CONFIG]
+ self.assertEqual(
+ missing,
+ [],
+ f"SECRET_SETTINGS references unknown keys {missing}; CONSTANCE_CONFIG is the source of truth.",
+ )
+
+ @parameterized.expand(
+ [
+ ("none", None, UNSET),
+ ("empty_string", "", UNSET),
+ ("nonempty_string", "hunter2", REDACTED),
+ ("integer", 42, REDACTED),
+ ("boolean", False, REDACTED),
+ ]
+ )
+ def test_redact_if_secret_redacts_secret_keys(self, _name: str, value: object, expected: object) -> None:
+ self.assertEqual(_redact_if_secret("EMAIL_HOST_PASSWORD", value), expected)
+
+ @parameterized.expand(
+ [
+ ("string", "smtp.example.com"),
+ ("integer", 25),
+ ("boolean_true", True),
+ ("boolean_false", False),
+ ("empty_string", ""),
+ ("none", None),
+ ("list", [1, 2, 3]),
+ ]
+ )
+ def test_redact_if_secret_passes_through_non_secret_keys(self, _name: str, value: object) -> None:
+ self.assertEqual(_redact_if_secret("EMAIL_HOST", value), value)
+
+
class TestInstanceSettings(APIBaseTest):
def setUp(self):
super().setUp()
self.user.is_staff = True
self.user.save()
+ def _instance_setting_logs(self):
+ return ActivityLog.objects.filter(scope="InstanceSetting")
+
+ def _clear_user_org(self):
+ self.user.current_organization = None
+ self.user.current_team = None
+ self.user.save(update_fields=["current_organization", "current_team"])
+
def test_list_instance_settings(self):
response = self.client.get(f"/api/instance_settings/")
self.assertEqual(response.status_code, status.HTTP_200_OK)
@@ -219,3 +287,187 @@ class TestInstanceSettings(APIBaseTest):
self.assertEqual(get_instance_setting_helper("AUTO_START_ASYNC_MIGRATIONS").value, False)
self.assertEqual(get_instance_setting("AUTO_START_ASYNC_MIGRATIONS"), False)
+
+ @parameterized.expand(
+ [
+ ("bool", "AUTO_START_ASYNC_MIGRATIONS", False, True),
+ ("int", "ASYNC_MIGRATIONS_ROLLBACK_TIMEOUT", 30, 60),
+ ("string", "GITHUB_APP_SLUG", "", "posthog-app"),
+ ]
+ )
+ def test_update_setting_writes_activity_log(
+ self,
+ _name: str,
+ key: str,
+ before: object,
+ after: object,
+ ):
+ set_instance_setting(key, before)
+ initial_count = self._instance_setting_logs().count()
+
+ response = self.client.patch(f"/api/instance_settings/{key}", {"value": after})
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+
+ logs = self._instance_setting_logs()
+ self.assertEqual(logs.count(), initial_count + 1)
+
+ log = logs.order_by("-created_at").first()
+ assert log is not None
+ self.assertEqual(log.scope, "InstanceSetting")
+ self.assertEqual(log.item_id, key)
+ self.assertEqual(log.activity, "updated")
+ self.assertEqual(log.organization_id, self.organization.id)
+ self.assertIsNone(log.team_id)
+ self.assertEqual(log.user, self.user)
+ self.assertFalse(log.was_impersonated)
+
+ assert log.detail is not None
+ self.assertEqual(log.detail["name"], key)
+ changes = log.detail["changes"]
+ self.assertEqual(len(changes), 1)
+ self.assertEqual(changes[0]["type"], "InstanceSetting")
+ self.assertEqual(changes[0]["field"], key)
+ self.assertEqual(changes[0]["action"], "changed")
+ self.assertEqual(changes[0]["before"], before)
+ self.assertEqual(changes[0]["after"], after)
+
+ @parameterized.expand(
+ [
+ ("install", "", "hunter2", "<unset>", "<redacted>"),
+ ("rotate", "old_secret", "new_secret", "<redacted>", "<redacted>"),
+ ("clear", "old_secret", "", "<redacted>", "<unset>"),
+ ]
+ )
+ def test_update_secret_setting_redacts_value(
+ self,
+ _name: str,
+ before: str,
+ after: str,
+ expected_before: str,
+ expected_after: str,
+ ):
+ set_instance_setting("EMAIL_HOST_PASSWORD", before)
+ initial_count = self._instance_setting_logs().count()
+
+ response = self.client.patch(f"/api/instance_settings/EMAIL_HOST_PASSWORD", {"value": after})
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+
+ logs = self._instance_setting_logs()
+ self.assertEqual(logs.count(), initial_count + 1)
+
+ log = logs.order_by("-created_at").first()
+ assert log is not None
+ change = log.detail["changes"][0]
+ self.assertEqual(change["before"], expected_before)
+ self.assertEqual(change["after"], expected_after)
+
+ # Defense in depth: the cleartext must appear nowhere in the serialized row.
+ raw_detail = json.dumps(log.detail)
+ if before:
+ self.assertNotIn(before, raw_detail)
+ if after:
+ self.assertNotIn(after, raw_detail)
+
+ @parameterized.expand([(key,) for key in SECRET_SETTINGS])
+ def test_every_secret_setting_is_redacted_on_update(self, key: str):
+ # End-to-end: PATCH every declared secret setting and assert the cleartext
+ # never lands in `posthog_activitylog.detail`. Catches the case where someone
+ # adds a new key to SECRET_SETTINGS but the redaction path silently misses it.
+ before_value = f"old-{key}-cleartext"
+ after_value = f"new-{key}-cleartext"
+ set_instance_setting(key, before_value)
+ initial_count = self._instance_setting_logs().count()
+
+ response = self.client.patch(f"/api/instance_settings/{key}", {"value": after_value})
+ self.assertEqual(response.status_code, status.HTTP_200_OK, response.content)
+
+ logs = self._instance_setting_logs()
+ self.assertEqual(logs.count(), initial_count + 1)
+
+ log = logs.order_by("-created_at").first()
+ assert log is not None
+ change = log.detail["changes"][0]
+ self.assertEqual(change["before"], "<redacted>")
+ self.assertEqual(change["after"], "<redacted>")
+
+ raw_detail = json.dumps(log.detail)
+ self.assertNotIn(before_value, raw_detail)
+ self.assertNotIn(after_value, raw_detail)
+
+ @parameterized.expand([(key,) for key in SECRET_SETTINGS])
+ def test_every_secret_setting_is_redacted_on_retrieve(self, key: str):
+ # GET every declared secret. When set, the cleartext must never appear in the
+ # response — only the "*****" placeholder. Catches regressions where a future
+ # refactor of get_instance_setting drops the masking for one (or all) keys.
+ cleartext = f"cleartext-for-{key}"
+ with override_instance_config(key, cleartext):
+ response = self.client.get(f"/api/instance_settings/{key}")
+ self.assertEqual(response.status_code, status.HTTP_200_OK, response.content)
+ json_response = response.json()
+
+ self.assertEqual(json_response["key"], key)
+ self.assertTrue(json_response["is_secret"])
+ self.assertEqual(json_response["value"], "*****")
+ self.assertNotIn(cleartext, response.content.decode())
+
+ @parameterized.expand(
+ [
+ ("bool", "AUTO_START_ASYNC_MIGRATIONS", True),
+ ("int", "ASYNC_MIGRATIONS_ROLLBACK_TIMEOUT", 30),
+ ("string", "GITHUB_APP_SLUG", "posthog-app"),
+ ]
+ )
+ def test_no_op_update_does_not_log(self, _name: str, key: str, value: object):
+ set_instance_setting(key, value)
+ initial_count = self._instance_setting_logs().count()
+
+ response = self.client.patch(f"/api/instance_settings/{key}", {"value": value})
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+
+ self.assertEqual(self._instance_setting_logs().count(), initial_count)
+
+ def test_failed_update_does_not_log(self):
+ initial_count = self._instance_setting_logs().count()
+
+ response = self.client.patch(f"/api/instance_settings/MATERIALIZED_COLUMNS_ENABLED", {"value": False})
+ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
+
+ self.assertEqual(self._instance_setting_logs().count(), initial_count)
+
+ @patch("posthog.api.instance_settings.is_impersonated_session", return_value=True)
+ def test_update_logs_impersonation(self, _mock_is_impersonated):
+ response = self.client.patch(f"/api/instance_settings/AUTO_START_ASYNC_MIGRATIONS", {"value": True})
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+
+ log = self._instance_setting_logs().order_by("-created_at").first()
+ assert log is not None
+ self.assertTrue(log.was_impersonated)
+
+ def test_update_logs_with_first_organization_when_current_org_unset(self):
+ membership = self.user.organization_memberships.first()
+ assert membership is not None
+ membership_org_id = membership.organization_id
+ self._clear_user_org()
+ initial_count = self._instance_setting_logs().count()
+
+ response = self.client.patch(f"/api/instance_settings/AUTO_START_ASYNC_MIGRATIONS", {"value": True})
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+
+ logs = self._instance_setting_logs()
+ self.assertEqual(logs.count(), initial_count + 1)
+
+ log = logs.order_by("-created_at").first()
+ assert log is not None
+ self.assertEqual(log.organization_id, membership_org_id)
+
+ def test_update_with_no_organization_does_not_log(self):
+ self._clear_user_org()
+ self.user.organization_memberships.all().delete()
+ initial_count = self._instance_setting_logs().count()
+
+ response = self.client.patch(f"/api/instance_settings/AUTO_START_ASYNC_MIGRATIONS", {"value": True})
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
+
+ # The setting itself must still be persisted; only the audit row is skipped.
+ self.assertEqual(get_instance_setting("AUTO_START_ASYNC_MIGRATIONS"), True)
+ self.assertEqual(self._instance_setting_logs().count(), initial_count)
diff --git a/posthog/models/activity_logging/activity_log.py b/posthog/models/activity_logging/activity_log.py
index dc03c954699a..bcc2c73a765c 100644
--- a/posthog/models/activity_logging/activity_log.py
+++ b/posthog/models/activity_logging/activity_log.py
@@ -85,6 +85,7 @@ ActivityScope = Literal[
"LogsExclusionRule",
"ProductTour",
"Ticket",
+ "InstanceSetting",
]
ChangeAction = Literal[
"changed", "created", "deleted", "merged", "split", "exported", "revoked", "logged_in", "logged_out", "copied"
@@ -352,6 +353,14 @@ activity_visibility_restrictions: list[dict[str, Any]] = [
"exclude_when": {},
"allow_staff": True,
},
+ {
+ # Instance-setting changes are staff-only operations and must not leak into the
+ # org-scoped activity log endpoints, which are visible to organization admins.
+ "scope": "InstanceSetting",
+ "activities": ["updated"],
+ "exclude_when": {},
+ "allow_staff": True,
+ },
]
field_exclusions: dict[AuditableScope, list[str]] = {
diff --git a/posthog/test/activity_logging/test_activity_logging.py b/posthog/test/activity_logging/test_activity_logging.py
index 1e8b12dc7c74..e9657c2574b2 100644
--- a/posthog/test/activity_logging/test_activity_logging.py
+++ b/posthog/test/activity_logging/test_activity_logging.py
@@ -180,6 +180,8 @@ class TestActivityLogVisibilityManager(BaseTest):
("user_created", "User", "created", False, True),
# User activities not in the restricted list are not restricted
("user_changed_password", "User", "changed_password", False, False),
+ # InstanceSetting updates are staff-only and must be hidden from non-staff viewers
+ ("instance_setting_updated", "InstanceSetting", "updated", False, True),
# Non-User scopes are unaffected
("feature_flag_created", "FeatureFlag", "created", False, False),
("feature_flag_updated", "FeatureFlag", "updated", True, False),
@@ -207,6 +209,8 @@ class TestActivityLogVisibilityManager(BaseTest):
("normal_login_staff_bypass", "User", "logged_in", False, False),
("user_updated_staff_bypass", "User", "updated", False, False),
("user_created_staff_bypass", "User", "created", False, False),
+ # Staff can also see InstanceSetting updates (allow_staff=True)
+ ("instance_setting_updated_staff_bypass", "InstanceSetting", "updated", False, False),
# Non-User activities still not restricted for anyone
("feature_flag_created", "FeatureFlag", "created", False, False),
]
diff --git a/products/platform_features/frontend/generated/api.schemas.ts b/products/platform_features/frontend/generated/api.schemas.ts
index 56bd7c48fa4f..1d549bc7418e 100644
--- a/products/platform_features/frontend/generated/api.schemas.ts
+++ b/products/platform_features/frontend/generated/api.schemas.ts
@@ -922,6 +922,7 @@ export type ActivityLogListParams = {
* `LogsExclusionRule` - LogsExclusionRule
* `ProductTour` - ProductTour
* `Ticket` - Ticket
+* `InstanceSetting` - InstanceSetting
* @minLength 1
*/
scope?: ActivityLogListScope
@@ -997,6 +998,7 @@ export const ActivityLogListScope = {
LogsExclusionRule: 'LogsExclusionRule',
ProductTour: 'ProductTour',
Ticket: 'Ticket',
+ InstanceSetting: 'InstanceSetting',
} as const
/**
@@ -1059,6 +1061,7 @@ export const ActivityLogListScope = {
* `LogsExclusionRule` - LogsExclusionRule
* `ProductTour` - ProductTour
* `Ticket` - Ticket
+ * `InstanceSetting` - InstanceSetting
*/
export type ActivityLogListScopesItem = (typeof ActivityLogListScopesItem)[keyof typeof ActivityLogListScopesItem]
@@ -1122,6 +1125,7 @@ export const ActivityLogListScopesItem = {
LogsExclusionRule: 'LogsExclusionRule',
ProductTour: 'ProductTour',
Ticket: 'Ticket',
+ InstanceSetting: 'InstanceSetting',
} as const
export type AdvancedActivityLogsListParams = {
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 3796d833cda0..be213b30ac84 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -42584,6 +42584,7 @@ export namespace Schemas {
* `LogsExclusionRule` - LogsExclusionRule
* `ProductTour` - ProductTour
* `Ticket` - Ticket
+ * `InstanceSetting` - InstanceSetting
* @minLength 1
*/
scope?: ActivityLogListScope;
@@ -42660,6 +42661,7 @@ export namespace Schemas {
LogsExclusionRule: 'LogsExclusionRule',
ProductTour: 'ProductTour',
Ticket: 'Ticket',
+ InstanceSetting: 'InstanceSetting',
} as const;
/**
@@ -42722,6 +42724,7 @@ export namespace Schemas {
* `LogsExclusionRule` - LogsExclusionRule
* `ProductTour` - ProductTour
* `Ticket` - Ticket
+ * `InstanceSetting` - InstanceSetting
*/
export type ActivityLogListScopesItem = typeof ActivityLogListScopesItem[keyof typeof ActivityLogListScopesItem];
@@ -42786,6 +42789,7 @@ export namespace Schemas {
LogsExclusionRule: 'LogsExclusionRule',
ProductTour: 'ProductTour',
Ticket: 'Ticket',
+ InstanceSetting: 'InstanceSetting',
} as const;
export type AdvancedActivityLogsListParams = {
diff --git a/services/mcp/src/generated/platform_features/api.ts b/services/mcp/src/generated/platform_features/api.ts
index c7b165431484..cb736d3231d4 100644
--- a/services/mcp/src/generated/platform_features/api.ts
+++ b/services/mcp/src/generated/platform_features/api.ts
@@ -209,10 +209,11 @@ export const ActivityLogListQueryParams = /* @__PURE__ */ zod.object({
'LogsExclusionRule',
'ProductTour',
'Ticket',
+ 'InstanceSetting',
])
.optional()
.describe(
- 'Filter by a single activity scope, e.g. "FeatureFlag", "Insight", "Dashboard", "Experiment".\n\n* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `Evaluation` - Evaluation\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket'
+ 'Filter by a single activity scope, e.g. "FeatureFlag", "Insight", "Dashboard", "Experiment".\n\n* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `Evaluation` - Evaluation\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket\n* `InstanceSetting` - InstanceSetting'
),
scopes: zod
.array(
@@ -277,9 +278,10 @@ export const ActivityLogListQueryParams = /* @__PURE__ */ zod.object({
'LogsExclusionRule',
'ProductTour',
'Ticket',
+ 'InstanceSetting',
])
.describe(
- '* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `Evaluation` - Evaluation\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket'
+ '* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `Evaluation` - Evaluation\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket\n* `InstanceSetting` - InstanceSetting'
)
)
.optional()
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/activity-log-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/activity-log-list.json
index 02e9a73d8391..f6bdb1c99d80 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/activity-log-list.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/activity-log-list.json
@@ -19,7 +19,7 @@
"type": "number"
},
"scope": {
- "description": "Filter by a single activity scope, e.g. \"FeatureFlag\", \"Insight\", \"Dashboard\", \"Experiment\".\n\n* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `Evaluation` - Evaluation\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket",
+ "description": "Filter by a single activity scope, e.g. \"FeatureFlag\", \"Insight\", \"Dashboard\", \"Experiment\".\n\n* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `Evaluation` - Evaluation\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket\n* `InstanceSetting` - InstanceSetting",
"enum": [
"Cohort",
"FeatureFlag",
@@ -79,14 +79,15 @@
"LogsAlertConfiguration",
"LogsExclusionRule",
"ProductTour",
- "Ticket"
+ "Ticket",
+ "InstanceSetting"
],
"type": "string"
},
"scopes": {
"description": "Filter by multiple activity scopes, comma-separated. Values must be valid ActivityScope enum values. E.g. \"FeatureFlag,Insight\".",
"items": {
- "description": "* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `Evaluation` - Evaluation\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket",
+ "description": "* `Cohort` - Cohort\n* `FeatureFlag` - FeatureFlag\n* `Person` - Person\n* `Group` - Group\n* `Insight` - Insight\n* `Plugin` - Plugin\n* `PluginConfig` - PluginConfig\n* `HogFunction` - HogFunction\n* `HogFlow` - HogFlow\n* `DataManagement` - DataManagement\n* `EventDefinition` - EventDefinition\n* `PropertyDefinition` - PropertyDefinition\n* `Notebook` - Notebook\n* `Endpoint` - Endpoint\n* `EndpointVersion` - EndpointVersion\n* `Dashboard` - Dashboard\n* `Replay` - Replay\n* `Experiment` - Experiment\n* `ExperimentHoldout` - ExperimentHoldout\n* `ExperimentSavedMetric` - ExperimentSavedMetric\n* `Survey` - Survey\n* `EarlyAccessFeature` - EarlyAccessFeature\n* `SessionRecordingPlaylist` - SessionRecordingPlaylist\n* `Comment` - Comment\n* `Team` - Team\n* `Project` - Project\n* `ErrorTrackingIssue` - ErrorTrackingIssue\n* `DataWarehouseSavedQuery` - DataWarehouseSavedQuery\n* `LegalDocument` - LegalDocument\n* `Organization` - Organization\n* `OrganizationDomain` - OrganizationDomain\n* `OrganizationMembership` - OrganizationMembership\n* `Role` - Role\n* `UserGroup` - UserGroup\n* `BatchExport` - BatchExport\n* `BatchImport` - BatchImport\n* `Integration` - Integration\n* `Annotation` - Annotation\n* `Tag` - Tag\n* `TaggedItem` - TaggedItem\n* `Subscription` - Subscription\n* `PersonalAPIKey` - PersonalAPIKey\n* `ProjectSecretAPIKey` - ProjectSecretAPIKey\n* `User` - User\n* `Action` - Action\n* `AlertConfiguration` - AlertConfiguration\n* `Threshold` - Threshold\n* `AlertSubscription` - AlertSubscription\n* `ExternalDataSource` - ExternalDataSource\n* `ExternalDataSchema` - ExternalDataSchema\n* `Evaluation` - Evaluation\n* `LLMTrace` - LLMTrace\n* `WebAnalyticsFilterPreset` - WebAnalyticsFilterPreset\n* `CustomerProfileConfig` - CustomerProfileConfig\n* `Log` - Log\n* `LogsAlertConfiguration` - LogsAlertConfiguration\n* `LogsExclusionRule` - LogsExclusionRule\n* `ProductTour` - ProductTour\n* `Ticket` - Ticket\n* `InstanceSetting` - InstanceSetting",
"enum": [
"Cohort",
"FeatureFlag",
@@ -146,7 +147,8 @@
"LogsAlertConfiguration",
"LogsExclusionRule",
"ProductTour",
- "Ticket"
+ "Ticket",
+ "InstanceSetting"
],
"type": "string"
},