: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(workflows): add encrypted inputs columns to hog flow (#73147)
Harley Alexander00e12a3a2726
diff --git a/products/workflows/backend/migrations/0012_hogflow_encrypted_inputs.py b/products/workflows/backend/migrations/0012_hogflow_encrypted_inputs.pynew file mode 100644index 000000000000..46df6c0177c9--- /dev/null+++ b/products/workflows/backend/migrations/0012_hogflow_encrypted_inputs.py@@ -0,0 +1,24 @@+# Generated by Django 5.2.14 on 2026-07-22 12:31++from django.db import migrations++import posthog.helpers.encrypted_fields+++class Migration(migrations.Migration):+ dependencies = [+ ("workflows", "0011_hogflowrevision"),+ ]++ operations = [+ migrations.AddField(+ model_name="hogflow",+ name="draft_encrypted_inputs",+ field=posthog.helpers.encrypted_fields.EncryptedJSONStringField(blank=True, null=True),+ ),+ migrations.AddField(+ model_name="hogflow",+ name="encrypted_inputs",+ field=posthog.helpers.encrypted_fields.EncryptedJSONStringField(blank=True, null=True),+ ),+ ]diff --git a/products/workflows/backend/migrations/max_migration.txt b/products/workflows/backend/migrations/max_migration.txtindex e3bbda0289dd..693a5fb3b3ca 100644--- a/products/workflows/backend/migrations/max_migration.txt+++ b/products/workflows/backend/migrations/max_migration.txt@@ -1 +1 @@-0011_hogflowrevision+0012_hogflow_encrypted_inputsdiff --git a/products/workflows/backend/models/hog_flow/hog_flow.py b/products/workflows/backend/models/hog_flow/hog_flow.pyindex 7e4c3cffd94f..2f4184cb7f23 100644--- a/products/workflows/backend/models/hog_flow/hog_flow.py+++ b/products/workflows/backend/models/hog_flow/hog_flow.py@@ -6,6 +6,7 @@ from django.dispatch.dispatcher import receiverimport structlog+from posthog.helpers.encrypted_fields import EncryptedJSONStringFieldfrom posthog.models.team.team import Teamfrom posthog.models.utils import UUIDTModelfrom posthog.plugins.plugin_server_api import reload_hog_flows_on_workers@@ -79,6 +80,11 @@ class HogFlow(UUIDTModel):edges = models.JSONField(default=dict)actions = models.JSONField(default=dict)+ # Secret function inputs (schema fields marked secret, e.g. API keys / auth headers) split out of+ # `actions` and stored Fernet-encrypted at rest, keyed by action id then input key. Keeps plaintext+ # secrets out of `actions`, `draft`, revision snapshots, and activity-log diffs. Mirrors+ # HogFunction.encrypted_inputs; the worker decrypts and merges these back before execution.+ encrypted_inputs: EncryptedJSONStringField = EncryptedJSONStringField(null=True, blank=True)abort_action = models.CharField(max_length=400, null=True, blank=True)variables = models.JSONField(default=list, null=True, blank=True)@@ -89,6 +95,10 @@ class HogFlow(UUIDTModel):# Draft storage for active workflows: stores pending edits separately from live configdraft = models.JSONField(null=True, blank=True)draft_updated_at = models.DateTimeField(null=True, blank=True)+ # Pending secret function inputs for the draft, same shape as `encrypted_inputs`. Kept separate so+ # a draft's secrets are promoted to `encrypted_inputs` on publish and dropped on discard, without+ # touching the live values.+ draft_encrypted_inputs: EncryptedJSONStringField = EncryptedJSONStringField(null=True, blank=True)# Skip-forward map for deleted steps: {deleted_action_id: next surviving action_id}. Maintained# by the API whenever a live graph edit deletes actions, so runs parked on a deleted step can