validation

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 17 Imported by: 0

Documentation

Overview

Package validation maintains Jacamar's interactions with an admin defined validation script. These tools can be used not sure to convey pass/fail status but also directly influence ongoing user context leveraged in the remainder of the authorization flow.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RunAsInit added in v0.5.0

type RunAsInit struct {
	// TargetUser is a user proposed account (via the CI environment) meant to be the
	// replaced for the CurrentUser if the process is approved.
	TargetUser string
	// CurrentUser is the currently identified local user account of the CI trigger user.
	// This can differ from the JWT UserLogin depending on configuration of the authorization,
	// and should be observed when attempting to approve a local user account.
	CurrentUser string
	Job         jobtoken.EstablishedContext
}

RunAsInit values are used to established user context for the upcoming authorization.

type RunAsOverride added in v0.5.0

type RunAsOverride struct {
	// Username is the valid local account that will be the target henceforth
	// for the authorization process.
	Username string `json:"username" validate:"username"`
	// DataDir overrides the target data_dir configured by the admin with a new target.
	DataDir string `json:"data_dir" validate:"directory"`
	// UsrMsg optional user directed warning/output (depending on exit status).
	// The message will be conveyed during the use of the RunAsValidator but always be
	// conveyed via STDERR in order to meet GitLab output requirements.
	UserMsg string `json:"user_message"`
	// ErrorMsg optional obfuscated error logged in cases where exit status
	// of the validation scrip is non-zero.
	ErrorMsg string `json:"error_message"`
}

RunAsOverride represents potential values that can be returned to Jacamar to override or influence authorization flow behaviors beyond a simple pass/fail result.

type RunAsValidator

type RunAsValidator interface {
	// Execute leverages an admin defined script in conjunction with the currently
	// identified job context to provide a complete set of verified override values. All
	// override values returned must be observed, barring any error encountered.
	Execute(job jobtoken.EstablishedContext, username string, sysLog *logrus.Entry) (RunAsOverride, error)
}

RunAsValidator implements an interface for interacting with validation scripts.

func NewRunAs

func NewRunAs(auth configure.Auth) (RunAsValidator, error)

NewRunAs establishing a RunAs Validator based upon job context and admin configuration. If no RunAs is established by the configuration a nil Validator will be returned.

Jump to

Keyboard shortcuts

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