fix(parser): prevent webhook body with 'key' field from being silently dropped (fixes #5333)#6230
Open
asheesh-devops wants to merge 1 commit intokeephq:mainfrom
Open
Conversation
…o StepProviderParameter (fixes keephq#5333) Only attempt StepProviderParameter coercion when the dict exclusively contains known fields (key, safe, default). User dicts with additional fields like host, time, message are now preserved as-is.
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.
Summary
Fixes a bug where a workflow step POSTing a JSON body with a field named
"key"would silently discard all other fields, sending only the value of the"key"field as a string instead of the full JSON object.Root Cause
In
parse_provider_parameters(), when a parameter value is a dict, the code unconditionally attempts to coerce it into aStepProviderParameter(**dict). SinceStepProviderParameteronly requires akeyfield:Any user dict containing a
"key"field is silently converted — all other fields are discarded:The Fix
Only attempt
StepProviderParametercoercion when the dict exclusively contains its known fields (key,safe,default):Changes
keep/parser/parser.py— add field validation beforeStepProviderParametercoercion inparse_provider_parameters()Testing
{"key": "ALERT", "host": "...", "time": "..."}now passes through as-is (has extra fields beyondkey/safe/default){"key": "alert.name"}still correctly becomes aStepProviderParameter(only known fields){"key": "alert.name", "safe": true, "default": "N/A"}still correctly becomes aStepProviderParameter<=(subset) check ensures forward compatibility ifStepProviderParametergains new optional fieldsFixes #5333