-
Notifications
You must be signed in to change notification settings - Fork 198
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
feature/webhook_plugin_signing #2703
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2c1203e
feat: added webhook implementing webhook shared
Blokh 242c2c7
mvoed signing logic to common
Blokh c5f88cc
Merge branch 'dev' into feature/webhook_plugin_signing
Blokh 04334c0
feat: upgraded packages for signing logic
Blokh 7a0460f
feat: updated workflow service to add missing authentication select
Blokh 3b3fc9b
Merge branch 'dev' into feature/webhook_plugin_signing
Blokh 6736862
feat: updated packages
Blokh c522ae0
feat: removed additional header from webhook
Blokh a7c4fbb
Merge branch 'dev' into feature/webhook_plugin_signing
Blokh ed583e3
feat: resolved conflicts
Blokh fce4f0b
Merge branch 'dev' into feature/webhook_plugin_signing
Blokh eceeab6
feat: fixed depedencies
Blokh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { sign, computeHash } from './sign'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import CryptoJS from 'crypto-js'; | ||
|
||
export const sign = ({ payload, key }: { payload: unknown; key: string }) => { | ||
if (!key) { | ||
return 'UNSIGNED'; | ||
} | ||
|
||
return CryptoJS.HmacSHA256(JSON.stringify(payload), key).toString(CryptoJS.enc.Hex); | ||
}; | ||
|
||
export const computeHash = (data: unknown): string => { | ||
const md5hash = CryptoJS.MD5(JSON.stringify(data)); | ||
|
||
return md5hash.toString(CryptoJS.enc.Hex); | ||
}; | ||
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
Oops, something went wrong.
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.
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.
Use a more secure hash function and consider improving type safety.
The
computeHash
function correctly computes the hash of the input data and returns it as a hexadecimal string. However, there are two issues to consider:The function uses the MD5 hash function, which is known to have security vulnerabilities and is not recommended for use in new cryptographic protocols. Consider using a more secure hash function like SHA-256.
The
data
parameter is of typeunknown
, which allows any type of data to be passed as input. This could potentially lead to issues if the data is not serializable. Consider changing thedata
type to a more specific type (e.g.,Record<string, unknown>
) or adding type checks to ensure the data is serializable before stringifying it. This can help catch potential issues early and improve the function's type safety.Apply this diff to address the issues:
Committable suggestion