line / centraldogma

Highly-available version-controlled service configuration repository based on Git, ZooKeeper and HTTP/2

Home Page:https://line.github.io/centraldogma/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Web UI cannot handle numbers larger than `Number.MAX_SAFE_INTEGER` in JSON files

KarboniteKream opened this issue · comments

If I try to create a JSON file, where a field has the value 9223372036854775807 (Long.MAX_VALUE), the UI displays it as 9223372036854776000.

Editing the file to replace this value with the original number displays the error You did not change anything when trying to save it. If I try to update the value with Long.MAX_VALUE - 1, the value is updated correctly (verified by looking at the API response), but the UI still displays 9223372036854776000.

It seems like this is caused by the value using JavaScript's Number instead of BigInt. I'm not sure this is a problem with the Central Dogma UI or some library it's using.

You can reproduce it by creating a file with the following contents:

{
  "test": 9223372036854775807
}

YAML files are unaffected:

test: 9223372036854775807

Interestingly, Firefox itself has the same issue when rendering fields in JSON responses:

image image

It seems like BigInt is not commonly supported (even Axios parses big integers in API responses incorrectly), so this could be difficult to solve properly.

References:

Let me check BigInt problem in the new webapp and fix the issue there if the new webapp can't handle big nubmers.