gcpaccess

package
v0.167.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gcpaccess asks Google Cloud which permissions the caller's credentials hold on a project.

One question, asked by two callers: `draugr doctor`, to say whether a declared account can be read at all, and the prowler scanner, to know before Prowler runs which services it will be denied. A denied read is the one failure Prowler does not report: depending on the check it passes, fails, or disappears, so the answer has to come from somewhere other than its output.

The credentials are Application Default Credentials, the ones Prowler and every Google client library read: GOOGLE_APPLICATION_CREDENTIALS, `gcloud auth application-default login`, or the metadata server of the machine the scan runs on. Asking with the same credentials is what makes the answer about the scan rather than about this process.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoCredentials = errors.New("no Google Cloud credentials found: set GOOGLE_APPLICATION_CREDENTIALS " +
	"to a key or a workload identity configuration, or run `gcloud auth application-default login`")

ErrNoCredentials is a machine with no Application Default Credentials to ask with.

Functions

This section is empty.

Types

type Tester

type Tester struct {
	// contains filtered or unexported fields
}

Tester asks which permissions the credentials hold.

func New

func New(ctx context.Context) (*Tester, error)

New finds the Application Default Credentials and returns a Tester that asks with them.

func NewWith

func NewWith(client *http.Client, endpointURL string) *Tester

NewWith returns a Tester asking endpoint through client, for a caller that brings its own.

func (*Tester) Granted

func (t *Tester) Granted(ctx context.Context, project string, perms []string) ([]string, error)

Granted returns the permissions in perms the credentials hold on project, in the order asked.

A project the credentials cannot see at all and a project that does not exist are one answer, because Google gives one: permission denied. The error says both.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL