-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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(cdp): Added legacy plugins worker #27835
base: master
Are you sure you want to change the base?
Conversation
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
Size Change: +5 B (0%) Total Size: 1.16 MB ℹ️ View Unchanged
|
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
"icon_url": plugin_config.plugin.icon, | ||
} | ||
|
||
print("Attempting to create hog function", data) # noqa: T201 |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (secret)
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 10 hours ago
To fix the problem, we should avoid logging the entire data
object directly. Instead, we can log only non-sensitive parts of the data
object or use a method to sanitize the data before logging. This ensures that any sensitive information is not exposed in the logs.
The best way to fix the problem without changing existing functionality is to create a sanitized version of the data
object that excludes any sensitive information and log this sanitized version instead. We can achieve this by creating a helper function that removes or masks sensitive fields from the data
object.
-
Copy modified lines R9-R15 -
Copy modified lines R96-R98
@@ -8,2 +8,9 @@ | ||
|
||
def sanitize_data(data): | ||
sanitized = data.copy() | ||
if "inputs" in sanitized: | ||
for key, value in sanitized["inputs"].items(): | ||
if value.get("secret", False): | ||
sanitized["inputs"][key]["value"] = "[REDACTED]" | ||
return sanitized | ||
|
||
@@ -88,4 +95,5 @@ | ||
|
||
print("Attempting to create hog function", data) # noqa: T201 | ||
print(json.dumps(data, indent=2)) # noqa: T201 | ||
sanitized_data = sanitize_data(data) | ||
print("Attempting to create hog function", sanitized_data) # noqa: T201 | ||
print(json.dumps(sanitized_data, indent=2)) # noqa: T201 | ||
|
} | ||
|
||
print("Attempting to create hog function", data) # noqa: T201 | ||
print(json.dumps(data, indent=2)) # noqa: T201 |
Check failure
Code scanning / CodeQL
Clear-text logging of sensitive information High
sensitive data (secret)
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 10 hours ago
To fix the problem, we need to ensure that sensitive information is not logged in clear text. The best way to do this is to remove or mask the sensitive information before logging. Specifically, we should avoid logging the entire data
object directly and instead log only non-sensitive parts of it. We can create a sanitized version of the data
object that excludes or masks sensitive fields before logging.
- Identify the lines where sensitive information is being logged.
- Create a sanitized version of the
data
object that excludes or masks sensitive fields. - Log the sanitized version instead of the original
data
object.
-
Copy modified lines R89-R94 -
Copy modified line R103 -
Copy modified line R107 -
Copy modified line R115
@@ -88,4 +88,8 @@ | ||
|
||
print("Attempting to create hog function", data) # noqa: T201 | ||
print(json.dumps(data, indent=2)) # noqa: T201 | ||
sanitized_data = data.copy() | ||
for input_key in sanitized_data["inputs"]: | ||
if sanitized_data["inputs"][input_key].get("secret", False): | ||
sanitized_data["inputs"][input_key]["value"] = "[REDACTED]" | ||
print("Attempting to create hog function", sanitized_data) # noqa: T201 | ||
print(json.dumps(sanitized_data, indent=2)) # noqa: T201 | ||
|
||
@@ -98,3 +102,3 @@ | ||
|
||
print(hog_functions) # noqa: T201 | ||
print([{"name": hf.name, "id": hf.id} for hf in hog_functions]) # noqa: T201 | ||
|
||
@@ -102,3 +106,3 @@ | ||
print("Dry run, not creating hog functions") # noqa: T201 | ||
return hog_functions | ||
return [{"name": hf.name, "id": hf.id} for hf in hog_functions] | ||
|
||
@@ -110,3 +114,3 @@ | ||
|
||
print("Done") # noqa: T201 | ||
print("Done creating hog functions") # noqa: T201 | ||
|
Problem
We want to fast migrate off of plugins to HogFunctions and one way we can do this is by just inlining the plugins and using HogFunctions as the base layer for the actual work
Changes
TODO
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Does this work well for both Cloud and self-hosted?
How did you test this code?