build.proto 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // Copyright 2018 The Grafeas Authors. All rights reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package grafeas.v1beta1.build;
  16. import "google/devtools/containeranalysis/v1beta1/provenance/provenance.proto";
  17. option go_package = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/build;build";
  18. option java_multiple_files = true;
  19. option java_package = "io.grafeas.v1beta1.build";
  20. option objc_class_prefix = "GRA";
  21. // Note holding the version of the provider's builder and the signature of the
  22. // provenance message in the build details occurrence.
  23. message Build {
  24. // Required. Immutable. Version of the builder which produced this build.
  25. string builder_version = 1;
  26. // Signature of the build in occurrences pointing to this build note
  27. // containing build details.
  28. BuildSignature signature = 2;
  29. }
  30. // Message encapsulating the signature of the verified build.
  31. message BuildSignature {
  32. // Public key of the builder which can be used to verify that the related
  33. // findings are valid and unchanged. If `key_type` is empty, this defaults
  34. // to PEM encoded public keys.
  35. //
  36. // This field may be empty if `key_id` references an external key.
  37. //
  38. // For Cloud Build based signatures, this is a PEM encoded public
  39. // key. To verify the Cloud Build signature, place the contents of
  40. // this field into a file (public.pem). The signature field is base64-decoded
  41. // into its binary representation in signature.bin, and the provenance bytes
  42. // from `BuildDetails` are base64-decoded into a binary representation in
  43. // signed.bin. OpenSSL can then verify the signature:
  44. // `openssl sha256 -verify public.pem -signature signature.bin signed.bin`
  45. string public_key = 1;
  46. // Required. Signature of the related `BuildProvenance`. In JSON, this is
  47. // base-64 encoded.
  48. bytes signature = 2;
  49. // An ID for the key used to sign. This could be either an ID for the key
  50. // stored in `public_key` (such as the ID or fingerprint for a PGP key, or the
  51. // CN for a cert), or a reference to an external key (such as a reference to a
  52. // key in Cloud Key Management Service).
  53. string key_id = 3;
  54. // Public key formats.
  55. enum KeyType {
  56. // `KeyType` is not set.
  57. KEY_TYPE_UNSPECIFIED = 0;
  58. // `PGP ASCII Armored` public key.
  59. PGP_ASCII_ARMORED = 1;
  60. // `PKIX PEM` public key.
  61. PKIX_PEM = 2;
  62. }
  63. // The type of the key, either stored in `public_key` or referenced in
  64. // `key_id`.
  65. KeyType key_type = 4;
  66. }
  67. // Details of a build occurrence.
  68. message Details {
  69. // Required. The actual provenance for the build.
  70. grafeas.v1beta1.provenance.BuildProvenance provenance = 1;
  71. // Serialized JSON representation of the provenance, used in generating the
  72. // build signature in the corresponding build note. After verifying the
  73. // signature, `provenance_bytes` can be unmarshalled and compared to the
  74. // provenance to confirm that it is unchanged. A base64-encoded string
  75. // representation of the provenance bytes is used for the signature in order
  76. // to interoperate with openssl which expects this format for signature
  77. // verification.
  78. //
  79. // The serialized form is captured both to avoid ambiguity in how the
  80. // provenance is marshalled to json as well to prevent incompatibilities with
  81. // future changes.
  82. string provenance_bytes = 2;
  83. }