Web hooks not successful: Invalid href value provided. #4692

Closed
opened 2025-11-02 05:59:41 -06:00 by GiteaMirror · 12 comments
Owner

Originally created by @bkraul on GitHub (Jan 20, 2020).

  • Gitea version (or commit ref): ad1b6d4
  • Git version: 1.12.0+dev-130
  • Operating system: Docker (Ubuntu 18.04 LTS host)
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

All webhooks have begin to fail with the following response:

Headers
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept
Access-Control-Allow-Origin: *
Cache-Control: no-store
Connection: keep-alive
Content-Type: application/json
Date: Mon, 20 Jan 2020 18:00:59 GMT
Pragma: no-cache
Server: nginx/1.17.5
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding
X-Instance-Id: kywEfEQGjr4NXbNts
X-Ratelimit-Limit: 50
X-Ratelimit-Remaining: 49
X-Ratelimit-Reset: 1579543319854
X-Xss-Protection: 1
Body
{"success":false,"error":"Invalid href value provided"}

The webhook URL has not changed, and it was working properly before.

Screenshots

image
image

Originally created by @bkraul on GitHub (Jan 20, 2020). - Gitea version (or commit ref): ad1b6d4 - Git version: 1.12.0+dev-130 - Operating system: Docker (Ubuntu 18.04 LTS host) - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description All webhooks have begin to fail with the following response: ##### Headers ``` Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept Access-Control-Allow-Origin: * Cache-Control: no-store Connection: keep-alive Content-Type: application/json Date: Mon, 20 Jan 2020 18:00:59 GMT Pragma: no-cache Server: nginx/1.17.5 Strict-Transport-Security: max-age=31536000 Vary: Accept-Encoding X-Instance-Id: kywEfEQGjr4NXbNts X-Ratelimit-Limit: 50 X-Ratelimit-Remaining: 49 X-Ratelimit-Reset: 1579543319854 X-Xss-Protection: 1 ``` ##### Body ``` {"success":false,"error":"Invalid href value provided"} ``` The webhook URL has *not* changed, and it was working properly before. ## Screenshots ![image](https://user-images.githubusercontent.com/14616851/72748764-c62cd880-3b7d-11ea-99e6-ffd9b9fe3f35.png) ![image](https://user-images.githubusercontent.com/14616851/72748813-e2307a00-3b7d-11ea-826f-9f2637e18e7b.png)
GiteaMirror added the type/bug label 2025-11-02 05:59:41 -06:00
Author
Owner

@jolheiser commented on GitHub (Jan 20, 2020):

I see you blurred the text fields, but I suspect those are the relevant part to this bug.

Can you give us an example? You can replace it with a spoof message, but just so we can see the structure?

@jolheiser commented on GitHub (Jan 20, 2020): I see you blurred the text fields, but I suspect those are the relevant part to this bug. Can you give us an example? You can replace it with a spoof message, but just so we can see the structure?
Author
Owner

@bkraul commented on GitHub (Jan 20, 2020):

I changed the domain name, and some of the letters on the token:

Headers

Request URL: https://hooks.mydomain.com/hooks/1tzWu8yGGZ4PELbNb/3QNWPwufcyZD8N6wAJyHcZ2LAxH5xecnKJuWJe8ZvC9ZE8En
Request method: POST
Content-Type: application/json
X-GitHub-Delivery: 7fc692b1-cac9-441a-bb22-ae79d80f00b0
X-GitHub-Event: push
X-Gitea-Delivery: 7fc692b1-cac9-441a-bb22-ae79d80f00b0
X-Gitea-Event: push
X-Gitea-Signature: 
X-Gogs-Delivery: 7fc692b1-cac9-441a-bb22-ae79d80f00b0
X-Gogs-Event: push
X-Gogs-Signature: 

Content

