-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add support for X-Hub-Signature headers in webhooks #8473
Conversation
@@ -572,7 +574,8 @@ type HookTask struct { | |||
UUID string | |||
Type HookTaskType | |||
URL string `xorm:"TEXT"` | |||
Signature string `xorm:"TEXT"` |
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.
We need a database migration
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
var err error | ||
|
||
switch x.Dialect().DriverName() { | ||
case "mysql": |
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.
Two things. 1. Rename columns is tricky (for example SQLite also needs to be added to this migration) so perhaps instead of a rename we keep signature column with same content we just have the strict field be renamed, and then add the new sha column. 2. Could you add the adding of the new column to this migration, while it is added by the default migration,sometimes we’ve been bitten by changing a column that doesn’t yet exist so usually we request explicit add of new columns.
Apologies if I am unclear, I am on mobile and can give better details when I get to a computer. Please ask any questions.
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.
imho this would be much better
@@ -572,7 +574,8 @@ type HookTask struct { | |||
UUID string | |||
Type HookTaskType | |||
URL string `xorm:"TEXT"` | |||
Signature string `xorm:"TEXT"` | |||
SignatureSha1 string `xorm:"TEXT"` |
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.
SignatureSha1 string `xorm:"TEXT"` | |
Signature string `xorm:"TEXT"` |
models/webhook.go
Outdated
@@ -572,7 +574,8 @@ type HookTask struct { | |||
UUID string | |||
Type HookTaskType | |||
URL string `xorm:"TEXT"` | |||
Signature string `xorm:"TEXT"` | |||
SignatureSha1 string `xorm:"TEXT"` | |||
SignatureSha256 string `xorm:"TEXT"` |
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.
SignatureSha256 string `xorm:"TEXT"` | |
SignatureSha1 string `xorm:"TEXT"` |
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.
There still needs to be fields:
Signature string `xorm:"TEXT"`
SignatureSha1 string `xorm:"TEXT"`
Co-Authored-By: Lauris BH <lauris@nix.lv>
Co-Authored-By: Lauris BH <lauris@nix.lv>
I would like @lafriks 's change. So that your migrations will be simpler to only use |
Please resolve the conflicts. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions. |
This pull request has been automatically closed because of inactivity. You can re-open it if needed. |
Send a new header X-Hub-Signature using the sha1 format
Renames existing Signature to Signature256 since we need to generate to HMACs from the same secret
Fix #7788