Repository navigation
keep only logbook func_args in pyscript_running event - #900
Merged
craigbarratt merged 1 commit intoNov 18, 2026
Merged
Conversation
The pyscript_running event carried all of func_args. Besides values that aren't JSON serializable, these can include large or sensitive data, eg, a webhook payload with an auth token and the webhook_id, or service call data once @service fires the event. The event now keeps only the func_args the logbook describes it with: trigger_type, event_type, var_name, value and trigger_time. Anything that read other func_args from this event won't see them anymore.
craigbarratt
approved these changes
Nov 18, 2026
Member
There was a problem hiding this comment.
Thanks, @dmamelin. Keeping only what the logbook uses is a better fix than removing specific arguments. It covers #898, and also any argument added later that is large or not JSON serializable, such as the service call data from #899.
I agree the reduced func_args is fine since they're undocumented. I'll mention it in the release notes.
After this is merged, I'll add a small follow-up so the @webhook_handler timeout and unparsable-body warnings name the function instead of the webhook id.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to e104bda. Closes #898.
The event now keeps a whitelist of the
func_argsthe logbook describes it with:trigger_type,event_type,var_name,valueandtrigger_time. The otherfunc_argsaren't used anywhere, but the recorder stores them for every call, which bloats the database.Problem
pyscript_runningis fired before each triggered call and carried the call's fullfunc_args. That causes three problems:requestbroke the recorder and websocket subscribers withEvent is not JSON serializable. e104bda droppedrequest, but that is a blacklist: any non-serializable argument added later breaks the event again.payload(which can hold an auth token) and thewebhook_idend up in the recorder'seventstable and in the serialization error log. The event is fired before the user's function runs, so the function can't sanitize them.@servicefirespyscript_runningtoo, so all service call data would be stored in the recorder for every call.Breaking change
In theory, this can break listeners of
pyscript_runningthat read otherfunc_argsfrom it. I don't think that's a problem:func_argsaren't documented;pyscript_runningis easy to replace with@state_triggeror@event_triggeron the same source, or with an event fired from the function itself viaevent.fire().