pingcap / pingcap/ticdc

Some OpenAPI calls inherit invalid Host header when needing to `getChangeFeed()`.

Open
#6,217 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type/bug
Dominant language
Go
Stars
56
Forks
63
Avg merge
2d 20h
Merged PRs (30d)
34

Description

What did you do?
  1. Start a cluster

    tiup playground-ng v8.5.8 --db 1 --kv 1 --pd 1 --ticdc 1 --tiflash 0 --without-monitor --ticdc.config ./ticdc-newarch.toml
    
  2. Create an empty changefeed

    tiup cdc:v8.5.8 cli changefeed  create -c test --sink-uri 'blackhole://'
    
  3. List the changefeeds using OpenAPI v2 with an invalid Host header

    curl -H 'Host: example.invalid' http://127.0.0.1:8300/api/v2/changefeeds
    
  4. List tables in the test changefeed using OpenAPI v2 with an invalid Host header

    curl -H 'Host: example.invalid' http://127.0.0.1:8300/api/v2/changefeeds/test/tables
    
What did you expect to see?

Either both 3 and 4 are invalid, or both 3 and 4 work fine.

What did you see instead?

Step 3 returned valid result, while step 4 returned HTTP 500.

{
    "error_msg": "Get \"http://example.invalid/api/v2/changefeeds/test?keyspace=default\": dial tcp: lookup example.invalid: no such host",
    "error_code": ""
}
Versions of the cluster

v8.5.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the discrepancy with the TiUP cluster and the two curl commands in the issue. Then trace the OpenAPI v2 handlers for /api/v2/changefeeds and /api/v2/changefeeds/{id}/tables, focusing on getChangeFeed and Host handling; done means both requests behave consistently with an invalid Host header and the regression is covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, openapi
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.