Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(flags-hackathon): Encrypted payloads on remote config feature flags #27414

Open
wants to merge 130 commits into
base: master
Choose a base branch
from

Conversation

havenbarnes
Copy link
Contributor

@havenbarnes havenbarnes commented Jan 9, 2025

Problem

Follow-up to #27376 - adds support for encrypted payloads

Changes

Demo:
https://drive.google.com/file/d/1punn1c1yV2CXhsJ4ajelh89Mndqvz64n/view

  • Adds UX (for remote config flags only) allowing users to mark payloads as needing to be encrypted
  • Adds backend support for encrypting payloads on create / update, and for decrypting (or redacting) encrypted payloads on retrieve and list calls
  • Adds new endpoint GET .../feature_flags/:flagId/remote_config for fetching decrypted payload values when authenticated with personal API key
  • Adds "Remote config" as a filter option on the all feature flags table

Does this work well for both Cloud and self-hosted?

No differences

How did you test this code?

Added visual regression tests, will add/update API tests as well

@havenbarnes havenbarnes changed the base branch from master to config-flags January 9, 2025 19:13
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@havenbarnes havenbarnes changed the title feat(flags-hackathon): Enabled simple remote config feature flags feat(flags-hackathon): Encrypted payloads on remote config feature flags Jan 10, 2025
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@havenbarnes havenbarnes marked this pull request as ready for review February 3, 2025 17:22
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

I'll provide a concise summary of the key changes in this PR for adding encrypted payloads to remote config feature flags:

Added support for encrypting sensitive payload data in remote configuration feature flags, with a focus on secure access through personal API keys.

  • Added new has_encrypted_payloads field to feature flag model with corresponding UI controls and database migration
  • Added encryption/decryption helpers in encrypted_flag_payloads.py for secure payload handling
  • Added new /remote_config endpoint for fetching decrypted values when authenticated with personal API key
  • Limited encrypted payload support to API SDK initially (with plans to add Node.js, Python, Go, Ruby later)
  • Added "Remote config" filter option in feature flags table for better discoverability

The changes are well-structured across frontend and backend with proper validation and access control in place.

18 file(s) reviewed, 11 comment(s)
Edit PR Review Bot Settings | Greptile

posthog/api/feature_flag.py Show resolved Hide resolved
posthog/api/feature_flag.py Show resolved Hide resolved
posthog/api/feature_flag.py Outdated Show resolved Hide resolved
posthog/helpers/encrypted_flag_payloads.py Outdated Show resolved Hide resolved
posthog/helpers/encrypted_flag_payloads.py Show resolved Hide resolved
posthog/migrations/0559_encrypt_feature_flag_config.py Outdated Show resolved Hide resolved
frontend/src/scenes/feature-flags/FeatureFlag.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@dmarticus dmarticus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few additional questions on top of greptile yapping (tbh I think the greptile yaps were mostly pretty good; what a neat tool)

Copy link
Contributor

@dmarticus dmarticus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few additional questions on top of greptile yapping (tbh I think the greptile yaps were mostly pretty good; what a neat tool)

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

7 snapshot changes in total. 0 added, 7 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants