Skip to content
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

Webhooks provide no or wrong content type #15952

Closed
2 tasks done
sgross-emlix opened this issue Dec 11, 2024 · 1 comment
Closed
2 tasks done

Webhooks provide no or wrong content type #15952

sgross-emlix opened this issue Dec 11, 2024 · 1 comment

Comments

@sgross-emlix
Copy link

sgross-emlix commented Dec 11, 2024

Debug mode

Describe the bug

Webhooks issue an HTTP POST command. The payload is a json String. For the General webhook testing no header with Content-Type is supplied. This leads to HTTP response code 415 for gitlab and others that do not implicitly expect application/json.

To overcome that Google Webhook has been tried as alternative but this test sends applications/json which does also not work.

Reproduction steps

  1. Gitlab: Add gitlab pipeline trigger token (Or use some dummy http server)
  2. Snipe-it: Open integration tab and add https://<GITLAB>/api/v4/projects/<ID>/ref/main/trigger/pipeline?token=<TOKEN> as general webhook
  3. Click on "Test Webhook"

Expected behavior

Response 201

Screenshots

No response

Snipe-IT Version

v7.0.13 - build 15666 (master)

Operating System

Debian 12.7

Web Server

Apache 2.4.62-1

PHP Version

php 8.2.24-1

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

* General Webhook: `415 Unsupported Media Type` response: {"error":"The provided content-type '' is not supported."}`
* Google Webhook: `415 Unsupported Media Type` response: {"error":"The provided content-type 'applications/json' is not supported."}`

Additional context

No response

Copy link

welcome bot commented Dec 11, 2024

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

sgross-emlix added a commit to sgross-emlix/snipe-it that referenced this issue Dec 11, 2024
We send json payload in HTTP `POST`. Communicate this explicitly towards
the server by setting content-type header appropriately.
sgross-emlix added a commit to sgross-emlix/snipe-it that referenced this issue Dec 11, 2024
We send json payload in HTTP `POST`. Communicate this explicitly towards
the server by setting content-type header appropriately.
sgross-emlix added a commit to sgross-emlix/snipe-it that referenced this issue Dec 11, 2024
Content type for json is `application/json` without the plural `s`
@snipe snipe closed this as completed in f5a9e4b Dec 11, 2024
snipe added a commit that referenced this issue Dec 12, 2024
commit 01c18f6
Merge: 4d1d2fe c5e2aed
Author: snipe <snipe@snipe.net>
Date:   Thu Dec 12 17:40:40 2024 +0000

    Merge pull request #15962 from snipe/fixes_rb-18772

commit c5e2aed
Author: snipe <snipe@snipe.net>
Date:   Thu Dec 12 17:37:08 2024 +0000

    Check for assigned (not assigned_to) before trying to present() the name on bulk delete assets

    Signed-off-by: snipe <snipe@snipe.net>

commit 4d1d2fe
Merge: ab6363a a0e7dcf
Author: snipe <snipe@snipe.net>
Date:   Thu Dec 12 17:05:10 2024 +0000

    Merge pull request #15960 from uberbrady/improve_restore_cleaner_utf8

commit ab6363a
Merge: f089d1f da33f18
Author: snipe <snipe@snipe.net>
Date:   Thu Dec 12 16:53:15 2024 +0000

    Merge pull request #15959 from snipe/remove_settings_api_endpoints

commit a0e7dcf
Author: Brady Wetherington <bwetherington@grokability.com>
Date:   Thu Dec 12 16:50:36 2024 +0000

    Fixes to 'clean' mode to better handle character sets and zero-values

commit da33f18
Author: snipe <snipe@snipe.net>
Date:   Thu Dec 12 16:46:19 2024 +0000

    Removed index and destroy settinga API endpoints

    Signed-off-by: snipe <snipe@snipe.net>

commit f089d1f
Merge: 4bd6c21 67494c1
Author: snipe <snipe@snipe.net>
Date:   Thu Dec 12 01:42:26 2024 +0000

    Merge pull request #15944 from marcusmoore/bug/required-display-for-selects

commit 4bd6c21
Merge: a7e6b8e 3264149
Author: snipe <snipe@snipe.net>
Date:   Thu Dec 12 00:38:21 2024 +0000

    Merge pull request #15957 from Godmartinz/fix-checkout-notif-parameters

commit 67494c1
Author: Marcus Moore <contact@marcusmoore.io>
Date:   Wed Dec 11 16:26:23 2024 -0800

    Fix validation messages for select2 inputs

commit 3264149
Author: Godfrey M <godmartinz@gmail.com>
Date:   Wed Dec 11 16:26:18 2024 -0800

    fix other mailables

commit 8417fcb
Author: Marcus Moore <contact@marcusmoore.io>
Date:   Wed Dec 11 16:25:45 2024 -0800

    Revert "Show frontend "required" validation for model and status selects"

    This reverts commit 10a7ae8.

commit 400833f
Author: Godfrey M <godmartinz@gmail.com>
Date:   Wed Dec 11 16:14:06 2024 -0800

    reversed order of the acceptance and note paramter

commit a7e6b8e
Merge: b9a6606 6e31d0f
Author: snipe <snipe@snipe.net>
Date:   Wed Dec 11 23:52:33 2024 +0000

    Merge pull request #15956 from marcusmoore/bug/sc-27731

commit 6e31d0f
Author: Marcus Moore <contact@marcusmoore.io>
Date:   Wed Dec 11 15:39:41 2024 -0800

    Use appropriate category for licenses when seeding

commit b9a6606
Merge: 06a0ac8 014350a
Author: snipe <snipe@snipe.net>
Date:   Wed Dec 11 20:42:13 2024 +0000

    Merge pull request #15955 from ubc-cpsc/bugfix/GHSA-c2pc-g5qf-rfrf

commit 014350a
Author: Joël Pittet <pittet@cs.ubc.ca>
Date:   Wed Dec 11 12:04:45 2024 -0800

    Fix league/commonmark's quadratic complexity bugs may lead to a denial of service

commit 06a0ac8
Author: snipe <snipe@snipe.net>
Date:   Wed Dec 11 18:34:18 2024 +0000

    Fixed #15928 - updated method name to setCreatedBy from SetUserId

    Signed-off-by: snipe <snipe@snipe.net>

commit 34a47e9
Author: snipe <snipe@snipe.net>
Date:   Wed Dec 11 18:09:53 2024 +0000

    Add @sgross-emlix as a contributor

commit f5a9e4b
Author: snipe <snipe@snipe.net>
Date:   Wed Dec 11 18:09:19 2024 +0000

    Fixes #15952 - fixed typo in content-type

    Signed-off-by: snipe <snipe@snipe.net>

commit 6633948
Merge: 5014a95 2e97b56
Author: snipe <snipe@snipe.net>
Date:   Wed Dec 11 17:38:59 2024 +0000

    Merge pull request #15954 from Godmartinz/null_fix-for-reminder-command

commit 2e97b56
Author: Godfrey M <godmartinz@gmail.com>
Date:   Wed Dec 11 09:27:27 2024 -0800

    add null safe operator to acceptance reminder

commit 5014a95
Author: snipe <snipe@snipe.net>
Date:   Tue Dec 10 13:27:59 2024 +0000

    Updated supported versions

    Signed-off-by: snipe <snipe@snipe.net>

commit 10a7ae8
Author: Marcus Moore <contact@marcusmoore.io>
Date:   Mon Dec 9 16:09:51 2024 -0800

    Show frontend "required" validation for model and status selects

commit 5f0efd8
Merge: cc8f72c 31155b5
Author: snipe <snipe@snipe.net>
Date:   Mon Dec 9 19:35:31 2024 +0000

    Merge pull request #15940 from snipe/reove_gh_templates

commit 31155b5
Author: snipe <snipe@snipe.net>
Date:   Mon Dec 9 19:28:51 2024 +0000

    Removed issue/PR templates

    Signed-off-by: snipe <snipe@snipe.net>

commit cc8f72c
Merge: a0bab70 f6b9ae6
Author: snipe <snipe@snipe.net>
Date:   Mon Dec 9 19:23:13 2024 +0000

    Merge pull request #15914 from Godmartinz/send_reminder_emails

