keynuker_go_common

package
v0.0.0-...-b027d78 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultKeyNukerOrg = "default"

	DocIdPrefixGithubUsers = "github_users"

	DocIdPrefixAwsKeys = "aws_keys"

	DocIdPrefixGithubEventCheckpoints = "github_event_checkpoints"
)
View Source
const (
	EnvVarKeyNukerTestGithubAccessToken = "KEYNUKER_INTEGRATION_TEST_GITHUB_ACCESS_TOKEN"

	EnvVarKeyNukerTestDbHost = "KEYNUKER_DB_HOST"

	EnvVarKeyNukerTestDbName = "KEYNUKER_DB_NAME"

	EnvVarKeyNukerTestDbUsername = "KEYNUKER_DB_KEY"

	EnvVarKeyNukerTestDbPassword = "KEYNUKER_DB_SECRET_KEY"

	EnvVarKeyNukerTestTargetAwsAccounts = "KEYNUKER_TARGET_AWS_ACCOUNTS"

	EnvVarKeyNukerTestIntegrationTestsEnabled = "KEYNUKER_INTEGRATION_TESTS_ENABLED"

	EnvVarKeyNukerTestIntegrationAccessKey       = "KEYNUKER_INTEGRATION_TEST_ACCESS_KEY"
	EnvVarKeyNukerTestIntegrationSecretAccessKey = "KEYNUKER_INTEGRATION_TEST_SECRET_ACCESS_KEY"

	EnvVarKeyNukerInitiatingAwsAccountCreds = "KEYNUKER_INITIATING_AWS_ACCOUNT"

	EnvVarKeyNukerTestIntegrationGithubApiBaseUrl = "KEYNUKER_INTEGRATION_TEST_GITHUB_BASE_API_URL"

	EnvVarKeyNukerTestGithubOrgs = "KEYNUKER_INTEGRATION_TEST_GITHUB_ORGS"

	EnvVarKeyNukerTestGithubLeakTargetRepo = "KEYNUKER_GITHUB_LEAK_TARGET_REPO"

	EnvVarKeyNukerEmailFromAddress = "KEYNUKER_EMAIL_FROM_ADDRESS"

	EnvVarKeyNukerAdminEmailCCAddress = "KEYNUKER_ADMIN_EMAIL_CC_ADDRESS"

	EnvVarKeyNukerMailerDomain = "KEYNUKER_MAILER_DOMAIN"

	EnvVarKeyNukerMailerApiKey = "KEYNUKER_MAILER_API_KEY"

	EnvVarKeyNukerMailerPublicApiKey = "KEYNUKER_MAILER_PUBLIC_API_KEY"
)

Environment Variable Names

View Source
const (

	// The integration test creates branches on the github repo.
	// Add improbable string at end to make it as unlikely as possible to collide with a real branch name
	KeyNukerIntegrationTestBranch = "KeyNukerIntegrationTestBranch-5a2f42dd3058f53ac9c5f22153257db7b594c663"

	GithubRefsHeadsPrefix = "refs/heads"

	GithubMasterBranch = "master"

	// The max size in bytes of blob content that will be scanned.
	// This should be raised to 100 MB once the stream based scanning is implemented.
	MaxSizeBytesBlobContent = 10000000 // 10 MB

	// The max execution time for an action in seconds
	MaxActionExecutionSeconds = time.Second * 300

	// The high watermark at which point an action should be aborted since approaching max
	HighWatermarkExecutionSeconds = MaxActionExecutionSeconds - (time.Second * 60)
)

Misc

Variables

View Source
var (

	// If there is no recorded checkpoint for a user, how far back should the scanning go in the github user event history?
	DefaultCheckpointEventTimeWindow time.Duration
)
View Source
var UseDockerSkeleton bool

Functions

func GenerateDocId

func GenerateDocId(docIdPrefix, keyNukerOrg string) string

func InvokeActionStdIo

func InvokeActionStdIo(callback ow.OpenWhiskCallback)

func IsTemporaryGithubError

func IsTemporaryGithubError(err error) bool

func LogMemoryUsage

func LogMemoryUsage()

func LogMemoryUsageLoop

func LogMemoryUsageLoop()

func ReadLimited

func ReadLimited(r io.Reader, maxBytes int) ([]byte, error)

Read up to maxBytes from reader

func RegistorOrInvokeActionStdIo

func RegistorOrInvokeActionStdIo(callback ow.OpenWhiskCallback)

func WrapCallbackWithLogSentinel

func WrapCallbackWithLogSentinel(invocationMethod string, callback ow.OpenWhiskCallback) ow.OpenWhiskCallback

Types

type AwsParams

type AwsParams struct {

	// The aws access key to connect as.  This only needs permissions to list IAM users and access keys,
	// and delete access keys (in the case they are nuked)
	AwsAccessKeyId string

	// The secret access key corresponding to AwsAccessKeyId
	AwsSecretAccessKey string
}

type BoundedLogger

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

func (*BoundedLogger) Printf

func (b *BoundedLogger) Printf(format string, v ...interface{})

type Logger

type Logger interface {
	Printf(format string, v ...interface{})
}

func CreateBoundedLogger

func CreateBoundedLogger(maxInvocations int) Logger

Jump to

Keyboard shortcuts

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