From 4dde05f38aac6bc5ac8e636a8419e45493009b90 Mon Sep 17 00:00:00 2001 From: Alan Parra Date: Fri, 17 May 2024 18:11:03 -0300 Subject: [PATCH 1/7] chore: Bump Buf to v1.32.0 --- build.assets/versions.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.assets/versions.mk b/build.assets/versions.mk index 20dd8b43b4265..93c05576f0d50 100644 --- a/build.assets/versions.mk +++ b/build.assets/versions.mk @@ -17,7 +17,7 @@ LIBPCSCLITE_VERSION ?= 1.9.9-teleport DEVTOOLSET ?= devtoolset-12 # Protogen related versions. -BUF_VERSION ?= v1.31.0 +BUF_VERSION ?= v1.32.0 # Keep in sync with api/proto/buf.yaml (and buf.lock). GOGO_PROTO_TAG ?= v1.3.2 NODE_GRPC_TOOLS_VERSION ?= 1.12.4 From edfc2ebf320e4ad5ed5466270b67d8c412c78846 Mon Sep 17 00:00:00 2001 From: Alan Parra Date: Fri, 17 May 2024 18:29:54 -0300 Subject: [PATCH 2/7] Fix buf.lock files --- api/proto/buf.lock | 2 ++ proto/buf.yaml | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/api/proto/buf.lock b/api/proto/buf.lock index 35a2cdf16b471..61b0d15e792f4 100644 --- a/api/proto/buf.lock +++ b/api/proto/buf.lock @@ -5,7 +5,9 @@ deps: owner: gogo repository: protobuf commit: 4df00b267f944190a229ce3695781e99 + digest: shake256:de60e0534d11dfd7a1817909618e847e15d4ab6f5cc6d71154a9735af651c7bda2232b33f3fb6a4daf23f64a3fe80270e99d42d77c551bb9a69ab5dc48ec2e04 - remote: buf.build owner: googleapis repository: googleapis commit: d1263fe26f8e430a967dc22a4d0cad18 + digest: shake256:203d3ce0c9ee172ecdf2bab909c2df02159f8d44823124545b39ef3a61e5b1aebe80e12a467d9684d804582e472ae34a729d71e08a09b830d69cc18608cd6745 diff --git a/proto/buf.yaml b/proto/buf.yaml index dedf088c8083a..272ad64472ac9 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -1,7 +1,4 @@ version: v1 -deps: - # gogo/protobuf v1.3.2, keep in sync with build.assets/Makefile. - - buf.build/gogo/protobuf:b03c65ea87cdc3521ede29f62fe3ce239267c1bc lint: use: - DEFAULT From 64d9f22ea0ba563d0121c5319cec436784f83217 Mon Sep 17 00:00:00 2001 From: Alan Parra Date: Fri, 17 May 2024 18:31:19 -0300 Subject: [PATCH 3/7] Update generated protos --- gen/proto/ts/google/protobuf/descriptor_pb.ts | 242 ++++++++++++++---- 1 file changed, 188 insertions(+), 54 deletions(-) diff --git a/gen/proto/ts/google/protobuf/descriptor_pb.ts b/gen/proto/ts/google/protobuf/descriptor_pb.ts index 5ede69fce7e97..7c9bf3394df2b 100644 --- a/gen/proto/ts/google/protobuf/descriptor_pb.ts +++ b/gen/proto/ts/google/protobuf/descriptor_pb.ts @@ -394,12 +394,12 @@ export interface FieldDescriptorProto { * If true, this is a proto3 "optional". When a proto3 field is optional, it * tracks presence regardless of field type. * - * When proto3_optional is true, this field must be belong to a oneof to - * signal to old proto3 clients that presence is tracked for this field. This - * oneof is known as a "synthetic" oneof, and this field must be its sole - * member (each proto3 optional field gets its own synthetic oneof). Synthetic - * oneofs exist in the descriptor only, and do not generate any API. Synthetic - * oneofs must be ordered after all "real" oneofs. + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. * * For message fields, proto3_optional doesn't create any semantic change, * since non-repeated message fields always track presence. However it still @@ -767,12 +767,16 @@ export interface FileOptions { */ javaGenerateEqualsAndHash?: boolean; /** - * If set true, then the Java2 code generator will generate code that - * throws an exception whenever an attempt is made to assign a non-UTF-8 - * byte sequence to a string field. - * Message reflection will do the same. - * However, an extension field still accepts non-UTF-8 byte sequences. - * This option has no effect on when used with the lite runtime. + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. * * @generated from protobuf field: optional bool java_string_check_utf8 = 27; */ @@ -814,10 +818,6 @@ export interface FileOptions { * @generated from protobuf field: optional bool py_generic_services = 18; */ pyGenericServices?: boolean; - /** - * @generated from protobuf field: optional bool php_generic_services = 42; - */ - phpGenericServices?: boolean; /** * Is this file deprecated? * Depending on the target platform, this can emit Deprecated annotations @@ -977,10 +977,6 @@ export interface MessageOptions { */ deprecated?: boolean; /** - * NOTE: Do not set the option in .proto files. Always use the maps syntax - * instead. The option should only be implicitly set by the proto compiler - * parser. - * * Whether the message is an automatically generated map entry type for the * maps field. * @@ -999,6 +995,10 @@ export interface MessageOptions { * The reflection APIs in such implementations still need to work as * if the field is a repeated message field. * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + * * @generated from protobuf field: optional bool map_entry = 7; */ mapEntry?: boolean; @@ -1092,19 +1092,11 @@ export interface FieldOptions { * call from multiple threads concurrently, while non-const methods continue * to require exclusive access. * - * Note that implementations may choose not to check required fields within - * a lazy sub-message. That is, calling IsInitialized() on the outer message - * may return true even if the inner message has missing required fields. - * This is necessary because otherwise the inner message would have to be - * parsed in order to perform the check, defeating the purpose of lazy - * parsing. An implementation which chooses not to check required fields - * must be consistent about it. That is, for any particular sub-message, the - * implementation must either *always* check its required fields, or *never* - * check its required fields, regardless of whether or not the message has - * been parsed. - * - * As of May 2022, lazy verifies the contents of the byte stream during - * parsing. An invalid byte stream will cause the overall parsing to fail. + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). * * @generated from protobuf field: optional bool lazy = 5; */ @@ -1157,6 +1149,10 @@ export interface FieldOptions { * @generated from protobuf field: optional google.protobuf.FeatureSet features = 21; */ features?: FeatureSet; + /** + * @generated from protobuf field: optional google.protobuf.FieldOptions.FeatureSupport feature_support = 22; + */ + featureSupport?: FieldOptions_FeatureSupport; /** * The parser stores options it doesn't recognize here. See above. * @@ -1177,6 +1173,43 @@ export interface FieldOptions_EditionDefault { */ value?: string; // Textproto value. } +/** + * Information about the support window of a feature. + * + * @generated from protobuf message google.protobuf.FieldOptions.FeatureSupport + */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + * + * @generated from protobuf field: optional google.protobuf.Edition edition_introduced = 1; + */ + editionIntroduced?: Edition; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + * + * @generated from protobuf field: optional google.protobuf.Edition edition_deprecated = 2; + */ + editionDeprecated?: Edition; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + * + * @generated from protobuf field: optional string deprecation_warning = 3; + */ + deprecationWarning?: string; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + * + * @generated from protobuf field: optional google.protobuf.Edition edition_removed = 4; + */ + editionRemoved?: Edition; +} /** * @generated from protobuf enum google.protobuf.FieldOptions.CType */ @@ -1649,13 +1682,13 @@ export enum FeatureSet_Utf8Validation { */ UTF8_VALIDATION_UNKNOWN = 0, /** - * @generated from protobuf enum value: NONE = 1; + * @generated from protobuf enum value: VERIFY = 2; */ - NONE = 1, + VERIFY = 2, /** - * @generated from protobuf enum value: VERIFY = 2; + * @generated from protobuf enum value: NONE = 3; */ - VERIFY = 2 + NONE = 3 } /** * @generated from protobuf enum google.protobuf.FeatureSet.MessageEncoding @@ -1733,9 +1766,17 @@ export interface FeatureSetDefaults_FeatureSetEditionDefault { */ edition?: Edition; /** - * @generated from protobuf field: optional google.protobuf.FeatureSet features = 2; + * Defaults of features that can be overridden in this edition. + * + * @generated from protobuf field: optional google.protobuf.FeatureSet overridable_features = 4; */ - features?: FeatureSet; + overridableFeatures?: FeatureSet; + /** + * Defaults of features that can't be overridden in this edition. + * + * @generated from protobuf field: optional google.protobuf.FeatureSet fixed_features = 5; + */ + fixedFeatures?: FeatureSet; } // =================================================================== // Optional source code info @@ -1805,7 +1846,7 @@ export interface SourceCodeInfo_Location { * location. * * Each element is a field number or an index. They form a path from - * the root FileDescriptorProto to the place where the definition occurs. + * the root FileDescriptorProto to the place where the definition appears. * For example, this path: * [ 4, 3, 2, 7, 1 ] * refers to: @@ -1990,6 +2031,13 @@ export enum Edition { * @generated from protobuf enum value: EDITION_UNKNOWN = 0; */ EDITION_UNKNOWN = 0, + /** + * A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + * + * @generated from protobuf enum value: EDITION_LEGACY = 900; + */ + EDITION_LEGACY = 900, /** * Legacy syntax "editions". These pre-date editions, but behave much like * distinct editions. These can't be used to specify the edition of proto @@ -2011,6 +2059,10 @@ export enum Edition { * @generated from protobuf enum value: EDITION_2023 = 1000; */ EDITION_2023 = 1000, + /** + * @generated from protobuf enum value: EDITION_2024 = 1001; + */ + EDITION_2024 = 1001, /** * Placeholder editions for testing feature resolution. These should not be * used or relyed on outside of tests. @@ -2033,7 +2085,15 @@ export enum Edition { /** * @generated from protobuf enum value: EDITION_99999_TEST_ONLY = 99999; */ - EDITION_99999_TEST_ONLY = 99999 + EDITION_99999_TEST_ONLY = 99999, + /** + * Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + * + * @generated from protobuf enum value: EDITION_MAX = 2147483647; + */ + EDITION_MAX = 2147483647 } // @generated message type with reflection information, may provide speed optimized methods class FileDescriptorSet$Type extends MessageType { @@ -3115,7 +3175,6 @@ class FileOptions$Type extends MessageType { { no: 16, name: "cc_generic_services", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, { no: 17, name: "java_generic_services", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, { no: 18, name: "py_generic_services", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, - { no: 42, name: "php_generic_services", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, { no: 23, name: "deprecated", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, { no: 31, name: "cc_enable_arenas", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, { no: 36, name: "objc_class_prefix", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, @@ -3171,9 +3230,6 @@ class FileOptions$Type extends MessageType { case /* optional bool py_generic_services */ 18: message.pyGenericServices = reader.bool(); break; - case /* optional bool php_generic_services */ 42: - message.phpGenericServices = reader.bool(); - break; case /* optional bool deprecated */ 23: message.deprecated = reader.bool(); break; @@ -3249,9 +3305,6 @@ class FileOptions$Type extends MessageType { /* optional bool py_generic_services = 18; */ if (message.pyGenericServices !== undefined) writer.tag(18, WireType.Varint).bool(message.pyGenericServices); - /* optional bool php_generic_services = 42; */ - if (message.phpGenericServices !== undefined) - writer.tag(42, WireType.Varint).bool(message.phpGenericServices); /* optional bool deprecated = 23; */ if (message.deprecated !== undefined) writer.tag(23, WireType.Varint).bool(message.deprecated); @@ -3400,6 +3453,7 @@ class FieldOptions$Type extends MessageType { { no: 19, name: "targets", kind: "enum", repeat: 2 /*RepeatType.UNPACKED*/, T: () => ["google.protobuf.FieldOptions.OptionTargetType", FieldOptions_OptionTargetType] }, { no: 20, name: "edition_defaults", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => FieldOptions_EditionDefault }, { no: 21, name: "features", kind: "message", T: () => FeatureSet }, + { no: 22, name: "feature_support", kind: "message", T: () => FieldOptions_FeatureSupport }, { no: 999, name: "uninterpreted_option", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => UninterpretedOption } ]); } @@ -3457,6 +3511,9 @@ class FieldOptions$Type extends MessageType { case /* optional google.protobuf.FeatureSet features */ 21: message.features = FeatureSet.internalBinaryRead(reader, reader.uint32(), options, message.features); break; + case /* optional google.protobuf.FieldOptions.FeatureSupport feature_support */ 22: + message.featureSupport = FieldOptions_FeatureSupport.internalBinaryRead(reader, reader.uint32(), options, message.featureSupport); + break; case /* repeated google.protobuf.UninterpretedOption uninterpreted_option */ 999: message.uninterpretedOption.push(UninterpretedOption.internalBinaryRead(reader, reader.uint32(), options)); break; @@ -3508,6 +3565,9 @@ class FieldOptions$Type extends MessageType { /* optional google.protobuf.FeatureSet features = 21; */ if (message.features) FeatureSet.internalBinaryWrite(message.features, writer.tag(21, WireType.LengthDelimited).fork(), options).join(); + /* optional google.protobuf.FieldOptions.FeatureSupport feature_support = 22; */ + if (message.featureSupport) + FieldOptions_FeatureSupport.internalBinaryWrite(message.featureSupport, writer.tag(22, WireType.LengthDelimited).fork(), options).join(); /* repeated google.protobuf.UninterpretedOption uninterpreted_option = 999; */ for (let i = 0; i < message.uninterpretedOption.length; i++) UninterpretedOption.internalBinaryWrite(message.uninterpretedOption[i], writer.tag(999, WireType.LengthDelimited).fork(), options).join(); @@ -3575,6 +3635,73 @@ class FieldOptions_EditionDefault$Type extends MessageType { + constructor() { + super("google.protobuf.FieldOptions.FeatureSupport", [ + { no: 1, name: "edition_introduced", kind: "enum", opt: true, T: () => ["google.protobuf.Edition", Edition] }, + { no: 2, name: "edition_deprecated", kind: "enum", opt: true, T: () => ["google.protobuf.Edition", Edition] }, + { no: 3, name: "deprecation_warning", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, + { no: 4, name: "edition_removed", kind: "enum", opt: true, T: () => ["google.protobuf.Edition", Edition] } + ]); + } + create(value?: PartialMessage): FieldOptions_FeatureSupport { + const message = globalThis.Object.create((this.messagePrototype!)); + if (value !== undefined) + reflectionMergePartial(this, message, value); + return message; + } + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: FieldOptions_FeatureSupport): FieldOptions_FeatureSupport { + let message = target ?? this.create(), end = reader.pos + length; + while (reader.pos < end) { + let [fieldNo, wireType] = reader.tag(); + switch (fieldNo) { + case /* optional google.protobuf.Edition edition_introduced */ 1: + message.editionIntroduced = reader.int32(); + break; + case /* optional google.protobuf.Edition edition_deprecated */ 2: + message.editionDeprecated = reader.int32(); + break; + case /* optional string deprecation_warning */ 3: + message.deprecationWarning = reader.string(); + break; + case /* optional google.protobuf.Edition edition_removed */ 4: + message.editionRemoved = reader.int32(); + break; + default: + let u = options.readUnknownField; + if (u === "throw") + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); + let d = reader.skip(wireType); + if (u !== false) + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); + } + } + return message; + } + internalBinaryWrite(message: FieldOptions_FeatureSupport, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { + /* optional google.protobuf.Edition edition_introduced = 1; */ + if (message.editionIntroduced !== undefined) + writer.tag(1, WireType.Varint).int32(message.editionIntroduced); + /* optional google.protobuf.Edition edition_deprecated = 2; */ + if (message.editionDeprecated !== undefined) + writer.tag(2, WireType.Varint).int32(message.editionDeprecated); + /* optional string deprecation_warning = 3; */ + if (message.deprecationWarning !== undefined) + writer.tag(3, WireType.LengthDelimited).string(message.deprecationWarning); + /* optional google.protobuf.Edition edition_removed = 4; */ + if (message.editionRemoved !== undefined) + writer.tag(4, WireType.Varint).int32(message.editionRemoved); + let u = options.writeUnknownFields; + if (u !== false) + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); + return writer; + } +} +/** + * @generated MessageType for protobuf message google.protobuf.FieldOptions.FeatureSupport + */ +export const FieldOptions_FeatureSupport = new FieldOptions_FeatureSupport$Type(); +// @generated message type with reflection information, may provide speed optimized methods class OneofOptions$Type extends MessageType { constructor() { super("google.protobuf.OneofOptions", [ @@ -4191,7 +4318,8 @@ class FeatureSetDefaults_FeatureSetEditionDefault$Type extends MessageType ["google.protobuf.Edition", Edition] }, - { no: 2, name: "features", kind: "message", T: () => FeatureSet } + { no: 4, name: "overridable_features", kind: "message", T: () => FeatureSet }, + { no: 5, name: "fixed_features", kind: "message", T: () => FeatureSet } ]); } create(value?: PartialMessage): FeatureSetDefaults_FeatureSetEditionDefault { @@ -4208,8 +4336,11 @@ class FeatureSetDefaults_FeatureSetEditionDefault$Type extends MessageType Date: Mon, 20 May 2024 13:33:37 -0300 Subject: [PATCH 4/7] Run `buf config migrate` --- api/proto/buf.lock | 13 ------ api/proto/buf.yaml | 65 ---------------------------- buf.lock | 9 ++++ buf.work.yaml | 4 -- buf.yaml | 105 +++++++++++++++++++++++++++++++++++++++++++++ proto/buf.yaml | 63 --------------------------- 6 files changed, 114 insertions(+), 145 deletions(-) delete mode 100644 api/proto/buf.lock delete mode 100644 api/proto/buf.yaml create mode 100644 buf.lock delete mode 100644 buf.work.yaml create mode 100644 buf.yaml delete mode 100644 proto/buf.yaml diff --git a/api/proto/buf.lock b/api/proto/buf.lock deleted file mode 100644 index 61b0d15e792f4..0000000000000 --- a/api/proto/buf.lock +++ /dev/null @@ -1,13 +0,0 @@ -# Generated by buf. DO NOT EDIT. -version: v1 -deps: - - remote: buf.build - owner: gogo - repository: protobuf - commit: 4df00b267f944190a229ce3695781e99 - digest: shake256:de60e0534d11dfd7a1817909618e847e15d4ab6f5cc6d71154a9735af651c7bda2232b33f3fb6a4daf23f64a3fe80270e99d42d77c551bb9a69ab5dc48ec2e04 - - remote: buf.build - owner: googleapis - repository: googleapis - commit: d1263fe26f8e430a967dc22a4d0cad18 - digest: shake256:203d3ce0c9ee172ecdf2bab909c2df02159f8d44823124545b39ef3a61e5b1aebe80e12a467d9684d804582e472ae34a729d71e08a09b830d69cc18608cd6745 diff --git a/api/proto/buf.yaml b/api/proto/buf.yaml deleted file mode 100644 index dbc4011a20b84..0000000000000 --- a/api/proto/buf.yaml +++ /dev/null @@ -1,65 +0,0 @@ -version: v1 -deps: - # gogo/protobuf v1.3.2, keep in sync with build.assets/Makefile. - - buf.build/gogo/protobuf:b03c65ea87cdc3521ede29f62fe3ce239267c1bc - - buf.build/googleapis/googleapis:beb34b4050abfcfff72ff5cc6a28f0afa4043ce0 -lint: - use: - - DEFAULT - - PACKAGE_NO_IMPORT_CYCLE - - UNARY_RPC - # Top-level types require comments. - - COMMENT_ENUM - - COMMENT_MESSAGE - - COMMENT_RPC - - COMMENT_SERVICE - except: - # Allow Google API-style responses (CreateFoo returns Foo). - # See https://cloud.google.com/apis/design/standard_methods. - - RPC_REQUEST_RESPONSE_UNIQUE - - RPC_RESPONSE_STANDARD_NAME - ignore: - - teleport/legacy/client/proto/authservice.proto - - teleport/legacy/client/proto/certs.proto - - teleport/legacy/client/proto/event.proto - - teleport/legacy/client/proto/proxyservice.proto - - teleport/legacy/types/events/events.proto - - teleport/legacy/types/events/athena.proto - - teleport/legacy/types/types.proto - - teleport/legacy/types/wrappers/wrappers.proto - ignore_only: - # Allow package/directory mismatch for legacy protos. - FIELD_LOWER_SNAKE_CASE: - - teleport/legacy/types/device.proto - # Allow package/directory mismatch for legacy protos. - PACKAGE_DIRECTORY_MATCH: - - teleport/legacy/client/proto/joinservice.proto - - teleport/legacy/types/device.proto - - teleport/legacy/types/webauthn/webauthn.proto - # Allow non-versioned packages for legacy protos. - PACKAGE_VERSION_SUFFIX: - - teleport/legacy/client/proto/joinservice.proto - - teleport/legacy/types/device.proto - - teleport/legacy/types/webauthn/webauthn.proto - # Allow only certain services to use streaming RPCs. - # - # We should avoid streaming RPCs until we have a compelling reason to use them (e.g. the - # implementation needs 1-N messages or the server cannot dial directly to the client). - # - # Check out the links below. If you still have questions or doubts, reach out to @codingllama. - # - # https://docs.buf.build/lint/rules#unary_rpc - # https://github.com/gravitational/teleport/pull/16043#issuecomment-1235728212 - # https://github.com/twitchtv/twirp/issues/70#issuecomment-470367807 - UNARY_RPC: - - teleport/devicetrust/v1/devicetrust_service.proto - - teleport/legacy/client/proto/joinservice.proto - - teleport/transport/v1/transport_service.proto - - teleport/auditlog/v1/auditlog.proto -breaking: - use: - - WIRE_JSON - - ENUM_VALUE_NO_DELETE - ignore_only: - RESERVED_ENUM_NO_DELETE: - - teleport/legacy/types/types.proto diff --git a/buf.lock b/buf.lock new file mode 100644 index 0000000000000..7166a198d65a7 --- /dev/null +++ b/buf.lock @@ -0,0 +1,9 @@ +# Generated by buf. DO NOT EDIT. +version: v2 +deps: + - name: buf.build/gogo/protobuf + commit: 4df00b267f944190a229ce3695781e99 + digest: b5:f3c59023c8f0138b9262ec9755f9f090d330842d98171b559538c0db2c2aa367879527b8da893b443eb80ba36c7d4102713f9fb5233ca12682cb2a9883442c09 + - name: buf.build/googleapis/googleapis + commit: d1263fe26f8e430a967dc22a4d0cad18 + digest: b5:8e44f92843e3866793af18ae6b1d4e78e2d537353c267a2d4d362c104e037d2d3b651c46cf19b163be8765162c777eb1abbe2c1e35a33c1f0df11a7ce42e1b85 diff --git a/buf.work.yaml b/buf.work.yaml deleted file mode 100644 index ed56c80c50ae3..0000000000000 --- a/buf.work.yaml +++ /dev/null @@ -1,4 +0,0 @@ -version: v1 -directories: - - api/proto - - proto diff --git a/buf.yaml b/buf.yaml new file mode 100644 index 0000000000000..424045c191136 --- /dev/null +++ b/buf.yaml @@ -0,0 +1,105 @@ +version: v2 +modules: + - path: api/proto + lint: + use: + - COMMENT_ENUM + - COMMENT_MESSAGE + - COMMENT_RPC + - COMMENT_SERVICE + - DEFAULT + - PACKAGE_NO_IMPORT_CYCLE + - UNARY_RPC + except: + - FIELD_NOT_REQUIRED + - RPC_REQUEST_RESPONSE_UNIQUE + - RPC_RESPONSE_STANDARD_NAME + ignore: + - api/proto/teleport/legacy/client/proto/authservice.proto + - api/proto/teleport/legacy/client/proto/certs.proto + - api/proto/teleport/legacy/client/proto/event.proto + - api/proto/teleport/legacy/client/proto/proxyservice.proto + - api/proto/teleport/legacy/types/events/athena.proto + - api/proto/teleport/legacy/types/events/events.proto + - api/proto/teleport/legacy/types/types.proto + - api/proto/teleport/legacy/types/wrappers/wrappers.proto + ignore_only: + FIELD_LOWER_SNAKE_CASE: + - api/proto/teleport/legacy/types/device.proto + PACKAGE_DIRECTORY_MATCH: + - api/proto/teleport/legacy/client/proto/joinservice.proto + - api/proto/teleport/legacy/types/device.proto + - api/proto/teleport/legacy/types/webauthn/webauthn.proto + PACKAGE_VERSION_SUFFIX: + - api/proto/teleport/legacy/client/proto/joinservice.proto + - api/proto/teleport/legacy/types/device.proto + - api/proto/teleport/legacy/types/webauthn/webauthn.proto + UNARY_RPC: + - api/proto/teleport/auditlog/v1/auditlog.proto + - api/proto/teleport/devicetrust/v1/devicetrust_service.proto + - api/proto/teleport/legacy/client/proto/joinservice.proto + - api/proto/teleport/transport/v1/transport_service.proto + disallow_comment_ignores: true + breaking: + use: + - ENUM_VALUE_NO_DELETE + - WIRE_JSON + except: + - FIELD_SAME_DEFAULT + ignore_only: + RESERVED_ENUM_NO_DELETE: + - api/proto/teleport/legacy/types/types.proto + - path: proto + lint: + use: + - COMMENT_ENUM + - COMMENT_MESSAGE + - COMMENT_RPC + - COMMENT_SERVICE + - DEFAULT + - PACKAGE_NO_IMPORT_CYCLE + - UNARY_RPC + except: + - FIELD_NOT_REQUIRED + - RPC_REQUEST_RESPONSE_UNIQUE + - RPC_RESPONSE_STANDARD_NAME + ignore: + - proto/teleport/lib/multiplexer/test/ping.proto + - proto/teleport/lib/web/envelope.proto + ignore_only: + COMMENT_MESSAGE: + - proto/prehog + - proto/teleport/lib/teleterm/v1/access_request.proto + - proto/teleport/lib/teleterm/v1/app.proto + - proto/teleport/lib/teleterm/v1/auth_settings.proto + - proto/teleport/lib/teleterm/v1/cluster.proto + - proto/teleport/lib/teleterm/v1/database.proto + - proto/teleport/lib/teleterm/v1/gateway.proto + - proto/teleport/lib/teleterm/v1/kube.proto + - proto/teleport/lib/teleterm/v1/label.proto + - proto/teleport/lib/teleterm/v1/server.proto + - proto/teleport/lib/teleterm/v1/service.proto + - proto/teleport/lib/teleterm/v1/tshd_events_service.proto + - proto/teleport/lib/teleterm/v1/usage_events.proto + COMMENT_RPC: + - proto/prehog + COMMENT_SERVICE: + - proto/prehog + RPC_REQUEST_STANDARD_NAME: + - proto/teleport/lib/teleterm/v1/service.proto + UNARY_RPC: + - proto/accessgraph/v1alpha/access_graph_service.proto + - proto/teleport/lib/teleterm/v1/service.proto + disallow_comment_ignores: true + breaking: + use: + - ENUM_VALUE_NO_DELETE + - WIRE_JSON + except: + - FIELD_SAME_DEFAULT + ignore_only: + RESERVED_ENUM_NO_DELETE: + - proto/teleport/legacy/types/types.proto +deps: + - buf.build/gogo/protobuf:b03c65ea87cdc3521ede29f62fe3ce239267c1bc + - buf.build/googleapis/googleapis:beb34b4050abfcfff72ff5cc6a28f0afa4043ce0 diff --git a/proto/buf.yaml b/proto/buf.yaml deleted file mode 100644 index 272ad64472ac9..0000000000000 --- a/proto/buf.yaml +++ /dev/null @@ -1,63 +0,0 @@ -version: v1 -lint: - use: - - DEFAULT - - PACKAGE_NO_IMPORT_CYCLE - - UNARY_RPC - # Top-level types require comments. - - COMMENT_ENUM - - COMMENT_MESSAGE - - COMMENT_RPC - - COMMENT_SERVICE - except: - # Allow Google API-style responses (CreateFoo returns Foo). - # See https://cloud.google.com/apis/design/standard_methods. - - RPC_REQUEST_RESPONSE_UNIQUE - - RPC_RESPONSE_STANDARD_NAME - ignore: - # "legacy" lib protos. - - teleport/lib/multiplexer/test/ping.proto - - teleport/lib/web/envelope.proto - ignore_only: - # Allow only certain services to use streaming RPCs. - # - # We should avoid streaming RPCs until we have a compelling reason to use them (e.g. the - # implementation needs 1-N messages or the server cannot dial directly to the client). - # - # Check out the links below. If you still have questions or doubts, reach out to @codingllama. - # - # https://docs.buf.build/lint/rules#unary_rpc - # https://github.com/gravitational/teleport/pull/16043#issuecomment-1235728212 - # https://github.com/twitchtv/twirp/issues/70#issuecomment-470367807 - UNARY_RPC: - - teleport/lib/teleterm/v1/service.proto - - accessgraph/v1alpha/access_graph_service.proto - # TODO(ravicious): Fix protos and re-enable lib/teleterm lint rules below. - RPC_REQUEST_STANDARD_NAME: - - teleport/lib/teleterm/v1/service.proto - # TODO(espadolini): Fix protos and re-enable prehog lint rules below. - COMMENT_MESSAGE: - - prehog - - teleport/lib/teleterm/v1/access_request.proto - - teleport/lib/teleterm/v1/app.proto - - teleport/lib/teleterm/v1/auth_settings.proto - - teleport/lib/teleterm/v1/cluster.proto - - teleport/lib/teleterm/v1/database.proto - - teleport/lib/teleterm/v1/gateway.proto - - teleport/lib/teleterm/v1/kube.proto - - teleport/lib/teleterm/v1/label.proto - - teleport/lib/teleterm/v1/server.proto - - teleport/lib/teleterm/v1/service.proto - - teleport/lib/teleterm/v1/tshd_events_service.proto - - teleport/lib/teleterm/v1/usage_events.proto - COMMENT_RPC: - - prehog - COMMENT_SERVICE: - - prehog -breaking: - use: - - WIRE_JSON - - ENUM_VALUE_NO_DELETE - ignore_only: - RESERVED_ENUM_NO_DELETE: - - teleport/legacy/types/types.proto From 0969eeb707f1e5aef866e3f651a42dfcc872a9df Mon Sep 17 00:00:00 2001 From: Alan Parra Date: Mon, 20 May 2024 13:35:52 -0300 Subject: [PATCH 5/7] Manually edit buf.yaml to cut duplication --- buf.yaml | 176 ++++++++++++++++++++++++------------------------------- 1 file changed, 78 insertions(+), 98 deletions(-) diff --git a/buf.yaml b/buf.yaml index 424045c191136..9655c01233119 100644 --- a/buf.yaml +++ b/buf.yaml @@ -1,105 +1,85 @@ version: v2 + modules: - path: api/proto - lint: - use: - - COMMENT_ENUM - - COMMENT_MESSAGE - - COMMENT_RPC - - COMMENT_SERVICE - - DEFAULT - - PACKAGE_NO_IMPORT_CYCLE - - UNARY_RPC - except: - - FIELD_NOT_REQUIRED - - RPC_REQUEST_RESPONSE_UNIQUE - - RPC_RESPONSE_STANDARD_NAME - ignore: - - api/proto/teleport/legacy/client/proto/authservice.proto - - api/proto/teleport/legacy/client/proto/certs.proto - - api/proto/teleport/legacy/client/proto/event.proto - - api/proto/teleport/legacy/client/proto/proxyservice.proto - - api/proto/teleport/legacy/types/events/athena.proto - - api/proto/teleport/legacy/types/events/events.proto - - api/proto/teleport/legacy/types/types.proto - - api/proto/teleport/legacy/types/wrappers/wrappers.proto - ignore_only: - FIELD_LOWER_SNAKE_CASE: - - api/proto/teleport/legacy/types/device.proto - PACKAGE_DIRECTORY_MATCH: - - api/proto/teleport/legacy/client/proto/joinservice.proto - - api/proto/teleport/legacy/types/device.proto - - api/proto/teleport/legacy/types/webauthn/webauthn.proto - PACKAGE_VERSION_SUFFIX: - - api/proto/teleport/legacy/client/proto/joinservice.proto - - api/proto/teleport/legacy/types/device.proto - - api/proto/teleport/legacy/types/webauthn/webauthn.proto - UNARY_RPC: - - api/proto/teleport/auditlog/v1/auditlog.proto - - api/proto/teleport/devicetrust/v1/devicetrust_service.proto - - api/proto/teleport/legacy/client/proto/joinservice.proto - - api/proto/teleport/transport/v1/transport_service.proto - disallow_comment_ignores: true - breaking: - use: - - ENUM_VALUE_NO_DELETE - - WIRE_JSON - except: - - FIELD_SAME_DEFAULT - ignore_only: - RESERVED_ENUM_NO_DELETE: - - api/proto/teleport/legacy/types/types.proto - path: proto - lint: - use: - - COMMENT_ENUM - - COMMENT_MESSAGE - - COMMENT_RPC - - COMMENT_SERVICE - - DEFAULT - - PACKAGE_NO_IMPORT_CYCLE - - UNARY_RPC - except: - - FIELD_NOT_REQUIRED - - RPC_REQUEST_RESPONSE_UNIQUE - - RPC_RESPONSE_STANDARD_NAME - ignore: - - proto/teleport/lib/multiplexer/test/ping.proto - - proto/teleport/lib/web/envelope.proto - ignore_only: - COMMENT_MESSAGE: - - proto/prehog - - proto/teleport/lib/teleterm/v1/access_request.proto - - proto/teleport/lib/teleterm/v1/app.proto - - proto/teleport/lib/teleterm/v1/auth_settings.proto - - proto/teleport/lib/teleterm/v1/cluster.proto - - proto/teleport/lib/teleterm/v1/database.proto - - proto/teleport/lib/teleterm/v1/gateway.proto - - proto/teleport/lib/teleterm/v1/kube.proto - - proto/teleport/lib/teleterm/v1/label.proto - - proto/teleport/lib/teleterm/v1/server.proto - - proto/teleport/lib/teleterm/v1/service.proto - - proto/teleport/lib/teleterm/v1/tshd_events_service.proto - - proto/teleport/lib/teleterm/v1/usage_events.proto - COMMENT_RPC: - - proto/prehog - COMMENT_SERVICE: - - proto/prehog - RPC_REQUEST_STANDARD_NAME: - - proto/teleport/lib/teleterm/v1/service.proto - UNARY_RPC: - - proto/accessgraph/v1alpha/access_graph_service.proto - - proto/teleport/lib/teleterm/v1/service.proto - disallow_comment_ignores: true - breaking: - use: - - ENUM_VALUE_NO_DELETE - - WIRE_JSON - except: - - FIELD_SAME_DEFAULT - ignore_only: - RESERVED_ENUM_NO_DELETE: - - proto/teleport/legacy/types/types.proto + deps: + # gogo/protobuf v1.3.2, keep in sync with build.assets/versions.mk. - buf.build/gogo/protobuf:b03c65ea87cdc3521ede29f62fe3ce239267c1bc - buf.build/googleapis/googleapis:beb34b4050abfcfff72ff5cc6a28f0afa4043ce0 + +lint: + use: + - COMMENT_ENUM + - COMMENT_MESSAGE + - COMMENT_RPC + - COMMENT_SERVICE + - DEFAULT + - PACKAGE_NO_IMPORT_CYCLE + - UNARY_RPC + except: + - FIELD_NOT_REQUIRED + - RPC_REQUEST_RESPONSE_UNIQUE + - RPC_RESPONSE_STANDARD_NAME + ignore: + - api/proto/teleport/legacy/client/proto/authservice.proto + - api/proto/teleport/legacy/client/proto/certs.proto + - api/proto/teleport/legacy/client/proto/event.proto + - api/proto/teleport/legacy/client/proto/proxyservice.proto + - api/proto/teleport/legacy/types/events/athena.proto + - api/proto/teleport/legacy/types/events/events.proto + - api/proto/teleport/legacy/types/types.proto + - api/proto/teleport/legacy/types/wrappers/wrappers.proto + - proto/teleport/lib/multiplexer/test/ping.proto + - proto/teleport/lib/web/envelope.proto + ignore_only: + COMMENT_MESSAGE: + - proto/prehog + - proto/teleport/lib/teleterm/v1/access_request.proto + - proto/teleport/lib/teleterm/v1/app.proto + - proto/teleport/lib/teleterm/v1/auth_settings.proto + - proto/teleport/lib/teleterm/v1/cluster.proto + - proto/teleport/lib/teleterm/v1/database.proto + - proto/teleport/lib/teleterm/v1/gateway.proto + - proto/teleport/lib/teleterm/v1/kube.proto + - proto/teleport/lib/teleterm/v1/label.proto + - proto/teleport/lib/teleterm/v1/server.proto + - proto/teleport/lib/teleterm/v1/service.proto + - proto/teleport/lib/teleterm/v1/tshd_events_service.proto + - proto/teleport/lib/teleterm/v1/usage_events.proto + COMMENT_RPC: + - proto/prehog + COMMENT_SERVICE: + - proto/prehog + FIELD_LOWER_SNAKE_CASE: + - api/proto/teleport/legacy/types/device.proto + PACKAGE_DIRECTORY_MATCH: + - api/proto/teleport/legacy/client/proto/joinservice.proto + - api/proto/teleport/legacy/types/device.proto + - api/proto/teleport/legacy/types/webauthn/webauthn.proto + PACKAGE_VERSION_SUFFIX: + - api/proto/teleport/legacy/client/proto/joinservice.proto + - api/proto/teleport/legacy/types/device.proto + - api/proto/teleport/legacy/types/webauthn/webauthn.proto + RPC_REQUEST_STANDARD_NAME: + - proto/teleport/lib/teleterm/v1/service.proto + UNARY_RPC: + - api/proto/teleport/auditlog/v1/auditlog.proto + - api/proto/teleport/devicetrust/v1/devicetrust_service.proto + - api/proto/teleport/legacy/client/proto/joinservice.proto + - api/proto/teleport/transport/v1/transport_service.proto + - proto/accessgraph/v1alpha/access_graph_service.proto + - proto/teleport/lib/teleterm/v1/service.proto + disallow_comment_ignores: true + +breaking: + use: + - ENUM_VALUE_NO_DELETE + - WIRE_JSON + except: + - FIELD_SAME_DEFAULT + ignore_only: + RESERVED_ENUM_NO_DELETE: + - api/proto/teleport/legacy/types/types.proto + - proto/teleport/legacy/types/types.proto From 5d8f99fc208be9124d8feeee9150a9b5bb60009b Mon Sep 17 00:00:00 2001 From: Alan Parra Date: Mon, 20 May 2024 13:28:25 -0300 Subject: [PATCH 6/7] Move buf-legacy.yaml to the project root --- Makefile | 2 +- api/proto/buf-legacy.yaml => buf-legacy.yaml | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename api/proto/buf-legacy.yaml => buf-legacy.yaml (100%) diff --git a/Makefile b/Makefile index 9e0b3f58d8cb2..02ab1378920a4 100644 --- a/Makefile +++ b/Makefile @@ -1352,7 +1352,7 @@ protos/format: buf/installed .PHONY: protos/lint protos/lint: buf/installed $(BUF) lint - $(BUF) lint --config=api/proto/buf-legacy.yaml api/proto + $(BUF) lint --config=buf-legacy.yaml api/proto .PHONY: protos/breaking protos/breaking: BASE=origin/master diff --git a/api/proto/buf-legacy.yaml b/buf-legacy.yaml similarity index 100% rename from api/proto/buf-legacy.yaml rename to buf-legacy.yaml From b9fd02c880aace48baf4c700ff4aa8253ac14f93 Mon Sep 17 00:00:00 2001 From: Alan Parra Date: Mon, 20 May 2024 13:31:59 -0300 Subject: [PATCH 7/7] Migrate buf-legacy.yaml to v2 --- buf-legacy.yaml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/buf-legacy.yaml b/buf-legacy.yaml index f458acb516663..f932112d37bd1 100644 --- a/buf-legacy.yaml +++ b/buf-legacy.yaml @@ -1,7 +1,16 @@ -version: v1 +# buf-legacy.yaml is used so we can apply tighter settings to legacy protos. +# This should be used exclusively to lint legacy protos, all other actions +# should use the default buf.yaml file. +version: v2 + +modules: + - path: api/proto + deps: - # gogo/protobuf v1.3.2, keep in sync with build.assets/Makefile. + # gogo/protobuf v1.3.2, keep in sync with build.assets/versions.mk. - buf.build/gogo/protobuf:b03c65ea87cdc3521ede29f62fe3ce239267c1bc + - buf.build/googleapis/googleapis:beb34b4050abfcfff72ff5cc6a28f0afa4043ce0 + lint: use: - DEFAULT @@ -26,6 +35,7 @@ lint: - RPC_REQUEST_RESPONSE_UNIQUE - RPC_REQUEST_STANDARD_NAME - RPC_RESPONSE_STANDARD_NAME + breaking: use: - "buf-legacy.yaml should not be used for buf breaking"