commit a0bab70
Merge: 0149ed7 b5c8251
Author: snipe <snipe@snipe.net>
Date:   Mon Dec 9 17:56:23 2024 +0000

    Merge pull request #15939 from uberbrady/fix_ldap_asset_location_updater

commit b5c8251
Author: Brady Wetherington <bwetherington@grokability.com>
Date:   Mon Dec 9 17:40:10 2024 +0000

    Only update asset locations to assets checked out to users.

commit 0149ed7
Merge: f726359 4f9f035
Author: snipe <snipe@snipe.net>
Date:   Mon Dec 9 17:00:10 2024 +0000

    Merge pull request #15565 from spencerrlongg/bug/sc-25921

commit f726359
Merge: a137e31 5120cdd
Author: snipe <snipe@snipe.net>
Date:   Mon Dec 9 16:40:21 2024 +0000

    Merge pull request #15925 from Godmartinz/refactor-unaccepted-assets-reminder-notif

commit 5120cdd
Author: Godfrey M <godmartinz@gmail.com>
Date:   Thu Dec 5 16:02:55 2024 -0800

    delete notification version of reminder

commit 97398f1
Author: Godfrey M <godmartinz@gmail.com>
Date:   Thu Dec 5 12:41:33 2024 -0800

    adds testing to unaccepted reminder command

commit 281ff6a
Author: Godfrey M <godmartinz@gmail.com>
Date:   Thu Dec 5 11:52:34 2024 -0800

    wrap comment

commit 9d49b01
Author: Godfrey M <godmartinz@gmail.com>
Date:   Thu Dec 5 11:46:56 2024 -0800

    cleans up the Unaccepted Asset reminder variables

commit 3f8916e
Author: Godfrey M <godmartinz@gmail.com>
Date:   Thu Dec 5 11:37:03 2024 -0800

    fix duplicate emails being sent in unaccepted reminder command

commit f6b9ae6
Author: Godfrey M <godmartinz@gmail.com>
Date:   Thu Dec 5 10:18:35 2024 -0800

    missed a spot

commit de41def
Author: Godfrey M <godmartinz@gmail.com>
Date:   Thu Dec 5 10:15:57 2024 -0800

    fixed conditionals

commit 52b051e
Author: Godfrey M <godmartinz@gmail.com>
Date:   Thu Dec 5 10:08:39 2024 -0800

    add mail class for unaccepted assets reminders

commit a137e31
Merge: 43d66a8 ca0f8ac
Author: snipe <snipe@snipe.net>
Date:   Wed Dec 4 21:46:43 2024 +0000

    Merge pull request #15920 from akemidx/asset-category-in-emails

commit ca0f8ac
Author: akemidx <kojotek.dx@gmail.com>
Date:   Tue Dec 3 16:57:28 2024 -0500

    fixed

commit 6252f0a
Author: akemidx <kojotek.dx@gmail.com>
Date:   Tue Dec 3 16:10:42 2024 -0500

    layout / added category id

commit 43d66a8
Merge: 2ad1407 e5284c0
Author: snipe <snipe@snipe.net>
Date:   Tue Dec 3 17:17:26 2024 +0000

    Merge pull request #15918 from Godmartinz/mail_name_fix

    Adds `MAIL_FROM_NAME` to mail envelope

commit e5284c0
Author: Godfrey M <godmartinz@gmail.com>
Date:   Tue Dec 3 09:10:50 2024 -0800

    fix typo

commit 16283b8
Author: Godfrey M <godmartinz@gmail.com>
Date:   Tue Dec 3 09:08:39 2024 -0800

    adds mail from name to mail envelope

commit 983b78e
Author: Godfrey M <godmartinz@gmail.com>
Date:   Mon Dec 2 14:27:04 2024 -0800

    add property check

commit 2ad1407
Merge: 1473018 99464fc
Author: snipe <snipe@snipe.net>
Date:   Mon Dec 2 22:03:32 2024 +0000

    Merge pull request #15909 from Godmartinz/checkin-out-notifications

    Fixed general webhook option notifications not firing

