: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(activity-log): show the credential behind each change (#127888)
Tom Piccirelloc6ab8ea4fa2b
diff --git a/docs/internal/activity-logging.md b/docs/internal/activity-logging.mdindex 0008dee17ca2..c40311e6045a 100644--- a/docs/internal/activity-logging.md+++ b/docs/internal/activity-logging.md@@ -261,7 +261,9 @@ Unlike `client`, they are evidence of which credential made a change.- A credential without a user clears any user the middleware took from a session cookie. The row has `user=None` and `is_system=True`, and it keeps the credential.- `impersonated_by_id` holds the staff user behind an impersonated session or an OAuth token minted during impersonation.- The fields are null outside a request. A row written inside a request that recorded no credential has `credential_type` `unattributed`: the request was anonymous, or its authentication class records nothing.-- The fields are internal. The advanced activity log serializer and the notifications serializer list their fields explicitly and leave them out. The advanced serializer also builds `$activity_log_entry_created` for customer destinations.+- Customers can read `credential_type` and some ids. `ActivityLogSerializer` in `posthog/api/advanced_activity_logs/viewset.py` serves the `activity_log` and `advanced_activity_logs` endpoints. It returns `credential_type`, and `credential_id` only for the types in `CUSTOMER_VISIBLE_CREDENTIAL_ID_TYPES` (`session`, `personal_api_key`, `project_secret_key`). It returns null for every other type and for impersonated rows, whose session belongs to the staff user. `ActivityLog.customer_visible_credential_id` applies that rule. The advanced serializer also builds `$activity_log_entry_created` for customer destinations. The CSV export serializer (`ActivityLogFlatExportSerializer`) carries the same two values in its last columns. The OCSF schema puts `credential_type` under `unmapped`, a session id in `actor.session.uid`, and a key id in `actor.session.credential_uid`.+- `impersonated_by_id` is internal everywhere. The notifications serializer leaves out all three fields.+- `system.activity_logs` has `credential_type` and no `credential_id`. A query can select a hidden column by name, so a hidden raw column cannot keep the other ids out.- Every authentication class inherits `ActivityCredentialMixin` and sets `activity_credential_type`. A class that defines its own `authenticate` sets it again, even when the parent's value is correct. `posthog/test/repo_invariants/test_authentication_credential_types.py` enforces both rules.- The class calls `self.record_activity_actor(user, credential_id)` after every check of the credential passed, and the type comes from the declaration. `SessionAuthentication` is the exception, because the middleware records the session. A class that declares a type but never calls the recorder writes `unattributed` rows.- A partner OAuth class declares `oauth` and passes the token's application id and `impersonated_by_id` to the recorder, as the main OAuth path does, so its rows read the same.diff --git a/frontend/src/lib/components/ActivityLog/humanizeActivity.tsx b/frontend/src/lib/components/ActivityLog/humanizeActivity.tsxindex fa71a0eeb85b..39facfd2dda8 100644--- a/frontend/src/lib/components/ActivityLog/humanizeActivity.tsx+++ b/frontend/src/lib/components/ActivityLog/humanizeActivity.tsx@@ -5,6 +5,8 @@ import { fullName } from 'lib/utils/strings'import { ActivityScope, InsightShortId, PersonType, UserBasicType } from '~/types'+import type { ActivityLogCredentialTypeEnumApi } from 'products/platform_features/frontend/generated/api.schemas'+export interface ActivityChange {type: ActivityScopeaction: 'changed' | 'created' | 'deleted' | 'exported' | 'split' | 'merged' | 'copied'@@ -58,6 +60,10 @@ export type ActivityLogItem = {client?: string | null/** Client IP address captured at request time. Null for non-HTTP activity (system, background jobs). */ip_address?: string | null+ /** Kind of credential that authenticated the request that made the change. Null outside a request and for older entries. */+ credential_type?: ActivityLogCredentialTypeEnumApi | null+ /** Login session id or key id of that credential. Both activity log endpoints return it, only for some credential types. */+ credential_id?: string | null}// the description of a single activity log is a sentence describing one or more changes that makes up the entrydiff --git a/frontend/src/scenes/audit-logs/AuditLogTable.tsx b/frontend/src/scenes/audit-logs/AuditLogTable.tsxindex c21b0818d273..a17d8ee75536 100644--- a/frontend/src/scenes/audit-logs/AuditLogTable.tsx+++ b/frontend/src/scenes/audit-logs/AuditLogTable.tsx@@ -16,6 +16,7 @@ import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'import { Tooltip } from 'lib/lemon-ui/Tooltip'import { urls } from 'scenes/urls'+import { credentialTypeLabel } from './credentialTypeLabel'import { sandboxChange } from './sandboxChange'export interface AuditLogTableProps {@@ -94,6 +95,19 @@ const baseColumns: LemonTableColumns<HumanizedActivityLogItem> = [render: (_, logItem) => <TZLabel time={logItem.created_at} />,width: '15%',},+ {+ title: 'Credential',+ key: 'credential_type',+ render: (_, logItem) => {+ const credentialType = logItem.unprocessed?.credential_type+ return credentialType ? (+ <span className="whitespace-nowrap">{credentialTypeLabel(credentialType)}</span>+ ) : (+ <span className="text-muted">—</span>+ )+ },+ width: '10%',+ },{title: 'IP address',key: 'ip_address',@@ -221,6 +235,14 @@ function ExpandedRowContent({ logItem }: { logItem: HumanizedActivityLogItem }):<div className="text-[13px] text-default">{unprocessed.item_id}</div></div>)}+ {unprocessed.credential_id && (+ <div>+ <div className="text-[11px] font-medium text-muted-alt uppercase tracking-wider mb-1">+ Credential ID+ </div>+ <div className="text-[13px] text-default font-mono">{unprocessed.credential_id}</div>+ </div>+ )}{agent?.intent && (<div><Tooltip title={AGENT_INTENT_TOOLTIP}>diff --git a/frontend/src/scenes/audit-logs/credentialTypeLabel.ts b/frontend/src/scenes/audit-logs/credentialTypeLabel.tsnew file mode 100644index 000000000000..9d1f46de2c29--- /dev/null+++ b/frontend/src/scenes/audit-logs/credentialTypeLabel.ts@@ -0,0 +1,32 @@+import { identifierToHuman } from 'lib/utils/strings'++import type { ActivityLogCredentialTypeEnumApi } from 'products/platform_features/frontend/generated/api.schemas'++const CREDENTIAL_TYPE_LABELS: Record<ActivityLogCredentialTypeEnumApi, string> = {+ session: 'Session',+ personal_api_key: 'Personal API key',+ oauth: 'OAuth app',+ project_secret_key: 'Project secret API key',+ team_secret_token: 'Legacy secret key',+ id_jag: 'Cross-app access (XAA)',+ scim: 'SCIM',+ vercel: 'Vercel',+ partner: 'Partner app',+ sharing_access_token: 'Shared link',+ sharing_password: 'Shared link password',+ widget_token: 'Widget token',+ gateway_agent: 'MCP gateway agent',+ export_renderer: 'Export',+ webhook: 'Webhook',+ internal_jwt: 'PostHog service',+ service_jwt: 'PostHog service',+ internal_api_secret: 'PostHog service',+ cross_region_signature: 'PostHog service',+ billing_service: 'PostHog billing',+ unattributed: 'Unknown',+}++export function credentialTypeLabel(credentialType: ActivityLogCredentialTypeEnumApi): string {+ // A cached frontend bundle can receive a type that a newer backend added after the bundle was built.+ return CREDENTIAL_TYPE_LABELS[credentialType] ?? identifierToHuman(credentialType)+}diff --git a/posthog/api/advanced_activity_logs/ocsf.py b/posthog/api/advanced_activity_logs/ocsf.pyindex 0a07400d1519..f477246a7c2f 100644--- a/posthog/api/advanced_activity_logs/ocsf.py+++ b/posthog/api/advanced_activity_logs/ocsf.py@@ -121,6 +121,7 @@ class ActivityLogOCSFSerializer(serializers.ModelSerializer):"organization_id": str(instance.organization_id) if instance.organization_id else None,"was_impersonated": instance.was_impersonated,"is_system": instance.is_system,+ "credential_type": instance.credential_type,},}@@ -141,6 +142,13 @@ class ActivityLogOCSFSerializer(serializers.ModelSerializer):# what the client tag holds: either the self-reported x-posthog-client header, or the# scout the server named from the authenticated run.actor["app_name"] = instance.client+ credential_id = instance.customer_visible_credential_id+ if credential_id:+ # A key-authenticated request has no session of its own. OCSF carries such a key in+ # `credential_uid`, the attribute its own example fills with an AWS access key id.+ actor["session"] = (+ {"uid": credential_id} if instance.credential_type == "session" else {"credential_uid": credential_id}+ )if actor:event["actor"] = actordiff --git a/posthog/api/advanced_activity_logs/test_ocsf.py b/posthog/api/advanced_activity_logs/test_ocsf.pyindex 6e594baf6c8b..758960effed7 100644--- a/posthog/api/advanced_activity_logs/test_ocsf.py+++ b/posthog/api/advanced_activity_logs/test_ocsf.py@@ -1,4 +1,4 @@-from typing import Optional+from typing import Any, Optionalfrom posthog.test.base import APIBaseTest@@ -9,17 +9,20 @@ from posthog.models.activity_logging.activity_log import ActivityLog, Change, Declass TestActivityLogOCSF(APIBaseTest):- def _log(self, activity: str = "updated", detail: Optional[Detail] = None) -> ActivityLog:+ def _log(self, activity: str = "updated", detail: Optional[Detail] = None, **overrides: Any) -> ActivityLog:log = ActivityLog.objects.create(- team_id=self.team.id,- organization_id=self.organization.id,- scope="FeatureFlag",- activity=activity,- item_id="flag-1",- user=self.user,- ip_address="203.0.113.4",- client="posthog-python",- detail=detail,+ **{+ "team_id": self.team.id,+ "organization_id": self.organization.id,+ "scope": "FeatureFlag",+ "activity": activity,+ "item_id": "flag-1",+ "user": self.user,+ "ip_address": "203.0.113.4",+ "client": "posthog-python",+ "detail": detail,+ **overrides,+ })# Read it back so `detail` is the JSON dict the list endpoint serializes, not the dataclass# the freshly built instance holds.@@ -82,6 +85,30 @@ class TestActivityLogOCSF(APIBaseTest):assert event["actor"]["app_name"] == "posthog-python"assert "client" not in event["unmapped"]+ @parameterized.expand(+ [+ (+ "session",+ {"credential_type": "session", "credential_id": "session-public-id"},+ {"uid": "session-public-id"},+ ),+ (+ "project_secret_key_without_user",+ {"credential_type": "project_secret_key", "credential_id": "key-id", "user": None, "client": None},+ {"credential_uid": "key-id"},+ ),+ ("oauth_id_stays_hidden", {"credential_type": "oauth", "credential_id": "application-id"}, None),+ ]+ )+ def test_customer_visible_credential_is_the_actor_session(+ self, _name: str, overrides: dict[str, Any], expected_session: Optional[dict[str, str]]+ ):+ event = ActivityLogOCSFSerializer(self._log(**overrides)).data++ assert event["actor"].get("session") == expected_session+ assert event["unmapped"]["credential_type"] == overrides["credential_type"]+ assert "credential_id" not in event["unmapped"]+def test_time_is_epoch_milliseconds_and_time_dt_is_rfc3339(self):log = self._log()diff --git a/posthog/api/advanced_activity_logs/viewset.py b/posthog/api/advanced_activity_logs/viewset.pyindex 9f4548126f14..2994c93edced 100644--- a/posthog/api/advanced_activity_logs/viewset.py+++ b/posthog/api/advanced_activity_logs/viewset.py@@ -28,6 +28,7 @@ from posthog.models.activity_logging.activity_log import (apply_activity_visibility_restrictions,)from posthog.models.activity_logging.retention import get_activity_log_lookback_restriction+from posthog.models.activity_logging.utils import CREDENTIAL_TYPE_CHOICESfrom posthog.models.organization import Organization, OrganizationMembershipfrom posthog.models.user import Userfrom posthog.permissions import PremiumFeaturePermission@@ -108,15 +109,45 @@ def apply_organization_scoped_filter(return queryset.filter(team_id=team_id)+def credential_type_field() -> serializers.ChoiceField:+ return serializers.ChoiceField(+ choices=CREDENTIAL_TYPE_CHOICES,+ read_only=True,+ allow_null=True,+ help_text=(+ "Kind of credential that authenticated the request that made the change. 'unattributed' means "+ "the request recorded no credential. Null for changes made outside a request, such as "+ "background jobs, and for entries recorded before PostHog stored the credential."+ ),+ )+++def credential_id_field() -> serializers.CharField:+ """The raw `credential_id` column also holds internal ids, so customer-facing serializers read+ `customer_visible_credential_id` through this field and never declare the column itself."""+ return serializers.CharField(+ source="customer_visible_credential_id",+ read_only=True,+ allow_null=True,+ help_text=(+ "Id of the credential that authenticated the change: the login session id for 'session', or "+ "the key id for 'personal_api_key' and 'project_secret_key'. Null for every other credential "+ "type and for impersonated changes."+ ),+ )++class ActivityLogSerializer(serializers.ModelSerializer):user = UserBasicSerializer()unread = serializers.SerializerMethodField()+ credential_type = credential_type_field()+ credential_id = credential_id_field()class Meta:model = ActivityLog- # An explicit list, so that a new internal column such as `credential_id` stays out. This+ # An explicit list, so that a new internal column such as `impersonated_by_id` stays out. This# serializer also builds the `$activity_log_entry_created` event, so a field listed here- # reaches the advanced API, the export and customer destinations at the same time.+ # reaches the activity log API, the advanced API and customer destinations at the same time.fields = ["id","user",@@ -127,6 +158,8 @@ class ActivityLogSerializer(serializers.ModelSerializer):"is_system","client","ip_address",+ "credential_type",+ "credential_id","activity","item_id","scope",@@ -505,9 +538,13 @@ class ActivityLogFlatExportSerializer(serializers.ModelSerializer):user_last_name = serializers.CharField(source="user.last_name", default="")user_email = serializers.CharField(source="user.email", default="")detail = serializers.SerializerMethodField()+ credential_type = credential_type_field()+ credential_id = credential_id_field()class Meta:model = ActivityLog+ # The export writes columns in this order, and readers of the file can rely on position, so a+ # new field goes at the end.fields = ["id","organization_id",@@ -522,6 +559,8 @@ class ActivityLogFlatExportSerializer(serializers.ModelSerializer):"client","ip_address","created_at",+ "credential_type",+ "credential_id",]def get_detail(self, obj):diff --git a/posthog/api/test/test_activity_log.py b/posthog/api/test/test_activity_log.pyindex 4daa8a753ff1..1b123be1cd97 100644--- a/posthog/api/test/test_activity_log.py+++ b/posthog/api/test/test_activity_log.py@@ -295,6 +295,40 @@ class TestActivityLogAuditLogsGate(APIBaseTest):entry.refresh_from_db()assert entry.detail == detail+ @parameterized.expand(+ [+ ("activity_log/",),+ ("advanced_activity_logs/",),+ ("advanced_activity_logs/?is_csv_export=1",),+ ("advanced_activity_logs/?schema=ocsf",),+ ]+ )+ def test_only_allowlisted_credential_ids_reach_the_endpoint(self, endpoint: str) -> None:+ for credential_type, credential_id, impersonated_by_id in (+ ("personal_api_key", "example-key-id", None),+ ("service_jwt", "example-internal-audience", 424242),+ ):+ ActivityLog.objects.create(+ team_id=self.team.id,+ organization_id=self.organization.id,+ user=self.user,+ scope="Experiment",+ activity="created",+ credential_type=credential_type,+ credential_id=credential_id,+ impersonated_by_id=impersonated_by_id,+ )++ response = self.client.get(f"/api/projects/{self.team.id}/{endpoint}")++ assert response.status_code == status.HTTP_200_OK, response.content+ body = response.content.decode()+ assert "personal_api_key" in body+ assert "example-key-id" in body+ assert "example-internal-audience" not in body+ assert "impersonated_by_id" not in body+ assert "424242" not in body+@parameterized.expand([("activity_log",), ("advanced_activity_logs",)])def test_endpoint_blocked_on_cloud_without_audit_logs_feature(self, endpoint: str) -> None:self.organization.available_product_features = []@@ -751,8 +785,7 @@ class TestAdvancedActivityLogExportPath(APIBaseTest):class TestActivityLogSerializerFields(SimpleTestCase):- @parameterized.expand([("advanced", ActivityLogSerializer), ("my_notifications", MyNotificationsSerializer)])- def test_credential_fields_are_not_serialized(self, _name: str, serializer_class: type) -> None:+ def test_credential_fields_are_not_serialized_in_notifications(self) -> None:log = ActivityLog(scope="Experiment",activity="created",@@ -761,6 +794,39 @@ class TestActivityLogSerializerFields(SimpleTestCase):impersonated_by_id=1,)- data = serializer_class(log).data+ data = MyNotificationsSerializer(log).dataassert {"credential_type", "credential_id", "impersonated_by_id"}.isdisjoint(data)++ @parameterized.expand(+ [+ ("session", "session", "session-public-id", False, None, "session-public-id"),+ ("personal_api_key", "personal_api_key", "key-id", False, None, "key-id"),+ ("project_secret_key", "project_secret_key", "key-id", False, None, "key-id"),+ ("oauth_hides_the_application", "oauth", "application-id", False, None, None),+ ("service_jwt_hides_the_audience", "service_jwt", "internal-service", False, None, None),+ ("impersonated_session_hides_the_staff_session", "session", "session-public-id", True, 1, None),+ ]+ )+ def test_advanced_serializer_shows_credential_id_only_for_allowlisted_types(+ self,+ _name: str,+ credential_type: str,+ credential_id: str,+ was_impersonated: bool,+ impersonated_by_id: Optional[int],+ expected_credential_id: Optional[str],+ ) -> None:+ log = ActivityLog(+ scope="Experiment",+ activity="created",+ was_impersonated=was_impersonated,+ credential_type=credential_type,+ credential_id=credential_id,+ impersonated_by_id=impersonated_by_id,+ )++ data = ActivityLogSerializer(log).data++ assert (data["credential_type"], data["credential_id"]) == (credential_type, expected_credential_id)+ assert "impersonated_by_id" not in datadiff --git a/posthog/hogql/database/schema/system.py b/posthog/hogql/database/schema/system.pyindex 9d4c5b1434ab..2ff004bcd5cb 100644--- a/posthog/hogql/database/schema/system.py+++ b/posthog/hogql/database/schema/system.py@@ -1752,6 +1752,18 @@ activity_logs: _ActivityLogsTable = _ActivityLogsTable("detail": StringJSONDatabaseField(name="detail", description="JSON detail of what changed (field-level diffs, context)."),+ # Never declare `credential_id`, even as hidden: a query can select a hidden column by name,+ # and the advanced API shows the id only for some credential types.+ "credential_type": StringDatabaseField(+ name="credential_type",+ nullable=True,+ description=(+ "Kind of credential that authenticated the request that made the change, e.g. 'session', "+ "'personal_api_key', 'oauth'. 'unattributed' means the request recorded no credential. Null for "+ "changes made outside a request, such as background jobs, and for entries recorded before the "+ "credential was stored."+ ),+ ),"created_at": DateTimeDatabaseField(name="created_at", description="When the activity occurred."),},)diff --git a/posthog/hogql/database/schema/test/test_system_tables.py b/posthog/hogql/database/schema/test/test_system_tables.pyindex b3fe8e0c95c1..d1872ba607ec 100644--- a/posthog/hogql/database/schema/test/test_system_tables.py+++ b/posthog/hogql/database/schema/test/test_system_tables.py@@ -238,6 +238,8 @@ class TestSystemTablesTeamScoping(BaseTest):("inbox_report_checks", "config"),("inbox_report_artefacts", "content"),("inbox_report_actions", "metadata"),+ ("activity_logs", "credential_id"),+ ("activity_logs", "impersonated_by_id"),])def test_viewer_restricted_fields_are_not_queryable(self, table_name, field_name):diff --git a/posthog/hogql/database/test/__snapshots__/test_database.ambr b/posthog/hogql/database/test/__snapshots__/test_database.ambrindex 7d80b3d4bc6c..a342591aee6d 100644--- a/posthog/hogql/database/test/__snapshots__/test_database.ambr+++ b/posthog/hogql/database/test/__snapshots__/test_database.ambr@@ -3158,6 +3158,16 @@"table": null,"type": "json"},+ "credential_type": {+ "chain": null,+ "fields": null,+ "hogql_value": "credential_type",+ "id": null,+ "name": "credential_type",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },"created_at": {"chain": null,"fields": null,@@ -18030,6 +18040,16 @@"table": null,"type": "json"},+ "credential_type": {+ "chain": null,+ "fields": null,+ "hogql_value": "credential_type",+ "id": null,+ "name": "credential_type",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },"created_at": {"chain": null,"fields": null,diff --git a/posthog/models/activity_logging/activity_log.py b/posthog/models/activity_logging/activity_log.pyindex 610a655c2a08..d94c6333a835 100644--- a/posthog/models/activity_logging/activity_log.py+++ b/posthog/models/activity_logging/activity_log.py@@ -25,6 +25,7 @@ from posthog.exceptions_capture import capture_exceptionfrom posthog.models.activity_logging.utils import (ACTIVITY_LOG_CLIENT_MAX_LENGTH,ACTIVITY_LOG_CREDENTIAL_ID_MAX_LENGTH,+ CUSTOMER_VISIBLE_CREDENTIAL_ID_TYPES,ActivityCredential,activity_storage,is_uncached_reverse_one_to_one,@@ -325,6 +326,17 @@ class ActivityLog(UUIDTModel):changes.append(change)return {**self.detail, "changes": changes}+ @property+ def customer_visible_credential_id(self) -> Optional[str]:+ """The `credential_id` that customer-facing surfaces may show, or None when it stays internal."""+ if self.credential_type not in CUSTOMER_VISIBLE_CREDENTIAL_ID_TYPES:+ return None+ # An impersonated change used the staff member's login session. That session is in no list+ # the customer can read, so its id would point nowhere.+ if self.was_impersonated or self.impersonated_by_id is not None:+ return None+ return self.credential_id+# Fields older rows still hold in plaintext although new rows no longer record them.read_masked_fields: dict[str, list[str]] = {diff --git a/posthog/models/activity_logging/utils.py b/posthog/models/activity_logging/utils.pyindex 1e2efbed18b6..b975855c5450 100644--- a/posthog/models/activity_logging/utils.py+++ b/posthog/models/activity_logging/utils.py@@ -1,6 +1,6 @@import tracebackfrom collections.abc import Callable-from typing import TYPE_CHECKING, Any, ClassVar, Literal, Optional, cast+from typing import TYPE_CHECKING, Any, ClassVar, Literal, Optional, cast, get_argsfrom django.db import modelsfrom django.db.models import Q, QuerySet@@ -62,6 +62,13 @@ DeclaredCredentialType = Literal[# `log_activity` writes `unattributed` for a row in a request where no authentication class recorded# a credential, so no class may declare it.CredentialType = Literal[DeclaredCredentialType, "unattributed"]+CREDENTIAL_TYPE_CHOICES: tuple[CredentialType, ...] = get_args(CredentialType)+# The credential types whose `credential_id` customers can read. Each id names a login session or a+# key that the customer can look up and revoke through the PostHog API. Never add `service_jwt`: its+# id is the audience of an internal PostHog service.+CUSTOMER_VISIBLE_CREDENTIAL_ID_TYPES: frozenset[CredentialType] = frozenset(+ {"session", "personal_api_key", "project_secret_key"}+)# Sized for an ID-JAG `client_id`, the longest value: the identity provider config accepts client# ids up to 256 characters. Key ids, OAuth application UUIDs and session public ids are much shorter.ACTIVITY_LOG_CREDENTIAL_ID_MAX_LENGTH = 256diff --git a/posthog/settings/web.py b/posthog/settings/web.pyindex 5ad1a22cff75..2f7686dcbf7a 100644--- a/posthog/settings/web.py+++ b/posthog/settings/web.py@@ -716,6 +716,9 @@ SPECTACULAR_SETTINGS = {"ResolvedAccessSourceEnum": "products.access_control.backend.facade.enums.RESOLVED_ACCESS_SOURCE_CHOICES","ResolvedAccessSourceSubjectEnum": "products.access_control.backend.facade.enums.RESOLVED_ACCESS_SOURCE_SUBJECT_CHOICES","RuleResourceEnum": "products.access_control.backend.facade.user_access_control.RULE_RESOURCE_CHOICES",+ # Authentication classes declare their activity log credential type as a CredentialType+ # literal, so no Choices class carries the set. The list is derived from that literal.+ "ActivityLogCredentialTypeEnum": "posthog.models.activity_logging.utils.CREDENTIAL_TYPE_CHOICES",# Every grantable scope object, from posthog/scopes.py. The frontend's APIScopeObject type# derives from this enum, so the object list is never copied by hand."ScopeObjectEnum": "products.access_control.backend.facade.enums.SCOPE_OBJECT_CHOICES",diff --git a/products/platform_features/frontend/generated/api.schemas.ts b/products/platform_features/frontend/generated/api.schemas.tsindex d89765ce4005..6974740e3d57 100644--- a/products/platform_features/frontend/generated/api.schemas.ts+++ b/products/platform_features/frontend/generated/api.schemas.ts@@ -894,6 +894,56 @@ export interface WelcomeResponseApi {is_organization_first_user: boolean}+/**+ * * `session` - session+ * * `personal_api_key` - personal_api_key+ * * `oauth` - oauth+ * * `project_secret_key` - project_secret_key+ * * `team_secret_token` - team_secret_token+ * * `id_jag` - id_jag+ * * `internal_jwt` - internal_jwt+ * * `service_jwt` - service_jwt+ * * `internal_api_secret` - internal_api_secret+ * * `scim` - scim+ * * `vercel` - vercel+ * * `partner` - partner+ * * `sharing_access_token` - sharing_access_token+ * * `sharing_password` - sharing_password+ * * `widget_token` - widget_token+ * * `billing_service` - billing_service+ * * `gateway_agent` - gateway_agent+ * * `export_renderer` - export_renderer+ * * `webhook` - webhook+ * * `cross_region_signature` - cross_region_signature+ * * `unattributed` - unattributed+ */+export type ActivityLogCredentialTypeEnumApi =+ (typeof ActivityLogCredentialTypeEnumApi)[keyof typeof ActivityLogCredentialTypeEnumApi]++export const ActivityLogCredentialTypeEnumApi = {+ Session: 'session',+ PersonalApiKey: 'personal_api_key',+ Oauth: 'oauth',+ ProjectSecretKey: 'project_secret_key',+ TeamSecretToken: 'team_secret_token',+ IdJag: 'id_jag',+ InternalJwt: 'internal_jwt',+ ServiceJwt: 'service_jwt',+ InternalApiSecret: 'internal_api_secret',+ Scim: 'scim',+ Vercel: 'vercel',+ Partner: 'partner',+ SharingAccessToken: 'sharing_access_token',+ SharingPassword: 'sharing_password',+ WidgetToken: 'widget_token',+ BillingService: 'billing_service',+ GatewayAgent: 'gateway_agent',+ ExportRenderer: 'export_renderer',+ Webhook: 'webhook',+ CrossRegionSignature: 'cross_region_signature',+ Unattributed: 'unattributed',+} as const+export interface ActivityLogApi {readonly id: stringuser: UserBasicApi@@ -918,6 +968,35 @@ export interface ActivityLogApi {client?: string | null/** @nullable */ip_address?: string | null+ /** Kind of credential that authenticated the request that made the change. 'unattributed' means the request recorded no credential. Null for changes made outside a request, such as background jobs, and for entries recorded before PostHog stored the credential.+ *+ * * `session` - session+ * * `personal_api_key` - personal_api_key+ * * `oauth` - oauth+ * * `project_secret_key` - project_secret_key+ * * `team_secret_token` - team_secret_token+ * * `id_jag` - id_jag+ * * `internal_jwt` - internal_jwt+ * * `service_jwt` - service_jwt+ * * `internal_api_secret` - internal_api_secret+ * * `scim` - scim+ * * `vercel` - vercel+ * * `partner` - partner+ * * `sharing_access_token` - sharing_access_token+ * * `sharing_password` - sharing_password+ * * `widget_token` - widget_token+ * * `billing_service` - billing_service+ * * `gateway_agent` - gateway_agent+ * * `export_renderer` - export_renderer+ * * `webhook` - webhook+ * * `cross_region_signature` - cross_region_signature+ * * `unattributed` - unattributed */+ readonly credential_type: ActivityLogCredentialTypeEnumApi | null+ /**+ * Id of the credential that authenticated the change: the login session id for 'session', or the key id for 'personal_api_key' and 'project_secret_key'. Null for every other credential type and for impersonated changes.+ * @nullable+ */+ readonly credential_id: string | null/** @maxLength 79 */activity: string/**diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex db6eda21e421..c73208d04f53 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -5552,6 +5552,56 @@ export namespace Schemas {Created: 'created',} as const;+ /**+ * * `session` - session+ * * `personal_api_key` - personal_api_key+ * * `oauth` - oauth+ * * `project_secret_key` - project_secret_key+ * * `team_secret_token` - team_secret_token+ * * `id_jag` - id_jag+ * * `internal_jwt` - internal_jwt+ * * `service_jwt` - service_jwt+ * * `internal_api_secret` - internal_api_secret+ * * `scim` - scim+ * * `vercel` - vercel+ * * `partner` - partner+ * * `sharing_access_token` - sharing_access_token+ * * `sharing_password` - sharing_password+ * * `widget_token` - widget_token+ * * `billing_service` - billing_service+ * * `gateway_agent` - gateway_agent+ * * `export_renderer` - export_renderer+ * * `webhook` - webhook+ * * `cross_region_signature` - cross_region_signature+ * * `unattributed` - unattributed+ */+ export type ActivityLogCredentialTypeEnum = typeof ActivityLogCredentialTypeEnum[keyof typeof ActivityLogCredentialTypeEnum];+++ export const ActivityLogCredentialTypeEnum = {+ Session: 'session',+ PersonalApiKey: 'personal_api_key',+ Oauth: 'oauth',+ ProjectSecretKey: 'project_secret_key',+ TeamSecretToken: 'team_secret_token',+ IdJag: 'id_jag',+ InternalJwt: 'internal_jwt',+ ServiceJwt: 'service_jwt',+ InternalApiSecret: 'internal_api_secret',+ Scim: 'scim',+ Vercel: 'vercel',+ Partner: 'partner',+ SharingAccessToken: 'sharing_access_token',+ SharingPassword: 'sharing_password',+ WidgetToken: 'widget_token',+ BillingService: 'billing_service',+ GatewayAgent: 'gateway_agent',+ ExportRenderer: 'export_renderer',+ Webhook: 'webhook',+ CrossRegionSignature: 'cross_region_signature',+ Unattributed: 'unattributed',+ } as const;+export interface ActivityLog {readonly id: string;user: UserBasic;@@ -5576,6 +5626,35 @@ export namespace Schemas {client?: string | null;/** @nullable */ip_address?: string | null;+ /** Kind of credential that authenticated the request that made the change. 'unattributed' means the request recorded no credential. Null for changes made outside a request, such as background jobs, and for entries recorded before PostHog stored the credential.+ *+ * * `session` - session+ * * `personal_api_key` - personal_api_key+ * * `oauth` - oauth+ * * `project_secret_key` - project_secret_key+ * * `team_secret_token` - team_secret_token+ * * `id_jag` - id_jag+ * * `internal_jwt` - internal_jwt+ * * `service_jwt` - service_jwt+ * * `internal_api_secret` - internal_api_secret+ * * `scim` - scim+ * * `vercel` - vercel+ * * `partner` - partner+ * * `sharing_access_token` - sharing_access_token+ * * `sharing_password` - sharing_password+ * * `widget_token` - widget_token+ * * `billing_service` - billing_service+ * * `gateway_agent` - gateway_agent+ * * `export_renderer` - export_renderer+ * * `webhook` - webhook+ * * `cross_region_signature` - cross_region_signature+ * * `unattributed` - unattributed */+ readonly credential_type: ActivityLogCredentialTypeEnum | null;+ /**+ * Id of the credential that authenticated the change: the login session id for 'session', or the key id for 'personal_api_key' and 'project_secret_key'. Null for every other credential type and for impersonated changes.+ * @nullable+ */+ readonly credential_id: string | null;/** @maxLength 79 */activity: string;/**