Kong: 2.1 Route name null incorrectly parsed in admin api response

Created on 27 Jul 2020  路  4Comments  路  Source: Kong/kong

Summary

GET on Kong 2.1 admin api /routes endpoint returns incorrectly parses null name field, "name": "$(VALUE)",.

    {
      "id": "f70c1923-2d48-47e4-aa9f-0fe66889c633",
      "path_handling": "v1",
      "updated_at": 1586331527,
      "destinations": null,
      "headers": null,
      "protocols": [
        "http",
        "https"
      ],
      "created_at": 1586331527,
      "snis": null,
      "service": {
        "id": "fc9e13e0-0959-4f4b-9643-6f0e6df367bd"
      },
      "name": "$(VALUE)",
      "methods": null,
      "preserve_host": false,
      "regex_priority": 0,
      "paths": [
        "/api/myapi/v1"
      ],
      "sources": null,
      "strip_path": true,
      "https_redirect_status_code": 426,
      "hosts": null,
      "tags": null
    }

Steps To Reproduce

  1. upgrade to Kong 2.1 when having null name in a route resource
  2. GET /routes on admin API

Additional Details & Logs

  • Kong version (2.1)
  • Operating system: alpine 3.10
tasbug

Most helpful comment

@hishamhm Yes. Opps on my spare github account 馃榾 .

All 4 comments

Can confirm, this is an issue in 2.1.0 - it was not in 2.0.5

Additionally, the consumer resource also experiences such an issue with a GET on the /consumers for pre 2.1 consumers that have had a null field now reporting the errant $(VALUE) response, this time on custom_id (an unused field for us too):

{
  "custom_id": "$(VALUE)",
  "created_at": 1595364201,
  "id": "c645e2f6-966f-48c0-91cf-6af27b968bbe",
  "tags": null,
  "username": "democonsumer"
}

Not sure but maybe some unit tests within Kong with resources mocked with nulls in them for optional fields and ensuring response as a string does not contain $(VALUE) ever will be helpful to avoid this in future.

cc @rsbrisci @gilmansean

To confirm, these are being observed on Cassandra, right?

@hishamhm Yes. Opps on my spare github account 馃榾 .

Was this page helpful?
0 / 5 - 0 ratings