forked from tektoncd/triggers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change InterceptorRequest.Body to string
Storing the body as json.RawMessagae can lead to loss of information about spaces in the incoming body when the InterceptorRequest is marshaled as JSON before sending it over HTTP. This is because Go's `json.Marshal` will encode `[]byte` as a base64 string and base64 does not preserve spaces. Adding a custom `MarshalJSON` does not help here since `MarshalJSON` will return a `[]byte` that will then get compacted as base64 by `json.Marshal`. This loss of spaces can be problematic for some use cases. For instance, the GitHub payload signature validation requires us to compare using the exact body as it was sent. Otherwise, the validation fails. Note that this will only be a problem when we marshal the InterceptorRequest i.e. when we move the core interceptors out to its own server. Using a string means that the string will be quoted e.g. `{\"foo\": \"bar\"}`. Go should take care of unquoting it during the unmarshaling process. However, intercetpor authors using a different language will have to manually unquote the string by parsing it as a JSON object. Part of tektoncd#271, 867 Signed-off-by: Dibyo Mukherjee <dibyo@google.com>
- Loading branch information
Showing
11 changed files
with
70 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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