Skip to content

Find, verify, and analyze leaked credentials

[Feat] DigitalOcean Analyzer (#3932)

Abdul Basit03e8af1075a7
diff --git a/pkg/analyzer/analyzers/analyzers.go b/pkg/analyzer/analyzers/analyzers.go
index 489486f19..505a62b40 100644
--- a/pkg/analyzer/analyzers/analyzers.go
+++ b/pkg/analyzer/analyzers/analyzers.go
@@ -85,37 +85,39 @@ const (
AnalyzerTypePrivateKey
AnalyzerTypeNotion
AnalyzerTypeAirtable
+ AnalyzerTypeDigitalOcean
// Add new items here with AnalyzerType prefix
)
// analyzerTypeStrings maps the enum to its string representation.
var analyzerTypeStrings = map[AnalyzerType]string{
- AnalyzerTypeInvalid: "Invalid",
- AnalyzerTypeAirbrake: "Airbrake",
- AnalyzerTypeAirtable: "Airtable",
- AnalyzerAnthropic: "Anthropic",
- AnalyzerTypeAsana: "Asana",
- AnalyzerTypeBitbucket: "Bitbucket",
- AnalyzerTypeDockerHub: "DockerHub",
- AnalyzerTypeGitHub: "GitHub",
- AnalyzerTypeGitLab: "GitLab",
- AnalyzerTypeHuggingFace: "HuggingFace",
- AnalyzerTypeMailchimp: "Mailchimp",
- AnalyzerTypeMailgun: "Mailgun",
- AnalyzerTypeMySQL: "MySQL",
- AnalyzerTypeOpenAI: "OpenAI",
- AnalyzerTypeOpsgenie: "Opsgenie",
- AnalyzerTypePostgres: "Postgres",
- AnalyzerTypePostman: "Postman",
- AnalyzerTypeSendgrid: "Sendgrid",
- AnalyzerTypeShopify: "Shopify",
- AnalyzerTypeSlack: "Slack",
- AnalyzerTypeSourcegraph: "Sourcegraph",
- AnalyzerTypeSquare: "Square",
- AnalyzerTypeStripe: "Stripe",
- AnalyzerTypeTwilio: "Twilio",
- AnalyzerTypePrivateKey: "PrivateKey",
- AnalyzerTypeNotion: "Notion",
+ AnalyzerTypeInvalid: "Invalid",
+ AnalyzerTypeAirbrake: "Airbrake",
+ AnalyzerTypeAirtable: "Airtable",
+ AnalyzerAnthropic: "Anthropic",
+ AnalyzerTypeAsana: "Asana",
+ AnalyzerTypeBitbucket: "Bitbucket",
+ AnalyzerTypeDockerHub: "DockerHub",
+ AnalyzerTypeGitHub: "GitHub",
+ AnalyzerTypeGitLab: "GitLab",
+ AnalyzerTypeHuggingFace: "HuggingFace",
+ AnalyzerTypeMailchimp: "Mailchimp",
+ AnalyzerTypeMailgun: "Mailgun",
+ AnalyzerTypeMySQL: "MySQL",
+ AnalyzerTypeOpenAI: "OpenAI",
+ AnalyzerTypeOpsgenie: "Opsgenie",
+ AnalyzerTypePostgres: "Postgres",
+ AnalyzerTypePostman: "Postman",
+ AnalyzerTypeSendgrid: "Sendgrid",
+ AnalyzerTypeShopify: "Shopify",
+ AnalyzerTypeSlack: "Slack",
+ AnalyzerTypeSourcegraph: "Sourcegraph",
+ AnalyzerTypeSquare: "Square",
+ AnalyzerTypeStripe: "Stripe",
+ AnalyzerTypeTwilio: "Twilio",
+ AnalyzerTypePrivateKey: "PrivateKey",
+ AnalyzerTypeNotion: "Notion",
+ AnalyzerTypeDigitalOcean: "DigitalOcean",
// Add new mappings here
}
diff --git a/pkg/analyzer/analyzers/digitalocean/digitalocean.go b/pkg/analyzer/analyzers/digitalocean/digitalocean.go
new file mode 100644
index 000000000..3e3233ab3
--- /dev/null
+++ b/pkg/analyzer/analyzers/digitalocean/digitalocean.go
@@ -0,0 +1,303 @@
+//go:generate generate_permissions permissions.yaml permissions.go digitalocean
+
+package digitalocean
+
+import (
+ "bytes"
+ _ "embed"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io"
+ "net/http"
+ "os"
+ "sync"
+
+ "github.com/fatih/color"
+ "github.com/jedib0t/go-pretty/v6/table"
+ "github.com/trufflesecurity/trufflehog/v3/pkg/analyzer/analyzers"
+ "github.com/trufflesecurity/trufflehog/v3/pkg/analyzer/config"
+ "github.com/trufflesecurity/trufflehog/v3/pkg/context"
+)
+
+var _ analyzers.Analyzer = (*Analyzer)(nil)
+
+// to avoid rate limiting
+const MAX_CONCURRENT_TESTS = 10
+
+type Analyzer struct {
+ Cfg *config.Config
+}
+
+func (Analyzer) Type() analyzers.AnalyzerType { return analyzers.AnalyzerTypeDigitalOcean }
+
+func (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analyzers.AnalyzerResult, error) {
+ key, ok := credInfo["key"]
+ if !ok {
+ return nil, errors.New("missing key in credInfo")
+ }
+ info, err := AnalyzePermissions(a.Cfg, key)
+ if err != nil {
+ return nil, err
+ }
+ return secretInfoToAnalyzerResult(info), nil
+}
+
+func secretInfoToAnalyzerResult(info *SecretInfo) *analyzers.AnalyzerResult {
+ if info == nil {
+ return nil
+ }
+ result := analyzers.AnalyzerResult{
+ AnalyzerType: analyzers.AnalyzerTypeDigitalOcean,
+ Metadata: nil,
+ Bindings: make([]analyzers.Binding, len(info.Permissions)),
+ }
+
+ resource := analyzers.Resource{
+ Name: info.User.Name,
+ FullyQualifiedName: info.User.UUID,
+ Type: "User",
+ Metadata: map[string]any{
+ "email": info.User.Email,
+ "status": info.User.Status,
+ },
+ }
+
+ for idx, permission := range info.Permissions {
+ result.Bindings[idx] = analyzers.Binding{
+ Resource: resource,
+ Permission: analyzers.Permission{
+ Value: permission,
+ },
+ }
+ }
+
+ return &result
+}
+
+//go:embed scopes.json
+var scopesConfig []byte
+
+type HttpStatusTest struct {
+ Endpoint string `json:"endpoint"`
+ Method string `json:"method"`
+ Payload interface{} `json:"payload"`
+ ValidStatuses []int `json:"valid_status_code"`
+ InvalidStatuses []int `json:"invalid_status_code"`
+}
+
+func StatusContains(status int, vals []int) bool {
+ for _, v := range vals {
+ if status == v {
+ return true
+ }
+ }
+ return false
+}
+
+func (h *HttpStatusTest) RunTest(cfg *config.Config, headers map[string]string) (bool, error) {
+ // If body data, marshal to JSON
+ var data io.Reader
+ if h.Payload != nil {
+ jsonData, err := json.Marshal(h.Payload)
+ if err != nil {
+ return false, err
+ }
+ data = bytes.NewBuffer(jsonData)
+ }
+
+ client := analyzers.NewAnalyzeClient(cfg)
+
+ req, err := http.NewRequest(h.Method, h.Endpoint, data)
+ if err != nil {
+ return false, err
+ }
+
+ // Add custom headers if provided
+ for key, value := range headers {
+ req.Header.Set(key, value)
+ }
+
+ // Execute HTTP Request
+ resp, err := client.Do(req)
+ if err != nil {
+ return false, err
+ }
+ defer resp.Body.Close()
+
+ // Check response status code
+ switch {
+ case StatusContains(resp.StatusCode, h.ValidStatuses):
+ return true, nil
+ case StatusContains(resp.StatusCode, h.InvalidStatuses):
+ return false, nil
+ default:
+ return false, errors.New("error checking response status code")
+ }
+}
+
+type Scope struct {
+ Name string `json:"name"`
+ HttpTest HttpStatusTest `json:"test"`
+}
+
+func readInScopes() ([]Scope, error) {
+ var scopes []Scope
+ if err := json.Unmarshal(scopesConfig, &scopes); err != nil {
+ return nil, err
+ }
+
+ return scopes, nil
+}
+
+func checkPermissions(cfg *config.Config, key string) ([]string, error) {
+ scopes, err := readInScopes()
+ if err != nil {
+ return nil, fmt.Errorf("reading in scopes: %w", err)
+ }
+
+ var (
+ permissions = make([]string, 0, len(scopes))
+ mu sync.Mutex
+ wg sync.WaitGroup
+ slots = make(chan struct{}, MAX_CONCURRENT_TESTS)
+ errCh = make(chan error, 1)
+ )
+
+ for _, scope := range scopes {
+ wg.Add(1)
+ go func(scope Scope) {
+ defer wg.Done()
+
+ // acquire a slot
+ slots <- struct{}{}
+ defer func() { <-slots }()
+
+ status, err := scope.HttpTest.RunTest(cfg, map[string]string{"Authorization": "Bearer " + key})
+ if err != nil {
+ // send first error and ignore the rest
+ select {
+ case errCh <- fmt.Errorf("Scope %s: %w", scope.Name, err):
+ default:
+ }
+ return
+ }
+ if status {
+ mu.Lock()
+ permissions = append(permissions, scope.Name)
+ mu.Unlock()
+ }
+ }(scope)
+ }
+
+ // wait for all goroutines to finish or an error to occur
+ go func() {
+ wg.Wait()
+ close(errCh)
+ }()
+
+ if err := <-errCh; err != nil {
+ return nil, err
+ }
+
+ return permissions, nil
+}
+
+type user struct {
+ Email string `json:"email"`
+ Name string `json:"name"`
+ UUID string `json:"uuid"`
+ Status string `json:"status"`
+}
+
+type userJSON struct {
+ Account user `json:"account"`
+}
+
+func getUser(cfg *config.Config, token string) (*user, error) {
+ // Create new HTTP request
+ client := analyzers.NewAnalyzeClient(cfg)
+ req, err := http.NewRequest("GET", "https://api.digitalocean.com/v2/account", nil)
+ if err != nil {
+ return nil, err
+ }
+
+ // Add custom headers if provided
+ req.Header.Set("Authorization", "Bearer "+token)
+
+ // Execute HTTP Request
+ resp, err := client.Do(req)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ switch resp.StatusCode {
+ case http.StatusOK:
+ // Decode response body
+ var response userJSON
+ err = json.NewDecoder(resp.Body).Decode(&response)
+ if err != nil {
+ return nil, err
+ }
+
+ return &response.Account, nil
+ case http.StatusUnauthorized:
+ return nil, errors.New("invalid token")
+ default:
+ return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode)
+ }
+}
+
+type SecretInfo struct {
+ User user
+ Permissions []string
+}
+
+func AnalyzeAndPrintPermissions(cfg *config.Config, key string) {
+ info, err := AnalyzePermissions(cfg, key)
+ if err != nil {
+ color.Red("[x] Error : %s", err.Error())
+ return
+ }
+
+ color.Green("[!] Valid DigitalOcean API key\n\n")
+
+ color.Yellow("[i] User: %s (%s)\n\n", info.User.Name, info.User.Email)
+
+ printPermissions(info.Permissions)
+}
+
+func AnalyzePermissions(cfg *config.Config, key string) (*SecretInfo, error) {
+ var info = &SecretInfo{}
+
+ user, err := getUser(cfg, key)
+ if err != nil {
+ return nil, err
+ }
+ info.User = *user
+
+ permissions, err := checkPermissions(cfg, key)
+ if err != nil {
+ return nil, err
+ }
+
+ if len(permissions) == 0 {
+ return nil, fmt.Errorf("invalid DigitalOcean API key")
+ }
+
+ info.Permissions = permissions
+
+ return info, nil
+}
+
+func printPermissions(permissions []string) {
+ color.Yellow("[i] Permissions:")
+ t := table.NewWriter()
+ t.SetOutputMirror(os.Stdout)
+ t.AppendHeader(table.Row{"Permission"})
+ for _, permission := range permissions {
+ t.AppendRow(table.Row{color.GreenString(permission)})
+ }
+ t.Render()
+}
diff --git a/pkg/analyzer/analyzers/digitalocean/digitalocean_test.go b/pkg/analyzer/analyzers/digitalocean/digitalocean_test.go
new file mode 100644
index 000000000..894b3eb0b
--- /dev/null
+++ b/pkg/analyzer/analyzers/digitalocean/digitalocean_test.go
@@ -0,0 +1,100 @@
+package digitalocean
+
+import (
+ _ "embed"
+ "encoding/json"
+ "sort"
+ "testing"
+ "time"
+
+ "github.com/trufflesecurity/trufflehog/v3/pkg/analyzer/analyzers"
+ "github.com/trufflesecurity/trufflehog/v3/pkg/analyzer/config"
+ "github.com/trufflesecurity/trufflehog/v3/pkg/common"
+ "github.com/trufflesecurity/trufflehog/v3/pkg/context"
+)
+
+//go:embed expected_output.json
+var expectedOutput []byte
+
+func TestAnalyzer_Analyze(t *testing.T) {
+ ctx, cancel := context.WithTimeout(context.Background(), time.Second*15)
+ defer cancel()
+ testSecrets, err := common.GetSecret(ctx, "trufflehog-testing", "detectors3")
+ if err != nil {
+ t.Fatalf("could not get test secrets from GCP: %s", err)
+ }
+
+ tests := []struct {
+ name string
+ key string
+ want string // JSON string
+ wantErr bool
+ }{
+ {
+ name: "valid digitalocean key",
+ key: testSecrets.MustGetField("DIGITALOCEAN_PERSONAL_ACCESS_TOKEN"),
+ want: string(expectedOutput),
+ wantErr: false,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ a := Analyzer{Cfg: &config.Config{}}
+ got, err := a.Analyze(ctx, map[string]string{"key": tt.key})
+ if (err != nil) != tt.wantErr {
+ t.Errorf("Analyzer.Analyze() error = %v, wantErr %v", err, tt.wantErr)
+ return
+ }
+
+ // bindings need to be in the same order to be comparable
+ sortBindings(got.Bindings)
+
+ // Marshal the actual result to JSON
+ gotJSON, err := json.Marshal(got)
+ if err != nil {
+ t.Fatalf("could not marshal got to JSON: %s", err)
+ }
+
+ // Parse the expected JSON string
+ var wantObj analyzers.AnalyzerResult
+ if err := json.Unmarshal([]byte(tt.want), &wantObj); err != nil {
+ t.Fatalf("could not unmarshal want JSON string: %s", err)
+ }
+
+ // bindings need to be in the same order to be comparable
+ sortBindings(wantObj.Bindings)
+
+ // Marshal the expected result to JSON (to normalize)
+ wantJSON, err := json.Marshal(wantObj)
+ if err != nil {
+ t.Fatalf("could not marshal want to JSON: %s", err)
+ }
+
+ // Compare the JSON strings
+ if string(gotJSON) != string(wantJSON) {
+ // Pretty-print both JSON strings for easier comparison
+ var gotIndented, wantIndented []byte
+ gotIndented, err = json.MarshalIndent(got, "", " ")
+ if err != nil {
+ t.Fatalf("could not marshal got to indented JSON: %s", err)
+ }
+ wantIndented, err = json.MarshalIndent(wantObj, "", " ")
+ if err != nil {
+ t.Fatalf("could not marshal want to indented JSON: %s", err)
+ }
+ t.Errorf("Analyzer.Analyze() = %s, want %s", gotIndented, wantIndented)
+ }
+ })
+ }
+}
+
+// Helper function to sort bindings
+func sortBindings(bindings []analyzers.Binding) {
+ sort.SliceStable(bindings, func(i, j int) bool {
+ if bindings[i].Resource.Name == bindings[j].Resource.Name {
+ return bindings[i].Permission.Value < bindings[j].Permission.Value
+ }
+ return bindings[i].Resource.Name < bindings[j].Resource.Name
+ })
+}
diff --git a/pkg/analyzer/analyzers/digitalocean/expected_output.json b/pkg/analyzer/analyzers/digitalocean/expected_output.json
new file mode 100644
index 000000000..3f31c861b
--- /dev/null
+++ b/pkg/analyzer/analyzers/digitalocean/expected_output.json
@@ -0,0 +1 @@
+{"AnalyzerType":26,"Bindings":[{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"action:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"app:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"billing:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"block_storage:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"cdn_endpoint:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"certificate:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"container_registry:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"database:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"domain:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"domain_record:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"droplet:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"droplet_autoscale_pool:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"firewall:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"floating_ip:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"genai_agent:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"image:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"kubernetes:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"load_balancer:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"monitoring:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"namespace:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"one_click:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"project:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"region:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"reserved_ip:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"size:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"snapshot:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"ssh_key:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"tag:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"uptime:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"vpc:read","Parent":null}},{"Resource":{"Name":"sevoma","FullyQualifiedName":"f87d96c58bcc938176acebb04ac9450bbe113cca","Type":"User","Metadata":{"email":"[email protected]","status":"active"},"Parent":null},"Permission":{"Value":"vpc_peering:read","Parent":null}}],"UnboundedResources":null,"Metadata":null}
\ No newline at end of file
diff --git a/pkg/analyzer/analyzers/digitalocean/permissions.go b/pkg/analyzer/analyzers/digitalocean/permissions.go
new file mode 100644
index 000000000..a168203e8
--- /dev/null
+++ b/pkg/analyzer/analyzers/digitalocean/permissions.go
@@ -0,0 +1,546 @@
+// Code generated by go generate; DO NOT EDIT.
+package digitalocean
+
+import "errors"
+
+type Permission int
+
+const (
+ Invalid Permission = iota
+ OneClickRead Permission = iota
+ OneClickCreate Permission = iota
+ ActionRead Permission = iota
+ AppRead Permission = iota
+ AppCreate Permission = iota
+ AppUpdate Permission = iota
+ AppDelete Permission = iota
+ BillingRead Permission = iota
+ BlockStorageRead Permission = iota
+ BlockStorageCreate Permission = iota
+ BlockStorageDelete Permission = iota
+ CdnEndpointRead Permission = iota
+ CdnEndpointCreate Permission = iota
+ CdnEndpointUpdate Permission = iota
+ CdnEndpointDelete Permission = iota
+ CertificateRead Permission = iota
+ CertificateCreate Permission = iota
+ CertificateDelete Permission = iota
+ ContainerRegistryRead Permission = iota
+ ContainerRegistryCreate Permission = iota
+ DatabaseRead Permission = iota
+ DatabaseCreate Permission = iota
+ DatabaseUpdate Permission = iota
+ DatabaseDelete Permission = iota
+ DomainRecordRead Permission = iota
+ DomainRecordCreate Permission = iota
+ DomainRecordUpdate Permission = iota
+ DomainRecordDelete Permission = iota
+ DomainRead Permission = iota
+ DomainCreate Permission = iota
+ DomainDelete Permission = iota
+ DropletRead Permission = iota
+ DropletCreate Permission = iota
+ DropletDelete Permission = iota
+ DropletAutoscalePoolRead Permission = iota
+ DropletAutoscalePoolCreate Permission = iota
+ DropletAutoscalePoolUpdate Permission = iota
+ DropletAutoscalePoolDelete Permission = iota
+ FirewallRead Permission = iota
+ FirewallCreate Permission = iota
+ FirewallUpdate Permission = iota
+ FirewallDelete Permission = iota
+ FloatingIpRead Permission = iota
+ FloatingIpCreate Permission = iota
+ FloatingIpDelete Permission = iota
+ NamespaceRead Permission = iota
+ NamespaceCreate Permission = iota
+ NamespaceDelete Permission = iota
+ GenaiAgentRead Permission = iota
+ GenaiAgentCreate Permission = iota
+ GenaiAgentUpdate Permission = iota
+ GenaiAgentDelete Permission = iota
+ ImageRead Permission = iota
+ ImageCreate Permission = iota
+ ImageUpdate Permission = iota
+ ImageDelete Permission = iota
+ KubernetesRead Permission = iota
+ KubernetesCreate Permission = iota
+ KubernetesUpdate Permission = iota
+ KubernetesDelete Permission = iota
+ LoadBalancerRead Permission = iota
+ LoadBalancerCreate Permission = iota
+ LoadBalancerUpdate Permission = iota
+ LoadBalancerDelete Permission = iota
+ MonitoringRead Permission = iota
+ MonitoringCreate Permission = iota
+ MonitoringUpdate Permission = iota
+ MonitoringDelete Permission = iota
+ ProjectRead Permission = iota
+ ProjectCreate Permission = iota
+ ProjectUpdate Permission = iota
+ ProjectDelete Permission = iota
+ RegionRead Permission = iota
+ ReservedIpRead Permission = iota
+ ReservedIpCreate Permission = iota
+ ReservedIpDelete Permission = iota
+ SizeRead Permission = iota
+ SnapshotRead Permission = iota
+ SnapshotDelete Permission = iota
+ SshKeyRead Permission = iota
+ SshKeyCreate Permission = iota
+ SshKeyUpdate Permission = iota
+ SshKeyDelete Permission = iota
+ TagRead Permission = iota
+ TagCreate Permission = iota
+ TagDelete Permission = iota
+ UptimeRead Permission = iota
+ UptimeCreate Permission = iota
+ UptimeUpdate Permission = iota
+ UptimeDelete Permission = iota
+ VpcPeeringRead Permission = iota
+ VpcPeeringCreate Permission = iota
+ VpcPeeringUpdate Permission = iota
+ VpcPeeringDelete Permission = iota
+ VpcRead Permission = iota
+ VpcCreate Permission = iota
+ VpcUpdate Permission = iota
+ VpcDelete Permission = iota
+)
+
+var (
+ PermissionStrings = map[Permission]string{
+ OneClickRead: "one_click:read",
+ OneClickCreate: "one_click:create",
+ ActionRead: "action:read",
+ AppRead: "app:read",
+ AppCreate: "app:create",
+ AppUpdate: "app:update",
+ AppDelete: "app:delete",
+ BillingRead: "billing:read",
+ BlockStorageRead: "block_storage:read",
+ BlockStorageCreate: "block_storage:create",
+ BlockStorageDelete: "block_storage:delete",
+ CdnEndpointRead: "cdn_endpoint:read",
+ CdnEndpointCreate: "cdn_endpoint:create",
+ CdnEndpointUpdate: "cdn_endpoint:update",
+ CdnEndpointDelete: "cdn_endpoint:delete",
+ CertificateRead: "certificate:read",
+ CertificateCreate: "certificate:create",
+ CertificateDelete: "certificate:delete",
+ ContainerRegistryRead: "container_registry:read",
+ ContainerRegistryCreate: "container_registry:create",
+ DatabaseRead: "database:read",
+ DatabaseCreate: "database:create",
+ DatabaseUpdate: "database:update",
+ DatabaseDelete: "database:delete",
+ DomainRecordRead: "domain_record:read",
+ DomainRecordCreate: "domain_record:create",
+ DomainRecordUpdate: "domain_record:update",
+ DomainRecordDelete: "domain_record:delete",
+ DomainRead: "domain:read",
+ DomainCreate: "domain:create",
+ DomainDelete: "domain:delete",
+ DropletRead: "droplet:read",
+ DropletCreate: "droplet:create",
+ DropletDelete: "droplet:delete",
+ DropletAutoscalePoolRead: "droplet_autoscale_pool:read",
+ DropletAutoscalePoolCreate: "droplet_autoscale_pool:create",
+ DropletAutoscalePoolUpdate: "droplet_autoscale_pool:update",
+ DropletAutoscalePoolDelete: "droplet_autoscale_pool:delete",
+ FirewallRead: "firewall:read",
+ FirewallCreate: "firewall:create",
+ FirewallUpdate: "firewall:update",
+ FirewallDelete: "firewall:delete",
+ FloatingIpRead: "floating_ip:read",
+ FloatingIpCreate: "floating_ip:create",
+ FloatingIpDelete: "floating_ip:delete",
+ NamespaceRead: "namespace:read",
+ NamespaceCreate: "namespace:create",
+ NamespaceDelete: "namespace:delete",
+ GenaiAgentRead: "genai_agent:read",
+ GenaiAgentCreate: "genai_agent:create",
+ GenaiAgentUpdate: "genai_agent:update",
+ GenaiAgentDelete: "genai_agent:delete",
+ ImageRead: "image:read",
+ ImageCreate: "image:create",
+ ImageUpdate: "image:update",
+ ImageDelete: "image:delete",
+ KubernetesRead: "kubernetes:read",
+ KubernetesCreate: "kubernetes:create",
+ KubernetesUpdate: "kubernetes:update",
+ KubernetesDelete: "kubernetes:delete",
+ LoadBalancerRead: "load_balancer:read",
+ LoadBalancerCreate: "load_balancer:create",
+ LoadBalancerUpdate: "load_balancer:update",
+ LoadBalancerDelete: "load_balancer:delete",
+ MonitoringRead: "monitoring:read",
+ MonitoringCreate: "monitoring:create",
+ MonitoringUpdate: "monitoring:update",
+ MonitoringDelete: "monitoring:delete",
+ ProjectRead: "project:read",
+ ProjectCreate: "project:create",
+ ProjectUpdate: "project:update",
+ ProjectDelete: "project:delete",
+ RegionRead: "region:read",
+ ReservedIpRead: "reserved_ip:read",
+ ReservedIpCreate: "reserved_ip:create",
+ ReservedIpDelete: "reserved_ip:delete",
+ SizeRead: "size:read",
+ SnapshotRead: "snapshot:read",
+ SnapshotDelete: "snapshot:delete",
+ SshKeyRead: "ssh_key:read",
+ SshKeyCreate: "ssh_key:create",
+ SshKeyUpdate: "ssh_key:update",
+ SshKeyDelete: "ssh_key:delete",
+ TagRead: "tag:read",
+ TagCreate: "tag:create",
+ TagDelete: "tag:delete",
+ UptimeRead: "uptime:read",
+ UptimeCreate: "uptime:create",
+ UptimeUpdate: "uptime:update",
+ UptimeDelete: "uptime:delete",
+ VpcPeeringRead: "vpc_peering:read",
+ VpcPeeringCreate: "vpc_peering:create",
+ VpcPeeringUpdate: "vpc_peering:update",
+ VpcPeeringDelete: "vpc_peering:delete",
+ VpcRead: "vpc:read",
+ VpcCreate: "vpc:create",
+ VpcUpdate: "vpc:update",
+ VpcDelete: "vpc:delete",
+ }
+
+ StringToPermission = map[string]Permission{
+ "one_click:read": OneClickRead,
+ "one_click:create": OneClickCreate,
+ "action:read": ActionRead,
+ "app:read": AppRead,
+ "app:create": AppCreate,
+ "app:update": AppUpdate,
+ "app:delete": AppDelete,
+ "billing:read": BillingRead,
+ "block_storage:read": BlockStorageRead,
+ "block_storage:create": BlockStorageCreate,
+ "block_storage:delete": BlockStorageDelete,
+ "cdn_endpoint:read": CdnEndpointRead,
+ "cdn_endpoint:create": CdnEndpointCreate,
+ "cdn_endpoint:update": CdnEndpointUpdate,
+ "cdn_endpoint:delete": CdnEndpointDelete,
+ "certificate:read": CertificateRead,
+ "certificate:create": CertificateCreate,
+ "certificate:delete": CertificateDelete,
+ "container_registry:read": ContainerRegistryRead,
+ "container_registry:create": ContainerRegistryCreate,
+ "database:read": DatabaseRead,
+ "database:create": DatabaseCreate,
+ "database:update": DatabaseUpdate,
+ "database:delete": DatabaseDelete,
+ "domain_record:read": DomainRecordRead,
+ "domain_record:create": DomainRecordCreate,
+ "domain_record:update": DomainRecordUpdate,
+ "domain_record:delete": DomainRecordDelete,
+ "domain:read": DomainRead,
+ "domain:create": DomainCreate,
+ "domain:delete": DomainDelete,
+ "droplet:read": DropletRead,
+ "droplet:create": DropletCreate,
+ "droplet:delete": DropletDelete,
+ "droplet_autoscale_pool:read": DropletAutoscalePoolRead,
+ "droplet_autoscale_pool:create": DropletAutoscalePoolCreate,
+ "droplet_autoscale_pool:update": DropletAutoscalePoolUpdate,
+ "droplet_autoscale_pool:delete": DropletAutoscalePoolDelete,
+ "firewall:read": FirewallRead,
+ "firewall:create": FirewallCreate,
+ "firewall:update": FirewallUpdate,
+ "firewall:delete": FirewallDelete,
+ "floating_ip:read": FloatingIpRead,
+ "floating_ip:create": FloatingIpCreate,
+ "floating_ip:delete": FloatingIpDelete,
+ "namespace:read": NamespaceRead,
+ "namespace:create": NamespaceCreate,
+ "namespace:delete": NamespaceDelete,
+ "genai_agent:read": GenaiAgentRead,
+ "genai_agent:create": GenaiAgentCreate,
+ "genai_agent:update": GenaiAgentUpdate,
+ "genai_agent:delete": GenaiAgentDelete,
+ "image:read": ImageRead,
+ "image:create": ImageCreate,
+ "image:update": ImageUpdate,
+ "image:delete": ImageDelete,
+ "kubernetes:read": KubernetesRead,
+ "kubernetes:create": KubernetesCreate,
+ "kubernetes:update": KubernetesUpdate,
+ "kubernetes:delete": KubernetesDelete,
+ "load_balancer:read": LoadBalancerRead,
+ "load_balancer:create": LoadBalancerCreate,
+ "load_balancer:update": LoadBalancerUpdate,
+ "load_balancer:delete": LoadBalancerDelete,
+ "monitoring:read": MonitoringRead,
+ "monitoring:create": MonitoringCreate,
+ "monitoring:update": MonitoringUpdate,
+ "monitoring:delete": MonitoringDelete,
+ "project:read": ProjectRead,
+ "project:create": ProjectCreate,
+ "project:update": ProjectUpdate,
+ "project:delete": ProjectDelete,
+ "region:read": RegionRead,
+ "reserved_ip:read": ReservedIpRead,
+ "reserved_ip:create": ReservedIpCreate,
+ "reserved_ip:delete": ReservedIpDelete,
+ "size:read": SizeRead,
+ "snapshot:read": SnapshotRead,
+ "snapshot:delete": SnapshotDelete,
+ "ssh_key:read": SshKeyRead,
+ "ssh_key:create": SshKeyCreate,
+ "ssh_key:update": SshKeyUpdate,
+ "ssh_key:delete": SshKeyDelete,
+ "tag:read": TagRead,
+ "tag:create": TagCreate,
+ "tag:delete": TagDelete,
+ "uptime:read": UptimeRead,
+ "uptime:create": UptimeCreate,
+ "uptime:update": UptimeUpdate,
+ "uptime:delete": UptimeDelete,
+ "vpc_peering:read": VpcPeeringRead,
+ "vpc_peering:create": VpcPeeringCreate,
+ "vpc_peering:update": VpcPeeringUpdate,
+ "vpc_peering:delete": VpcPeeringDelete,
+ "vpc:read": VpcRead,
+ "vpc:create": VpcCreate,
+ "vpc:update": VpcUpdate,
+ "vpc:delete": VpcDelete,
+ }
+
+ PermissionIDs = map[Permission]int{
+ OneClickRead: 1,
+ OneClickCreate: 2,
+ ActionRead: 3,
+ AppRead: 4,
+ AppCreate: 5,
+ AppUpdate: 6,
+ AppDelete: 7,
+ BillingRead: 8,
+ BlockStorageRead: 9,
+ BlockStorageCreate: 10,
+ BlockStorageDelete: 11,
+ CdnEndpointRead: 12,
+ CdnEndpointCreate: 13,
+ CdnEndpointUpdate: 14,
+ CdnEndpointDelete: 15,
+ CertificateRead: 16,
+ CertificateCreate: 17,
+ CertificateDelete: 18,
+ ContainerRegistryRead: 19,
+ ContainerRegistryCreate: 20,
+ DatabaseRead: 21,
+ DatabaseCreate: 22,
+ DatabaseUpdate: 23,
+ DatabaseDelete: 24,
+ DomainRecordRead: 25,
+ DomainRecordCreate: 26,
+ DomainRecordUpdate: 27,
+ DomainRecordDelete: 28,
+ DomainRead: 29,
+ DomainCreate: 30,
+ DomainDelete: 31,
+ DropletRead: 32,
+ DropletCreate: 33,
+ DropletDelete: 34,
+ DropletAutoscalePoolRead: 35,
+ DropletAutoscalePoolCreate: 36,
+ DropletAutoscalePoolUpdate: 37,
+ DropletAutoscalePoolDelete: 38,
+ FirewallRead: 39,
+ FirewallCreate: 40,
+ FirewallUpdate: 41,
+ FirewallDelete: 42,
+ FloatingIpRead: 43,
+ FloatingIpCreate: 44,
+ FloatingIpDelete: 45,
+ NamespaceRead: 46,
+ NamespaceCreate: 47,
+ NamespaceDelete: 48,
+ GenaiAgentRead: 49,
+ GenaiAgentCreate: 50,
+ GenaiAgentUpdate: 51,
+ GenaiAgentDelete: 52,
+ ImageRead: 53,
+ ImageCreate: 54,
+ ImageUpdate: 55,
+ ImageDelete: 56,
+ KubernetesRead: 57,
+ KubernetesCreate: 58,
+ KubernetesUpdate: 59,
+ KubernetesDelete: 60,
+ LoadBalancerRead: 61,
+ LoadBalancerCreate: 62,
+ LoadBalancerUpdate: 63,
+ LoadBalancerDelete: 64,
+ MonitoringRead: 65,
+ MonitoringCreate: 66,
+ MonitoringUpdate: 67,
+ MonitoringDelete: 68,
+ ProjectRead: 69,
+ ProjectCreate: 70,
+ ProjectUpdate: 71,
+ ProjectDelete: 72,
+ RegionRead: 73,
+ ReservedIpRead: 74,
+ ReservedIpCreate: 75,
+ ReservedIpDelete: 76,
+ SizeRead: 77,
+ SnapshotRead: 78,
+ SnapshotDelete: 79,
+ SshKeyRead: 80,
+ SshKeyCreate: 81,
+ SshKeyUpdate: 82,
+ SshKeyDelete: 83,
+ TagRead: 84,
+ TagCreate: 85,
+ TagDelete: 86,
+ UptimeRead: 87,
+ UptimeCreate: 88,
+ UptimeUpdate: 89,
+ UptimeDelete: 90,
+ VpcPeeringRead: 91,
+ VpcPeeringCreate: 92,
+ VpcPeeringUpdate: 93,
+ VpcPeeringDelete: 94,
+ VpcRead: 95,
+ VpcCreate: 96,
+ VpcUpdate: 97,
+ VpcDelete: 98,
+ }
+
+ IdToPermission = map[int]Permission{
+ 1: OneClickRead,
+ 2: OneClickCreate,
+ 3: ActionRead,
+ 4: AppRead,
+ 5: AppCreate,
+ 6: AppUpdate,
+ 7: AppDelete,
+ 8: BillingRead,
+ 9: BlockStorageRead,
+ 10: BlockStorageCreate,
+ 11: BlockStorageDelete,
+ 12: CdnEndpointRead,
+ 13: CdnEndpointCreate,
+ 14: CdnEndpointUpdate,
+ 15: CdnEndpointDelete,
+ 16: CertificateRead,
+ 17: CertificateCreate,
+ 18: CertificateDelete,
+ 19: ContainerRegistryRead,
+ 20: ContainerRegistryCreate,
+ 21: DatabaseRead,
+ 22: DatabaseCreate,
+ 23: DatabaseUpdate,
+ 24: DatabaseDelete,
+ 25: DomainRecordRead,
+ 26: DomainRecordCreate,
+ 27: DomainRecordUpdate,
+ 28: DomainRecordDelete,
+ 29: DomainRead,
+ 30: DomainCreate,
+ 31: DomainDelete,
+ 32: DropletRead,
+ 33: DropletCreate,
+ 34: DropletDelete,
+ 35: DropletAutoscalePoolRead,
+ 36: DropletAutoscalePoolCreate,
+ 37: DropletAutoscalePoolUpdate,
+ 38: DropletAutoscalePoolDelete,
+ 39: FirewallRead,
+ 40: FirewallCreate,
+ 41: FirewallUpdate,
+ 42: FirewallDelete,
+ 43: FloatingIpRead,
+ 44: FloatingIpCreate,
+ 45: FloatingIpDelete,
+ 46: NamespaceRead,
+ 47: NamespaceCreate,
+ 48: NamespaceDelete,
+ 49: GenaiAgentRead,
+ 50: GenaiAgentCreate,
+ 51: GenaiAgentUpdate,
+ 52: GenaiAgentDelete,
+ 53: ImageRead,
+ 54: ImageCreate,
+ 55: ImageUpdate,
+ 56: ImageDelete,
+ 57: KubernetesRead,
+ 58: KubernetesCreate,
+ 59: KubernetesUpdate,
+ 60: KubernetesDelete,
+ 61: LoadBalancerRead,
+ 62: LoadBalancerCreate,
+ 63: LoadBalancerUpdate,
+ 64: LoadBalancerDelete,
+ 65: MonitoringRead,
+ 66: MonitoringCreate,
+ 67: MonitoringUpdate,
+ 68: MonitoringDelete,
+ 69: ProjectRead,
+ 70: ProjectCreate,
+ 71: ProjectUpdate,
+ 72: ProjectDelete,
+ 73: RegionRead,
+ 74: ReservedIpRead,
+ 75: ReservedIpCreate,
+ 76: ReservedIpDelete,
+ 77: SizeRead,
+ 78: SnapshotRead,
+ 79: SnapshotDelete,
+ 80: SshKeyRead,
+ 81: SshKeyCreate,
+ 82: SshKeyUpdate,
+ 83: SshKeyDelete,
+ 84: TagRead,
+ 85: TagCreate,
+ 86: TagDelete,
+ 87: UptimeRead,
+ 88: UptimeCreate,
+ 89: UptimeUpdate,
+ 90: UptimeDelete,
+ 91: VpcPeeringRead,
+ 92: VpcPeeringCreate,
+ 93: VpcPeeringUpdate,
+ 94: VpcPeeringDelete,
+ 95: VpcRead,
+ 96: VpcCreate,
+ 97: VpcUpdate,
+ 98: VpcDelete,
+ }
+)
+
+// ToString converts a Permission enum to its string representation
+func (p Permission) ToString() (string, error) {
+ if str, ok := PermissionStrings[p]; ok {
+ return str, nil
+ }
+ return "", errors.New("invalid permission")
+}
+
+// ToID converts a Permission enum to its ID
+func (p Permission) ToID() (int, error) {
+ if id, ok := PermissionIDs[p]; ok {
+ return id, nil
+ }
+ return 0, errors.New("invalid permission")
+}
+
+// PermissionFromString converts a string representation to its Permission enum
+func PermissionFromString(s string) (Permission, error) {
+ if p, ok := StringToPermission[s]; ok {
+ return p, nil
+ }
+ return 0, errors.New("invalid permission string")
+}
+
+// PermissionFromID converts an ID to its Permission enum
+func PermissionFromID(id int) (Permission, error) {
+ if p, ok := IdToPermission[id]; ok {
+ return p, nil
+ }
+ return 0, errors.New("invalid permission ID")
+}
diff --git a/pkg/analyzer/analyzers/digitalocean/permissions.yaml b/pkg/analyzer/analyzers/digitalocean/permissions.yaml
new file mode 100644
index 000000000..427268693
--- /dev/null
+++ b/pkg/analyzer/analyzers/digitalocean/permissions.yaml
@@ -0,0 +1,99 @@
+permissions:
+ - one_click:read
+ - one_click:create
+ - action:read
+ - app:read
+ - app:create
+ - app:update
+ - app:delete
+ - billing:read
+ - block_storage:read
+ - block_storage:create
+ - block_storage:delete
+ - cdn_endpoint:read
+ - cdn_endpoint:create
+ - cdn_endpoint:update
+ - cdn_endpoint:delete
+ - certificate:read
+ - certificate:create
+ - certificate:delete
+ - container_registry:read
+ - container_registry:create
+ - database:read
+ - database:create
+ - database:update
+ - database:delete
+ - domain_record:read
+ - domain_record:create
+ - domain_record:update
+ - domain_record:delete
+ - domain:read
+ - domain:create
+ - domain:delete
+ - droplet:read
+ - droplet:create
+ - droplet:delete
+ - droplet_autoscale_pool:read
+ - droplet_autoscale_pool:create
+ - droplet_autoscale_pool:update
+ - droplet_autoscale_pool:delete
+ - firewall:read
+ - firewall:create
+ - firewall:update
+ - firewall:delete
+ - floating_ip:read
+ - floating_ip:create
+ - floating_ip:delete
+ - namespace:read
+ - namespace:create
+ - namespace:delete
+ - genai_agent:read
+ - genai_agent:create
+ - genai_agent:update
+ - genai_agent:delete
+ - image:read
+ - image:create
+ - image:update
+ - image:delete
+ - kubernetes:read
+ - kubernetes:create
+ - kubernetes:update
+ - kubernetes:delete
+ - load_balancer:read
+ - load_balancer:create
+ - load_balancer:update
+ - load_balancer:delete
+ - monitoring:read
+ - monitoring:create
+ - monitoring:update
+ - monitoring:delete
+ - project:read
+ - project:create
+ - project:update
+ - project:delete
+ - region:read
+ - reserved_ip:read
+ - reserved_ip:create
+ - reserved_ip:delete
+ - size:read
+ - snapshot:read
+ - snapshot:delete
+ - ssh_key:read
+ - ssh_key:create
+ - ssh_key:update
+ - ssh_key:delete
+ - tag:read
+ - tag:create
+ - tag:delete
+ - uptime:read
+ - uptime:create
+ - uptime:update
+ - uptime:delete
+ - vpc_peering:read
+ - vpc_peering:create
+ - vpc_peering:update
+ - vpc_peering:delete
+ - vpc:read
+ - vpc:create
+ - vpc:update
+ - vpc:delete
diff --git a/pkg/analyzer/analyzers/digitalocean/scopes.json b/pkg/analyzer/analyzers/digitalocean/scopes.json
new file mode 100644
index 000000000..9037a5a61
--- /dev/null
+++ b/pkg/analyzer/analyzers/digitalocean/scopes.json
@@ -0,0 +1,884 @@
+[
+ {
+ "name": "one_click:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/1-clicks",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "one_click:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/1-clicks/kubernetes",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "action:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/actions",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "app:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/apps",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "app:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/apps",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "app:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/apps/`nowaythisidcanexist",
+ "method": "PUT",
+ "valid_status_code": [400],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "app:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/apps/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [400],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "billing:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/customers/my/balance",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "block_storage:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/volumes",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "block_storage:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/volumes",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "block_storage:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/volumes/0000",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "cdn_endpoint:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/cdn/endpoints",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "cdn_endpoint:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/cdn/endpoints",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "cdn_endpoint:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/cdn/endpoints/`nowaythisidcanexist",
+ "method": "PUT",
+ "valid_status_code": [400],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "cdn_endpoint:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/cdn/endpoints/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [400],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "certificate:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/certificates",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "certificate:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/certificates",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "certificate:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/certificates/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "container_registry:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/registry",
+ "method": "GET",
+ "valid_status_code": [200, 404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "container_registry:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/registry",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "database:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/databases",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "database:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/databases",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "database:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/databases/`nowaythisidcanexist/config",
+ "method": "PATCH",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "database:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/databases/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "domain_record:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/domains/`nowaythisdomaincanexist.com/records",
+ "method": "GET",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "domain_record:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/domains/`nowaythisdomaincanexist.com/records",
+ "method": "POST",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "domain_record:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/domains/`nowaythisdomaincanexist.com/records/`nowaythisidcanexist",
+ "method": "PUT",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "domain_record:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/domains/`nowaythisdomaincanexist.com/records/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "domain:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/domains",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "domain:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/domains",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "domain:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/domains/`nowaythisdomaincanexist.com",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "droplet:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/droplets",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "droplet:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/droplets",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "droplet:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/droplets/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "droplet_autoscale_pool:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/droplets/autoscale",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "droplet_autoscale_pool:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/droplets/autoscale",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "droplet_autoscale_pool:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/droplets/autoscale/0d3db13e-a604-4944-9827-7ec2642d32ac",
+ "method": "PUT",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "droplet_autoscale_pool:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/droplets/autoscale/0d3db13e-a604-4944-9827-7ec2642d32ac",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "firewall:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/firewalls",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "firewall:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/firewalls",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "firewall:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/firewalls/`nowaythisidcanexist",
+ "method": "PUT",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "firewall:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/firewalls/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "floating_ip:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/floating_ips",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "floating_ip:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/floating_ips",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "floating_ip:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/floating_ips/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "namespace:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/functions/namespaces",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "namespace:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/functions/namespaces",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "namespace:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/functions/namespaces/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "genai_agent:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/gen-ai/agents",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "genai_agent:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/gen-ai/agents",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "genai_agent:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/gen-ai/agents/`nowaythisidcanexist",
+ "method": "PUT",
+ "valid_status_code": [400],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "genai_agent:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/gen-ai/agents/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [400],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "image:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/images",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "image:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/images",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "image:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/images/`nowaythisidcanexist",
+ "method": "PUT",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "image:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/images/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "kubernetes:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/kubernetes/clusters",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "kubernetes:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/kubernetes/clusters",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "kubernetes:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/kubernetes/clusters/`nowaythisidcanexist",
+ "method": "PUT",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "kubernetes:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/kubernetes/clusters/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "load_balancer:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/load_balancers",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "load_balancer:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/load_balancers",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "load_balancer:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/load_balancers/`nowaythisidcanexist",
+ "method": "PUT",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "load_balancer:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/load_balancers/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "monitoring:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/monitoring/alerts",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "monitoring:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/monitoring/alerts",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "monitoring:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/monitoring/alerts/`nowaythisidcanexist",
+ "method": "PUT",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "monitoring:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/monitoring/alerts/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "project:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/projects",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "project:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/projects",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "project:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/projects/`nowaythisidcanexist",
+ "method": "PUT",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "project:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/projects/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "region:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/regions",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "reserved_ip:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/reserved_ips",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "reserved_ip:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/reserved_ips",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "reserved_ip:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/reserved_ips/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "size:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/sizes",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "snapshot:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/snapshots",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "snapshot:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/snapshots/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "ssh_key:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/account/keys",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "ssh_key:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/account/keys",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "ssh_key:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/account/keys/`nowaythisidcanexist",
+ "method": "PUT",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "ssh_key:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/account/keys/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "tag:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/tags",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "tag:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/tags",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "tag:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/tags/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "uptime:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/uptime/checks",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "uptime:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/uptime/checks",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "uptime:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/uptime/checks/`nowaythisidcanexist",
+ "method": "PUT",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "uptime:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/uptime/checks/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "vpc_peering:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/vpc_peerings",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "vpc_peering:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/vpc_peerings",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "vpc_peering:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/vpc_peerings/5a4981aa-9653-4bd1-bef5-d6bff52042e4",
+ "method": "PATCH",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "vpc_peering:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/vpc_peerings/5a4981aa-9653-4bd1-bef5-d6bff52042e4",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "vpc:read",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/vpcs",
+ "method": "GET",
+ "valid_status_code": [200],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "vpc:create",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/vpcs",
+ "method": "POST",
+ "valid_status_code": [422],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "vpc:update",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/vpcs/`nowaythisidcanexist",
+ "method": "PUT",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ },
+ {
+ "name": "vpc:delete",
+ "test": {
+ "endpoint": "https://api.digitalocean.com/v2/vpcs/`nowaythisidcanexist",
+ "method": "DELETE",
+ "valid_status_code": [404],
+ "invalid_status_code": [403]
+ }
+ }
+]
\ No newline at end of file
diff --git a/pkg/analyzer/cli.go b/pkg/analyzer/cli.go
index bb211ac63..8a60394f7 100644
--- a/pkg/analyzer/cli.go
+++ b/pkg/analyzer/cli.go
@@ -10,6 +10,7 @@ import (
"github.com/trufflesecurity/trufflehog/v3/pkg/analyzer/analyzers/anthropic"
"github.com/trufflesecurity/trufflehog/v3/pkg/analyzer/analyzers/asana"
"github.com/trufflesecurity/trufflehog/v3/pkg/analyzer/analyzers/bitbucket"
+ "github.com/trufflesecurity/trufflehog/v3/pkg/analyzer/analyzers/digitalocean"
"github.com/trufflesecurity/trufflehog/v3/pkg/analyzer/analyzers/dockerhub"
"github.com/trufflesecurity/trufflehog/v3/pkg/analyzer/analyzers/github"
"github.com/trufflesecurity/trufflehog/v3/pkg/analyzer/analyzers/gitlab"
@@ -93,9 +94,11 @@ func Run(keyType string, secretInfo SecretInfo) {
notion.AnalyzeAndPrintPermissions(secretInfo.Cfg, secretInfo.Parts["key"])
case "dockerhub":
dockerhub.AnalyzeAndPrintPermissions(secretInfo.Cfg, secretInfo.Parts["username"], secretInfo.Parts["pat"])
- case "anthropic":
+ case "anthropic":
anthropic.AnalyzeAndPrintPermissions(secretInfo.Cfg, secretInfo.Parts["key"])
case "airtable":
airtable.AnalyzeAndPrintPermissions(secretInfo.Cfg, secretInfo.Parts["key"])
+ case "digitalocean":
+ digitalocean.AnalyzeAndPrintPermissions(secretInfo.Cfg, secretInfo.Parts["key"])
}
}
diff --git a/pkg/detectors/digitaloceantoken/digitaloceantoken.go b/pkg/detectors/digitaloceantoken/digitaloceantoken.go
index edbaa6e62..b41c18125 100644
--- a/pkg/detectors/digitaloceantoken/digitaloceantoken.go
+++ b/pkg/detectors/digitaloceantoken/digitaloceantoken.go
@@ -55,6 +55,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
defer res.Body.Close()
if res.StatusCode >= 200 && res.StatusCode < 300 {
s1.Verified = true
+ s1.AnalysisInfo = map[string]string{
+ "key": resMatch,
+ }
}
}
}
diff --git a/pkg/detectors/digitaloceanv2/digitaloceanv2.go b/pkg/detectors/digitaloceanv2/digitaloceanv2.go
index 8e78207f4..c6b670ab2 100644
--- a/pkg/detectors/digitaloceanv2/digitaloceanv2.go
+++ b/pkg/detectors/digitaloceanv2/digitaloceanv2.go
@@ -82,6 +82,9 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
defer res.Body.Close()
if res.StatusCode >= 200 && res.StatusCode < 300 {
s1.Verified = true
+ s1.AnalysisInfo = map[string]string{
+ "key": resMatch,
+ }
}
}
}