Documentation
¶
Overview ¶
Package commandargs defines structures and methods for handling command-line arguments related to authorized key checks in the GitLab shell.
Package commandargs provides functionality for handling and parsing command-line arguments related to authorized principals for GitLab shell commands.
Package commandargs defines types and interfaces for handling command-line arguments in GitLab shell commands.
Package commandargs provides functionality to handle and parse command-line arguments for various GitLab shell commands, including SSH arguments and command types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // List of Git commands that are handled in a special way GitCommands = []CommandType{LfsAuthenticate, UploadPack, ReceivePack, UploadArchive} )
Regular expressions for parsing key IDs and usernames from arguments
Functions ¶
This section is empty.
Types ¶
type AuthorizedKeys ¶
AuthorizedKeys holds the arguments and user information for key authorization checks.
func (*AuthorizedKeys) GetArguments ¶
func (ak *AuthorizedKeys) GetArguments() []string
GetArguments returns the list of command-line arguments.
func (*AuthorizedKeys) Parse ¶
func (ak *AuthorizedKeys) Parse() error
Parse parses and validates the arguments, setting ExpectedUser, ActualUser, and Key.
type AuthorizedPrincipals ¶
AuthorizedPrincipals holds the arguments for checking authorized principals and the key ID.
func (*AuthorizedPrincipals) GetArguments ¶
func (ap *AuthorizedPrincipals) GetArguments() []string
GetArguments returns the list of command-line arguments provided.
func (*AuthorizedPrincipals) Parse ¶
func (ap *AuthorizedPrincipals) Parse() error
Parse validates and extracts the key ID and principals from the Arguments slice. Returns an error if validation fails.
type CommandArgs ¶
CommandArgs is an interface for parsing and accessing command-line arguments.
type CommandType ¶
type CommandType string
CommandType represents a type of command identified by a string.
const ( Discover CommandType = "discover" TwoFactorRecover CommandType = "2fa_recovery_codes" TwoFactorVerify CommandType = "2fa_verify" LfsAuthenticate CommandType = "git-lfs-authenticate" LfsTransfer CommandType = "git-lfs-transfer" ReceivePack CommandType = "git-receive-pack" UploadPack CommandType = "git-upload-pack" UploadArchive CommandType = "git-upload-archive" PersonalAccessToken CommandType = "personal_access_token" )
Define supported command types
type Shell ¶
type Shell struct { Arguments []string GitlabUsername string GitlabKeyID string GitlabKrb5Principal string SSHArgs []string CommandType CommandType Env sshenv.Env }
Shell represents a parsed shell command with its arguments and related information.
func (*Shell) GetArguments ¶
GetArguments returns the list of command-line arguments.
func (*Shell) ParseCommand ¶
ParseCommand parses the command string into a slice of arguments.