[GH-ISSUE #3769] [Feature Request] Disallow unknown keys in verify #2998

Closed
opened 2026-05-05 13:56:09 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @akx on GitHub (Nov 14, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3769

Describe the feature request

Related to #3757 (validating the configuration against a strict schema).

frpc verify doesn't validate the presence of extraneous/unknown keys in the document given, so typos are easily uncaught. Can you spot at least 4 in the document below? 😁

$ cat > config.json
{
  "serverAddr": "localhost",
  "serverPort": 7000,
  "auth": {
    "metho": "oidc"
  },
  "log": {
    "leverl": "trace"
  },
  "proxies": [
    {
      "name": "xxx",
      "type": "http",
      "localPort": 8888,
      "customDomains": [
        "xxx"
      ],
      "transpor": {
        "useEncrypion": true,
        "useCompression": true
      }
    }
  ]
}
$ ./frpc verify -c a.json
frpc: the configuration file a.json syntax is ok
$

Describe alternatives you've considered

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @akx on GitHub (Nov 14, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3769 ### Describe the feature request Related to #3757 (validating the configuration against a strict schema). `frpc verify` doesn't validate the presence of extraneous/unknown keys in the document given, so typos are easily uncaught. Can you spot at least 4 in the document below? 😁 ```shell $ cat > config.json { "serverAddr": "localhost", "serverPort": 7000, "auth": { "metho": "oidc" }, "log": { "leverl": "trace" }, "proxies": [ { "name": "xxx", "type": "http", "localPort": 8888, "customDomains": [ "xxx" ], "transpor": { "useEncrypion": true, "useCompression": true } } ] } $ ./frpc verify -c a.json frpc: the configuration file a.json syntax is ok $ ``` ### Describe alternatives you've considered _No response_ ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [X] User Experience - [ ] Test and Release - [X] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@fatedier commented on GitHub (Nov 15, 2023):

I think it is ok to add a --strict-mode option to enable this feature, with schema validation disabled by default.

<!-- gh-comment-id:1811737562 --> @fatedier commented on GitHub (Nov 15, 2023): I think it is ok to add a `--strict-mode` option to enable this feature, with schema validation disabled by default.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#2998
No description provided.