teleport/lib
Andrew Lytvynov cd2f4fceb7
Remove JSON schema validation (#6685)
* Remove JSON schema validation

Removing JSON schema validation from all resource unmarshalers.

--- what JSON schema gets us

Looking at the JSON schema spec and our usage, here are the supposed benefits:
- type validation - make sure incoming data uses the right types for the right fields
- required fields - make sure that mandatory fields are set
- defaulting - set defaults for fields
- documentation - schema definition for our API objects

Note that it does _not_ do:
- fail on unknown fields in data
- fail on a required field with an empty value

--- what replaces it

Based on the above, it may seem like JSON schema provides value.
But it's not the case, let's break it down one by one:
- type validation - unmarshaling JSON into a typed Go struct does this
- required fields - only checks that the field was provided, doesn't actually check that a value is set (e.g. `"name": ""` will pass the `required` check)
  - so it's pretty useless for any real validation
  - and we already have a separate place for proper validation - `CheckAndSetDefaults` methods
- defaulting - done in `CheckAndSetDefaults` methods
  - `Version` is the only annoying field, had to add it in a bunch of objects
- documentation - protobuf definitions are the source of truth for our API schema

--- the benefits

- performance - schema validation does a few rounds of `json.Marshal/Unmarshal` in addition to actual validation; now we simply skip all that
- maintenance - no need to keep protobuf and JSON schema definitions in sync anymore
- creating new API objects - one error-prone step removed
- (future) fewer dependencies - we can _almost_ remove the Go libraries for schema validation (one transient dependency keeping them around)

* Remove services.SkipValidation

No more JSON schema validation so this option is a noop.
2021-06-01 15:27:20 -07:00
..
asciitable Fix CLI content spoofing through access request reason 2021-03-01 22:14:10 +01:00
auth Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
backend Improve RFD 24 Dynamo migration efficiency and performance (#7012) 2021-05-27 22:19:56 +02:00
benchmark Refactor api package and docs to use pkg.go.dev effectively. (#6388) 2021-04-20 16:44:17 -07:00
bpf Move from BCC to libbpf with CO-RE. 2021-05-28 15:25:23 -07:00
cache Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
cgroup Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
client Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
config Stop registering a Kubernetes cluster named after the Teleport cluster (#6786) 2021-05-25 17:50:35 -07:00
defaults Add missing database cli flags (#6739) 2021-05-18 11:10:16 -07:00
events Fix variable shadowing error causing migration slowdown (#7097) 2021-05-31 22:34:54 +02:00
fixtures add support for encrypted saml assertions with a seperate x509 pair 2021-03-12 00:29:57 +01:00
fuzz Minor update to fuzzing README (#4889) 2020-11-18 11:56:01 -04:00
httplib Improve error message for timeout errors (#6343) 2021-04-26 08:39:07 -07:00
jwt Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
kube Support disconnect_expired_cert for database access (#6857) 2021-05-31 10:26:50 +02:00
labels Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
limiter Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
modules Forbids use of --insecure in FIPS mode (#6191) 2021-05-14 09:22:46 +10:00
multiplexer Updated TLS handshake timeout. 2021-05-04 16:41:07 -07:00
pam add PAM environment with interpolation support 2021-03-30 18:23:38 +02:00
plugin Add "billing_information" RBAC resource (#5676) 2021-03-01 22:47:03 -05:00
reversetunnel Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
secret Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
service Support disconnect_expired_cert for database access (#6857) 2021-05-31 10:26:50 +02:00
services Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
session Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
shell Refactor lib/asciitable, lib/tlsca, lib/shell, lib/session and lib/config tests to not use gocheck 2021-02-23 18:30:06 +01:00
srv Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
sshca Create single instance of keygen per process. Use cache of precomputed 2018-02-15 21:23:30 +00:00
sshutils lazy init of prometheus collectors (#6561) 2021-05-19 11:53:36 -04:00
system Map error to errno value and log it 2018-03-26 23:28:58 +02:00
teleagent Don't log error on tunnel node after its serving agent is stopped (#5042) 2020-12-11 17:39:19 +01:00
tlsca App access cli flow (#5918) 2021-03-22 09:18:53 -07:00
utils Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
web Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
runtimeflags.go Correct various typos 2017-10-20 10:20:26 +02:00