github.com/google/capslock@v0.2.3-0.20240517042941-dac19fc347c0/proto/capability.proto (about) 1 // Copyright 2023 Google LLC 2 // 3 // Use of this source code is governed by a BSD-style 4 // license that can be found in the LICENSE file or at 5 // https://developers.google.com/open-source/licenses/bsd 6 7 syntax = "proto2"; 8 9 package capslock.proto; 10 11 option go_package = "github.com/google/capslock/proto"; 12 13 message CapabilityInfo { 14 // The name of the package. 15 optional string package_name = 1; 16 17 // Name associated with this capability. 18 optional Capability capability = 2; 19 20 // The dependency path to where the capability is incurred. 21 optional string dep_path = 3; 22 23 // The dependency path to where the capability is incurred. 24 // Each element is a single function or method. 25 repeated Function path = 6; 26 27 // The location of the package. 28 optional string package_dir = 4; 29 30 // Classification of how the capability was incurred. 31 optional CapabilityType capability_type = 5; 32 } 33 34 message Function { 35 optional string name = 1; 36 37 message Site { 38 optional string filename = 1; 39 optional int64 line = 2; 40 optional int64 column = 3; 41 } 42 optional Site site = 2; 43 } 44 45 message ModuleInfo { 46 optional string path = 1; 47 optional string version = 2; 48 } 49 50 message PackageInfo { 51 optional string path = 1; 52 53 // ignored_files contains a list of source files in the package directory 54 // that were ignored due to the build configuration and build tags. See 55 // https://pkg.go.dev/golang.org/x/tools/go/packages#Package.IgnoredFiles 56 // for more information. 57 repeated string ignored_files = 2; 58 } 59 60 message CapabilityInfoList { 61 // A list of CapabilityInfo protos. 62 repeated CapabilityInfo capability_info = 1; 63 repeated ModuleInfo module_info = 2; 64 repeated PackageInfo package_info = 3; 65 } 66 67 message CapabilityCountList { 68 // A list of capability counts. 69 map<string, int64> capability_counts = 1; 70 repeated ModuleInfo module_info = 2; 71 } 72 73 message CapabilityStats { 74 optional Capability capability = 1; 75 optional string description = 2; 76 optional int64 direct_count = 3; 77 optional int64 transitive_count = 4; 78 repeated Function example_callpath = 5; 79 optional int64 count = 6; 80 } 81 82 message CapabilityStatList { 83 repeated CapabilityStats capability_stats = 1; 84 repeated ModuleInfo module_info = 2; 85 } 86 87 // Next_id = 15 88 enum Capability { 89 CAPABILITY_UNSPECIFIED = 0; 90 CAPABILITY_SAFE = 1; 91 CAPABILITY_FILES = 2; 92 CAPABILITY_NETWORK = 3; 93 CAPABILITY_RUNTIME = 4; 94 CAPABILITY_READ_SYSTEM_STATE = 5; 95 CAPABILITY_MODIFY_SYSTEM_STATE = 6; 96 CAPABILITY_OPERATING_SYSTEM = 7; 97 CAPABILITY_SYSTEM_CALLS = 8; 98 CAPABILITY_ARBITRARY_EXECUTION = 9; 99 CAPABILITY_CGO = 10; 100 CAPABILITY_UNANALYZED = 11; 101 CAPABILITY_UNSAFE_POINTER = 12; 102 CAPABILITY_REFLECT = 13; 103 CAPABILITY_EXEC = 14; 104 } 105 106 // Next_id = 3 107 enum CapabilityType { 108 CAPABILITY_TYPE_UNSPECIFIED = 0; 109 CAPABILITY_TYPE_DIRECT = 1; 110 CAPABILITY_TYPE_TRANSITIVE = 2; 111 } 112 113