{
  "channel": "#internal-commits",
  "text": "[\u003chttps://git.mydomain.com/org/Project.SubProject|epg/Project.SubProject\u003e:\u003chttps://git.mydomain.com/org/Project.SubProject/src/branch/master|master\u003e] \u003chttps://git.mydomain.com/org/Project.SubProject/compare/e182e39f16b75d31513ca0122ec5b175b904b573...8c847a9f3a13b91e03538594934630897e8deb91|1 new commit\u003e pushed by bkraul",
  "username": "",
  "icon_url": "",
  "unfurl_links": 0,
  "link_names": 0,
  "attachments": [
    {
      "fallback": "",
      "color": "",
      "title": "",
      "title_link": "",
      "text": "\u003chttps://git.mydomain.com/org/Project.SubProject/commit/8c847a9f3a13b91e03538594934630897e8deb91|8c847a9\u003e: Some commit message - bkraul"
    }
  ]
@bkraul commented on GitHub (Jan 20, 2020): I changed the domain name, and some of the letters on the token: #### Headers ``` Request URL: https://hooks.mydomain.com/hooks/1tzWu8yGGZ4PELbNb/3QNWPwufcyZD8N6wAJyHcZ2LAxH5xecnKJuWJe8ZvC9ZE8En Request method: POST Content-Type: application/json X-GitHub-Delivery: 7fc692b1-cac9-441a-bb22-ae79d80f00b0 X-GitHub-Event: push X-Gitea-Delivery: 7fc692b1-cac9-441a-bb22-ae79d80f00b0 X-Gitea-Event: push X-Gitea-Signature: X-Gogs-Delivery: 7fc692b1-cac9-441a-bb22-ae79d80f00b0 X-Gogs-Event: push X-Gogs-Signature: ``` #### Content ```json { "channel": "#internal-commits", "text": "[\u003chttps://git.mydomain.com/org/Project.SubProject|epg/Project.SubProject\u003e:\u003chttps://git.mydomain.com/org/Project.SubProject/src/branch/master|master\u003e] \u003chttps://git.mydomain.com/org/Project.SubProject/compare/e182e39f16b75d31513ca0122ec5b175b904b573...8c847a9f3a13b91e03538594934630897e8deb91|1 new commit\u003e pushed by bkraul", "username": "", "icon_url": "", "unfurl_links": 0, "link_names": 0, "attachments": [ { "fallback": "", "color": "", "title": "", "title_link": "", "text": "\u003chttps://git.mydomain.com/org/Project.SubProject/commit/8c847a9f3a13b91e03538594934630897e8deb91|8c847a9\u003e: Some commit message - bkraul" } ] ```
Author
Owner

@bkraul commented on GitHub (Jan 20, 2020):

I am aware that this could be an issue in the incoming webhook side of things, but the thing is, nothing has changed on that end for weeks, and if I call the webhook directly by URL, it returns a success code

I'm gonna go ahead and test it with the json payload with Insomnia and see what I get..

@bkraul commented on GitHub (Jan 20, 2020): I am aware that this could be an issue in the incoming webhook side of things, but the thing is, nothing has changed on that end for weeks, and if I call the webhook directly by URL, it returns a success code I'm gonna go ahead and test it with the json payload with Insomnia and see what I get..
Author
Owner

@lafriks commented on GitHub (Jan 20, 2020):

Could be that something to do with escaping of < symbols

@lafriks commented on GitHub (Jan 20, 2020): Could be that something to do with escaping of < symbols
Author
Owner

@lafriks commented on GitHub (Jan 20, 2020):

It was recently changed to work in both slack and matternost

@lafriks commented on GitHub (Jan 20, 2020): It was recently changed to work in both slack and matternost
Author
Owner

@bkraul commented on GitHub (Jan 20, 2020):

OK. I see what the problem is. The incoming webhook is expecting a valid title_link parameter, but gitea is not sending any. It is also not sending a title either. I manually inserted the title_link value into the JSON payload, and the hook call executed successfully.

image

@bkraul commented on GitHub (Jan 20, 2020): OK. I see what the problem is. The incoming webhook is expecting a valid `title_link` parameter, but gitea is not sending any. It is also not sending a title either. I manually inserted the `title_link` value into the JSON payload, and the hook call executed successfully. ![image](https://user-images.githubusercontent.com/14616851/72751796-2fb0e500-3b86-11ea-8f40-3713343f6517.png)
Author
Owner

@bkraul commented on GitHub (Jan 20, 2020):

I am using RocketChat, which works pretty much in the same way Slack works. As mentioned, this has worked properly for at least a year. Maybe we need a RocketChat setting 😄 ? More info here

image

@bkraul commented on GitHub (Jan 20, 2020): I am using RocketChat, which works pretty much in the same way Slack works. As mentioned, this has worked properly for at least a year. Maybe we need a RocketChat setting 😄 ? More info [here](https://rocket.chat/docs/administrator-guides/integrations/) ![image](https://user-images.githubusercontent.com/14616851/72752070-e4e39d00-3b86-11ea-8512-afc0c949107d.png)
Author
Owner

@bkraul commented on GitHub (Jan 20, 2020):

And so, apparently, if there are no attachments object sent, the call from gitea to the hook works fine, because if there are no attachments, there is no requirement for the title_link value. That's probably why it has worked for a while.

This payload works fine

{
  "username": "git",
  "icon_url": "https://my.domain.com/assets/touchicon_180.png",
  "text": "Example message",
  "attachments": null
}
@bkraul commented on GitHub (Jan 20, 2020): And so, apparently, if there are no `attachments` object sent, the call from gitea to the hook works fine, because if there are no attachments, there is no requirement for the `title_link` value. That's probably why it has worked for a while. This payload works fine ``` { "username": "git", "icon_url": "https://my.domain.com/assets/touchicon_180.png", "text": "Example message", "attachments": null } ```
Author
Owner

@bkraul commented on GitHub (Jan 21, 2020):

Sooo...anything that can be done to help this issue? A workaround, a config setting, maybe?

@bkraul commented on GitHub (Jan 21, 2020): Sooo...anything that can be done to help this issue? A workaround, a config setting, maybe?
Author
Owner

@lunny commented on GitHub (Jan 21, 2020):

It maybe related with #9422 ?

@lunny commented on GitHub (Jan 21, 2020): It maybe related with #9422 ?
Author
Owner

@jolheiser commented on GitHub (Jan 21, 2020):

I believe it's caused by https://github.com/go-gitea/gitea/pull/9378, which added TitleLink to the payload.
Perhaps when it is omitted it also works?

Looking at the blame for push actions, the func itself hasn't been touched in a few months. That change was only changing links, so it's unlikely that caused it, and before that change it's been years.
This leads me to believe something changed outside the func, most likely the payload.

My guess is that action needs to set the TitleLink similarly to the other payloads.

@jolheiser commented on GitHub (Jan 21, 2020): I believe it's caused by https://github.com/go-gitea/gitea/pull/9378, which added `TitleLink` to the payload. Perhaps when it is omitted it also works? Looking at the blame for push actions, the func itself hasn't been touched in a few months. That change was only changing links, so it's unlikely that caused it, and before that change it's been _years_. This leads me to believe something changed outside the func, most likely the payload. My guess is that action needs to set the `TitleLink` similarly to the other payloads.
Author
Owner

@bkraul commented on GitHub (Jan 21, 2020):

Waiting for docker build like:

giphy

Thanks guys! You rock!

@bkraul commented on GitHub (Jan 21, 2020): Waiting for docker build like: ![giphy](https://user-images.githubusercontent.com/14616851/72840921-ea121c00-3c5a-11ea-8cca-6b922ff33d16.gif) Thanks guys! You rock!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4692