-
Notifications
You must be signed in to change notification settings - Fork 158
Stop session replay obfuscation for non-EU/CA users #8353
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
Stop session replay obfuscation for non-EU/CA users #8353
Conversation
Co-authored-by: eric.okuma <[email protected]>
Co-authored-by: eric.okuma <[email protected]>
Co-authored-by: eric.okuma <[email protected]>
Code Organization SuggestionLines 57-125 have several function declarations nested inside Current issues:
Suggested refactoring:
This would make the Developed in collaboration with Claude Code |
PostHog API ConcernsThe type PosthogWithGeo = typeof posthog & {
get_property?: (property: string) => unknown;
set_person_properties?: (properties: Record<string, unknown>) => void;
onFeatureFlags?: (callback: () => void) => void;
};Issues:
Recommendation: Remove the type extension entirely and use the // Remove this:
type PosthogWithGeo = typeof posthog & { ... };
const geoAwarePosthog = posthog as PosthogWithGeo;
// Just use posthog directly with the correct method names:
posthog.get_property(REGULATED_REGION_PROPERTY);
posthog.setPersonProperties({ [REGULATED_REGION_PROPERTY]: value });
posthog.onFeatureFlags(evaluateGeoRegulation);This will restore proper TypeScript type checking and fix the bug where regulation status isn't being persisted. Developed in collaboration with Claude Code |
Performance & Initialization ConcernsPotential Issue: The GeoIP evaluation logic runs synchronously during PostHog initialization, which could impact application load time. Current flow: posthog.init(POSTHOG_API_KEY, {
// ...
loaded: (client) => {
client.register_for_session({
"Rill version": rillVersion,
});
evaluateGeoRegulation(); // Runs synchronously in loaded callback
geoAwarePosthog.onFeatureFlags?.(evaluateGeoRegulation); // Also runs on every feature flag change
},
});Concerns:
Impact on app load:
Recommendations:
Bottom line: The code won't slow down app initialization, but the masking behavior may not work correctly until the second session for new users. Developed in collaboration with Claude Code |
ericpgreen2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the Claude Code comments above
|
Got a new direction from @nishant.bangarwa: https://www.notion.so/rilldata/Reduce-Data-Obfuscation-in-PostHog-2b6ba33c8f5780d69f22cdb8d6346dea?source=copy_link We will move away from region-based masking |
WHY: To enable unredacted session replays for non-EU/CA users while maintaining privacy compliance for regulated regions. This change implements capture-time masking based on user's GeoIP location, as recommended by PostHog (APP-582).
WHAT: Configured PostHog
session_recordingto dynamically apply masking:is_regulated_regionperson property.maskInputFnthat masks inputs only for regulated users (passwords are always masked).posthog.initloadedandonFeatureFlagscallbacks for timely GeoIP evaluation.Checklist:
Linear Issue: APP-582