teleport/lib/auth
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
..
mocku2f mfa: device management API (#5456) 2021-02-03 10:12:25 -08:00
native API client connection overhaul (#5625) 2021-03-23 14:39:20 -07:00
test API client connection overhaul (#5625) 2021-03-23 14:39:20 -07:00
testauthority auth: API for requesting per-connection certificates (#5527) 2021-02-10 20:29:00 -08:00
u2f u2f: add optional attestation cert validation (#6057) 2021-03-23 15:14:31 -07:00
api.go Introduce SessionRecordingConfig extracting fields from ClusterConfig (#6708) 2021-05-19 12:01:37 -07:00
apiserver.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
apiserver_test.go gRPC conversions - Nodes (#6535) 2021-04-28 18:27:12 -07:00
auth.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
auth_test.go Introduce SessionRecordingConfig extracting fields from ClusterConfig (#6708) 2021-05-19 12:01:37 -07:00
auth_with_roles.go Allow users impersonating database service generate database certs (#7024) 2021-05-25 14:11:35 -07:00
auth_with_roles_test.go Allow users impersonating database service generate database certs (#7024) 2021-05-25 14:11:35 -07:00
clt.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
db.go Add app and db access flags to license (#5627) 2021-02-22 08:35:08 -08:00
github.go [web] Add ability to switchback to default roles/expiry (#6373) 2021-04-19 18:53:09 -07:00
github_test.go Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
grpcserver.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
grpcserver_test.go gRPC conversions - Nodes (#6535) 2021-04-28 18:27:12 -07:00
helpers.go Introduce SessionRecordingConfig extracting fields from ClusterConfig (#6708) 2021-05-19 12:01:37 -07:00
httpfallback.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
init.go Improve RFD 24 Dynamo migration efficiency and performance (#7012) 2021-05-27 22:19:56 +02:00
init_test.go Introduce SessionRecordingConfig extracting fields from ClusterConfig (#6708) 2021-05-19 12:01:37 -07:00
kube.go Propagate the mapped local user identity via auth.Context (#5794) 2021-03-01 21:55:59 +01:00
kube_test.go Propagate the mapped local user identity via auth.Context (#5794) 2021-03-01 21:55:59 +01:00
methods.go Add additional Prometheus Metrics (#6511) 2021-04-28 15:46:27 -07:00
middleware.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
middleware_test.go Introduce SessionRecordingConfig extracting fields from ClusterConfig (#6708) 2021-05-19 12:01:37 -07:00
oidc.go Log traits to role mapping warnings on case-insensitive matches (#6209) 2021-05-25 08:39:22 -07:00
oidc_test.go Move all utils.InitLoggerForTests calls to TestMain 2021-02-23 18:04:55 -08:00
password.go u2f: add optional attestation cert validation (#6057) 2021-03-23 15:14:31 -07:00
password_test.go Introduce SessionRecordingConfig extracting fields from ClusterConfig (#6708) 2021-05-19 12:01:37 -07:00
permissions.go Allow users impersonating database service generate database certs (#7024) 2021-05-25 14:11:35 -07:00
register.go Check CA expiration status when joining a cluster 2021-03-01 22:14:10 +01:00
resetpasswordtoken.go mfa: better OTP registration flow on CLI (#6567) 2021-04-27 10:42:16 -07:00
resetpasswordtoken_test.go mfa: audit events for adding/removing devices (#5665) 2021-03-04 11:02:35 -08:00
rotate.go api dependency reduction - ssh (#5379) 2021-01-29 10:28:24 -08:00
saml.go Log traits to role mapping warnings on case-insensitive matches (#6209) 2021-05-25 08:39:22 -07:00
saml_test.go add support for encrypted saml assertions with a seperate x509 pair 2021-03-12 00:29:57 +01:00
sessions.go Add app access headers rewrite (#6601) 2021-05-06 11:24:49 -07:00
state.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
state_unix.go Cleanup of dead code. 2019-07-02 18:01:44 -07:00
state_windows.go Build fixes to support Windows. 2019-05-07 14:17:11 -07:00
tls_test.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
trustedcluster.go Remove JSON schema validation (#6685) 2021-06-01 15:27:20 -07:00
trustedcluster_test.go Introduce SessionRecordingConfig extracting fields from ClusterConfig (#6708) 2021-05-19 12:01:37 -07:00
user.go Define cloud billing event types and codes (#6037) 2021-03-23 17:23:01 -07:00