[obs-commits] [openSUSE/open-build-service] 7d4a4e: [api] Implement service webhooks
Branch: refs/heads/master Home: https://github.com/openSUSE/open-build-service Commit: 7d4a4eef5e647704b39833ba09deaf01f7badf5a https://github.com/openSUSE/open-build-service/commit/7d4a4eef5e647704b39833... Author: Christian Bruckmayer <cbruckmayer@suse.com> Date: 2018-07-17 (Tue, 17 Jul 2018) Changed paths: A src/api/app/controllers/services/webhooks_controller.rb M src/api/app/models/token/service.rb M src/api/app/views/person/token/create.xml.builder M src/api/config/routes.rb A src/api/spec/cassettes/Services_WebhooksController/_create/with_HTTP_X-Pagure-Signature-256_http_header/behaves_like_it_verifies_the_signature/when_signature_is_valid/1_1_3_1_1_1.yml A src/api/spec/cassettes/Services_WebhooksController/_create/with_HTTP_X_HUB_SIGNATURE_http_header/behaves_like_it_verifies_the_signature/when_signature_is_valid/1_1_2_1_1_1.yml A src/api/spec/cassettes/Services_WebhooksController/_create/with_HTTP_X_OBS_SIGNATURE_http_header/behaves_like_it_verifies_the_signature/when_signature_is_valid/1_1_1_1_1_1.yml A src/api/spec/controllers/services/webhooks_controller_spec.rb M src/api/spec/factories/tokens.rb A src/api/spec/models/token/service_spec.rb Log Message: ----------- [api] Implement service webhooks GitHub announced the deprecation of GitHub services in favor of webhooks (on January 31, 2019 GitHub will stop delivering services events). WebHooks are designed different than services, therefore it was necessary to implement a dedicated controller. Unlike the OBS GitHub service, webhooks do not deliver the token anymore in the HTTP Header. Because of that it is not possible to compare the tokens anymore as part of the authentication process. We used this opportunity to implement generic webhooks which support for now GitHub, Pagure and a generic webhook. To trigger a webhook, it is now necessary to generate a signature over the payload body with the secret token. To authorize, OBS verifies this signature. OBS supports for now three different HTTP header to submit this signature: * HTTP_X_OBS_SIGNATURE (generic OBS header) * HTTP_X_HUB_SIGNATURE (GitHub) * HTTP_X-Pagure-Signature-256 (Pagure) It is now also necessary to send the token id with the webhook request. This PR introduces the new route: 'trigger/service/github?id=42' See these URLs for more details: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ https://developer.github.com/webhooks/securing/ https://docs.pagure.org/pagure/usage/using_webhooks.html Commit: 80cb3011e5ff28794248777f147f39266b4acb15 https://github.com/openSUSE/open-build-service/commit/80cb3011e5ff2879424877... Author: Christian Bruckmayer <cbruckmayer@suse.com> Date: 2018-07-17 (Tue, 17 Jul 2018) Changed paths: A src/api/app/controllers/services/webhooks_controller.rb M src/api/app/models/token/service.rb M src/api/app/views/person/token/create.xml.builder M src/api/config/routes.rb A src/api/spec/cassettes/Services_WebhooksController/_create/with_HTTP_X-Pagure-Signature-256_http_header/behaves_like_it_verifies_the_signature/when_signature_is_valid/1_1_3_1_1_1.yml A src/api/spec/cassettes/Services_WebhooksController/_create/with_HTTP_X_HUB_SIGNATURE_http_header/behaves_like_it_verifies_the_signature/when_signature_is_valid/1_1_2_1_1_1.yml A src/api/spec/cassettes/Services_WebhooksController/_create/with_HTTP_X_OBS_SIGNATURE_http_header/behaves_like_it_verifies_the_signature/when_signature_is_valid/1_1_1_1_1_1.yml A src/api/spec/controllers/services/webhooks_controller_spec.rb M src/api/spec/factories/tokens.rb A src/api/spec/models/token/service_spec.rb Log Message: ----------- Merge pull request #5326 from ChrisBr/feature/github-webhooks [api] Implement webhooks Compare: https://github.com/openSUSE/open-build-service/compare/561587eedc35...80cb30... **NOTE:** This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.
participants (1)
-
Christian Bruckmayer