-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable meta-tagging for redaction purposes
See https://protobuf.dev/news/2024-12-04/ PiperOrigin-RevId: 721507009
- Loading branch information
1 parent
080a983
commit 1f48795
Showing
5 changed files
with
221 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Test proto for redaction | ||
edition = "2023"; | ||
|
||
package protobuf_unittest; | ||
|
||
import "google/protobuf/any.proto"; | ||
import "google/protobuf/descriptor.proto"; | ||
|
||
option java_package = "com.google.protos"; | ||
option java_outer_classname = "RedactionProto"; | ||
option features.repeated_field_encoding = EXPANDED; | ||
option features.utf8_validation = NONE; | ||
|
||
extend .google.protobuf.FieldOptions { | ||
MetaAnnotatedEnum meta_annotated_enum = 535801413; | ||
repeated MetaAnnotatedEnum repeated_meta_annotated_enum = 535801414; | ||
TestNestedMessageEnum test_nested_message_enum = 535801415; | ||
} | ||
|
||
message TestRedactedNestMessage { | ||
string foo = 1; | ||
} | ||
|
||
message TestRepeatedRedactedNestMessage { | ||
string bar = 1; | ||
} | ||
|
||
message TestMessageEnum { | ||
repeated MetaAnnotatedEnum redactable_enum = 1; | ||
} | ||
|
||
message TestNestedMessageEnum { | ||
repeated MetaAnnotatedEnum direct_enum = 1; | ||
TestMessageEnum nested_enum = 2; | ||
string redacted_string = 3 [debug_redact = true]; | ||
} | ||
|
||
message TestRedactedMessage { | ||
string text_field = 1 [deprecated = true]; | ||
string meta_annotated = 8 [(meta_annotated_enum) = TEST_REDACTABLE]; | ||
string repeated_meta_annotated = 9 [ | ||
(protobuf_unittest.repeated_meta_annotated_enum) = TEST_NO_REDACT, | ||
(protobuf_unittest.repeated_meta_annotated_enum) = TEST_REDACTABLE | ||
]; | ||
string unredacted_repeated_annotations = 10 [ | ||
(protobuf_unittest.repeated_meta_annotated_enum) = TEST_NO_REDACT, | ||
(protobuf_unittest.repeated_meta_annotated_enum) = TEST_NO_REDACT_AGAIN | ||
]; | ||
string unreported_non_meta_debug_redact_field = 17 [debug_redact = true]; | ||
google.protobuf.Any any_field = 18 [debug_redact = true]; | ||
string redactable_false = 19 [(meta_annotated_enum) = TEST_REDACTABLE_FALSE]; | ||
string test_direct_message_enum = 22 | ||
[(protobuf_unittest.test_nested_message_enum) = { | ||
direct_enum: [ TEST_NO_REDACT, TEST_REDACTABLE ] | ||
}]; | ||
string test_nested_message_enum = 23 | ||
[(protobuf_unittest.test_nested_message_enum) = { | ||
nested_enum { redactable_enum: [ TEST_NO_REDACT, TEST_REDACTABLE ] } | ||
}]; | ||
string test_redacted_message_enum = 24 | ||
[(protobuf_unittest.test_nested_message_enum) = { | ||
redacted_string: "redacted_but_doesnt_redact" | ||
}]; | ||
} | ||
|
||
enum MetaAnnotatedEnum { | ||
TEST_NULL = 0; | ||
TEST_REDACTABLE = 1 [debug_redact = true]; | ||
TEST_NO_REDACT = 2; | ||
TEST_NO_REDACT_AGAIN = 3; | ||
TEST_REDACTABLE_FALSE = 4 [debug_redact = false]; | ||
} |