commit ab67c48
Author: Godfrey M <godmartinz@gmail.com>
Date:   Mon Dec 2 13:03:09 2024 -0800

    fix unaccepted assets report resend acceptance

commit 99464fc
Author: Godfrey M <godmartinz@gmail.com>
Date:   Mon Dec 2 10:19:24 2024 -0800

    fixes general webhook not firing

commit 4f9f035
Author: spencerrlongg <spencer@spencerlong.com>
Date:   Mon Sep 30 20:09:00 2024 -0500

    added a way to manipulate validator attribute names

commit cd3059f
Author: spencerrlongg <spencer@spencerlong.com>
Date:   Mon Sep 30 13:38:52 2024 -0500

    rm numbers too. :(

commit b69596a
Author: spencerrlongg <spencer@spencerlong.com>
Date:   Wed Sep 25 16:21:33 2024 -0500

    rm dump

commit d02b993
Author: spencerrlongg <spencer@spencerlong.com>
Date:   Wed Sep 25 15:38:40 2024 -0500

    rm comment

commit 852a56f
Author: spencerrlongg <spencer@spencerlong.com>
Date:   Wed Sep 25 15:30:41 2024 -0500

    should be all good now

commit 9df78a9
Author: spencerrlongg <spencer@spencerlong.com>
Date:   Wed Sep 25 14:00:50 2024 -0500

    working! need formatting for error messages etc

commit f3ad899
Author: spencerrlongg <spencer@spencerlong.com>
Date:   Wed Sep 25 13:00:35 2024 -0500

    hm ok this kind of works

commit 21906d8
Author: spencerrlongg <spencer@spencerlong.com>
Date:   Wed Sep 25 12:47:56 2024 -0500

    world set up and idea in place

Signed-off-by: snipe <snipe@snipe.net>
DarthKillian added a commit to DarthKillian/eti-assets that referenced this issue Dec 31, 2024
* Versioning stuff is hard - fixed v7.0.14 to v7.1.14

Signed-off-by: snipe <snipe@snipe.net>

* Versioning stuff is hard - fixed v7.0.14 to v7.1.14

Signed-off-by: snipe <snipe@snipe.net>

* this should work in theory - local is screwy though

* working except for null 🤔

* seems to work just fine now, needs translations

* note and rm dump and comment

* Specify table name in select

Signed-off-by: snipe <snipe@snipe.net>

* Add @maciej-poleszczyk as a contributor

* Fixed snipe#15812 - regression in action_type search

Signed-off-by: snipe <snipe@snipe.net>

* Removed Twitter links

Signed-off-by: snipe <snipe@snipe.net>

* Removed extra sort

Signed-off-by: snipe <snipe@snipe.net>

* Fixed anchor links

Signed-off-by: snipe <snipe@snipe.net>

* replace the via channel class

* removes tag if qr code is not present

* translations and attribute names

* fixed rest of dymos

* rm unnecessary imports

* Corrected route name for filestable on assets

Signed-off-by: snipe <snipe@snipe.net>

* Fixed delete model file route

Signed-off-by: snipe <snipe@snipe.net>

* oops, something went wrong translation

* Fixed snipe#15820 - added model number to view-assets

Signed-off-by: snipe <snipe@snipe.net>

* Additional fix for snipe#15817

Signed-off-by: snipe <snipe@snipe.net>

* Fixed snipe#15825

Signed-off-by: snipe <snipe@snipe.net>

* Fixed admin user not showing in download all activity report

Signed-off-by: snipe <snipe@snipe.net>

* this should be all it takes to fix this, i think

* replace env with config variable for from address

* Fix rollback for created_by

* Fix rollback for webhook_endpoint by using correct column type

* update default from address to alternate config variable

* Update README.md

typo mosrt to most under Join our Community links

* Feature: Added API endpoint for generating asset labels

* Feature: Added translations for label generation API endpoint

* Feature: Added API route for asset label generation

* Fixed variable name

Signed-off-by: snipe <snipe@snipe.net>

* Indicate requiredness on status select on bulk user checkin+delete

Signed-off-by: snipe <snipe@snipe.net>

* use existing validation strings

* add testing example var MAIL_FROM_ADDR

* fix mail.from.address variables in config, simplify envelop[ variable

* adding colon to password translation

* Add tests around component check ins via api

* Formatting

* Use === over ==

* Add tests around deleting component via ui

* Improve check for image existence

* Feature: Added category to asset checkout email

* Feature: Added category to asset checkin email

* Feature: Added category to asset acceptance/decline email

* Feature: Added category to asset requested email

* Fix: Removed setting validation as it is not strictly necessary

* no checked out to email doesnt trigger a 500

* Always run validation on checkin

* Use database file for sqlite in GitHub Action for tests

* remove the changes to mail.from.address default

* Add tests for component checkout api endpoint

* [Snyk] Upgrade jquery-ui from 1.14.0 to 1.14.1 snipe#15868

Signed-off-by: snipe <snipe@snipe.net>

* fixing colon placements

* Always call resizeCanvas

* WIP: move signature pad creation up and add debugging

* Remove debugging

* commit for testing

* orange bar for requirednessness

* Updated translations

Signed-off-by: snipe <snipe@snipe.net>

* Updated version

Signed-off-by: snipe <snipe@snipe.net>

* fix user api update from clearing location_id unnecessarily

* fixed mobile view of assets

* fix mobile view for asset and user

* Harden asset checkout validation by requiring ints

* requested changes from pr

* fixing line

* Dev assets

Signed-off-by: snipe <snipe@snipe.net>

* Use transformer on API update

Signed-off-by: snipe <snipe@snipe.net>

* Fixed order by notes for users

Signed-off-by: snipe <snipe@snipe.net>

* Fixed snipe#15901 - re-added required indicator on text and select custom fields

Signed-off-by: snipe <snipe@snipe.net>

* Fixed bulk user form in user detail view

Signed-off-by: snipe <snipe@snipe.net>

* Revert "Hardened asset checkout validation by requiring integer"

* Some CSS twiddling

Signed-off-by: snipe <snipe@snipe.net>

* Fixed funky layout in importer

Signed-off-by: snipe <snipe@snipe.net>

* fixes general webhook not firing

* Include MAIL_FROM_ADDR in phpunit configuration

* Fixed sr-only blank text

Signed-off-by: snipe <snipe@snipe.net>

* Harden asset checkout validation

* fix unaccepted assets report resend acceptance

* add property check

* adds mail from name to mail envelope

* fix typo

* layout / added category id

* fixed

* add mail class for unaccepted assets reminders

* fixed conditionals

* missed a spot

* fix duplicate emails being sent in unaccepted reminder command

* cleans up the Unaccepted Asset reminder variables

* wrap comment

* adds testing to unaccepted reminder command

* delete notification version of reminder

* Only update asset locations to assets checked out to users.

* Removed issue/PR templates

Signed-off-by: snipe <snipe@snipe.net>

* note, will come back to this once question is answered

* Show frontend "required" validation for model and status selects

* Updated supported versions

Signed-off-by: snipe <snipe@snipe.net>

* add null safe operator to acceptance reminder

* Fixes snipe#15952 - fixed typo in content-type

Signed-off-by: snipe <snipe@snipe.net>

* Add @sgross-emlix as a contributor

* Fixed snipe#15928 - updated method name to setCreatedBy from SetUserId

Signed-off-by: snipe <snipe@snipe.net>

* Fix league/commonmark's quadratic complexity bugs may lead to a denial of service

* Use appropriate category for licenses when seeding

* reversed order of the acceptance and note paramter

* fix other mailables

* Revert "Show frontend "required" validation for model and status selects"

This reverts commit 10a7ae8.

* fix other mailables

* Fix validation messages for select2 inputs

* leaving this here for notes etc

* Removed index and destroy settinga API endpoints

Signed-off-by: snipe <snipe@snipe.net>

* Fixes to 'clean' mode to better handle character sets and zero-values

* Check for assigned (not assigned_to) before trying to present() the name on bulk delete assets

Signed-off-by: snipe <snipe@snipe.net>

* Updated strings

Signed-off-by: snipe <snipe@snipe.net>

* Add accessory ui tests

* Add consumable ui tests

* Scaffold and implement some license checkin tests

* Bumped font-awesome to 6.7.0

Signed-off-by: snipe <snipe@snipe.net>

* Refactor of snipe#15235 - added accessory checkout to locations, assets

Signed-off-by: snipe <snipe@snipe.net>

* Use history icon

Signed-off-by: snipe <snipe@snipe.net>

* Added currency and history icons

Signed-off-by: snipe <snipe@snipe.net>

* Fixed variable in test

Signed-off-by: snipe <snipe@snipe.net>

* Updated user_id to created_by

Signed-off-by: snipe <snipe@snipe.net>

* Added new route

Signed-off-by: snipe <snipe@snipe.net>

* Updated route

Signed-off-by: snipe <snipe@snipe.net>

* Fixed user_id to created_by

Signed-off-by: snipe <snipe@snipe.net>

* No need to include assigned_to

Signed-off-by: snipe <snipe@snipe.net>

* Updated transformer

Signed-off-by: snipe <snipe@snipe.net>

* Removed create() method

Signed-off-by: snipe <snipe@snipe.net>

* Specify created_by in the API call as well

Signed-off-by: snipe <snipe@snipe.net>

* Added assignedAccessories method

Signed-off-by: snipe <snipe@snipe.net>

* Added assets endpoint

Signed-off-by: snipe <snipe@snipe.net>

* Added accessory transformer to assets transformer

Signed-off-by: snipe <snipe@snipe.net>

* Updated route in view

Signed-off-by: snipe <snipe@snipe.net>

* Updated routes with new endpoints

Signed-off-by: snipe <snipe@snipe.net>

* Updated comment

Signed-off-by: snipe <snipe@snipe.net>

* Added new test

Signed-off-by: snipe <snipe@snipe.net>

* Fixed admin -> adminuser property

Signed-off-by: snipe <snipe@snipe.net>

* Fixed property

Signed-off-by: snipe <snipe@snipe.net>

* Removed inadvertently added files.

* Add tests for license checkin

* Add permissions property to group factory

* Add simple tests to ensure views render

* Use correct id

* Remove leftover testing logic and fix checkout permissions

Removed console logs and temporary testing code from the bootstrap-table view. Updated the transformer to correctly check checkout permissions against the Asset class instead of PredefinedKit.

* rm note

* change barcode column names in seeder

* add note

* oops, rm dump

* Added a few order options on audit report

Signed-off-by: snipe <snipe@snipe.net>

* Update settings property keys

* Fix broken merge conflict files part 1

Signed-off-by: Darth Killian <rhuntington719@gmail.com>

* More Merge Conflict Bug Fixes

Signed-off-by: Darth Killian <rhuntington719@gmail.com>

* More bug fixes and add bulk checkout company & order number support back
in

Signed-off-by: Darth Killian <rhuntington719@gmail.com>

* Fix some additional lang stuff and disable user checkout on accessories

Signed-off-by: Darth Killian <rhuntington719@gmail.com>

* Fix some more missing language references

Signed-off-by: Darth Killian <rhuntington719@gmail.com>

* Fix broken language and testing files

Signed-off-by: Darth Killian <rhuntington719@gmail.com>

* Fix tests (again)

Signed-off-by: Darth Killian <rhuntington719@gmail.com>

---------

Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: Darth Killian <rhuntington719@gmail.com>
Co-authored-by: snipe <snipe@snipe.net>
Co-authored-by: spencerrlongg <spencer@spencerlong.com>
Co-authored-by: Godfrey M <godmartinz@gmail.com>
Co-authored-by: Marcus Moore <contact@marcusmoore.io>
Co-authored-by: victoria <vpak@grokability.com>
Co-authored-by: NebelKreis <leipold.johannes@web.de>
Co-authored-by: akemidx <kojotek.dx@gmail.com>
Co-authored-by: Brady Wetherington <bwetherington@grokability.com>
Co-authored-by: Joël Pittet <pittet@cs.ubc.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant