Movatterモバイル変換


[0]ホーム

URL:


Alert GO-2024-3228: Coder vulnerable to post-auth URL redirection to untrusted site ('Open Redirect') in github.com/coder/coder
Notice  The highest tagged major version isv2.

agentsdk

package
v0.27.3Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License:AGPL-3.0Imports:20Imported by:2

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcStartupLogsNotifyChanneladded inv0.21.0

func StartupLogsNotifyChannel(agentIDuuid.UUID)string

StartupLogsNotifyChannel returns the channel name responsible for notifyingof new startup logs.

funcStartupLogsSenderadded inv0.25.0

func StartupLogsSender(patchStartupLogs func(ctxcontext.Context, reqPatchStartupLogs)error, loggerslog.Logger) (sendLog func(ctxcontext.Context, log ...StartupLog)error, flushAndClose func(context.Context)error)

SendStartupLogs will send agent startup logs to the server. Calls tosendLog are non-blocking and will return an error if flushAndClosehas been called. Calling sendLog concurrently is not supported. Ifthe context passed to flushAndClose is canceled, any remaining logswill be discarded.

funcStartupLogsWriteradded inv0.25.0

func StartupLogsWriter(ctxcontext.Context, sender func(ctxcontext.Context, log ...StartupLog)error, levelcodersdk.LogLevel)io.WriteCloser

StartupLogsWriter returns an io.WriteCloser that sends logs via theprovided sender. The sender is expected to be non-blocking. CallingClose flushes any remaining partially written log lines but isotherwise no-op. If the context passed to StartupLogsWriter iscanceled, any remaining logs will be discarded.

Neither Write nor Close is safe for concurrent use and must be usedby a single goroutine.

Types

typeAWSInstanceIdentityToken

type AWSInstanceIdentityToken struct {Signaturestring `json:"signature" validate:"required"`Documentstring `json:"document" validate:"required"`}

typeAgentMetricadded inv0.23.1

type AgentMetric struct {Namestring             `json:"name" validate:"required"`TypeAgentMetricType    `json:"type" validate:"required" enums:"counter,gauge"`Valuefloat64            `json:"value" validate:"required"`Labels []AgentMetricLabel `json:"labels,omitempty"`}

typeAgentMetricLabeladded inv0.24.0

type AgentMetricLabel struct {Namestring `json:"name" validate:"required"`Valuestring `json:"value" validate:"required"`}

typeAgentMetricTypeadded inv0.23.1

type AgentMetricTypestring
const (AgentMetricTypeCounterAgentMetricType = "counter"AgentMetricTypeGaugeAgentMetricType = "gauge")

typeAuthenticateResponse

type AuthenticateResponse struct {SessionTokenstring `json:"session_token"`}

AuthenticateResponse is returned when an instance IDhas been exchanged for a session token.@typescript-ignore AuthenticateResponse

typeAzureInstanceIdentityToken

type AzureInstanceIdentityToken struct {Signaturestring `json:"signature" validate:"required"`Encodingstring `json:"encoding" validate:"required"`}

typeClient

type Client struct {SDK *codersdk.Client}

Client wraps `codersdk.Client` with specific functionsscoped to a workspace agent.

funcNew

func New(serverURL *url.URL) *Client

New returns a client that is used to interact with theCoder API from a workspace agent.

func (*Client)AuthAWSInstanceIdentity

func (c *Client) AuthAWSInstanceIdentity(ctxcontext.Context) (AuthenticateResponse,error)

AuthWorkspaceAWSInstanceIdentity uses the Amazon Metadata API tofetch a signed payload, and exchange it for a session token for a workspace agent.

The requesting instance must be registered as a resource in the latest history for a workspace.

func (*Client)AuthAzureInstanceIdentity

func (c *Client) AuthAzureInstanceIdentity(ctxcontext.Context) (AuthenticateResponse,error)

AuthWorkspaceAzureInstanceIdentity uses the Azure Instance Metadata Service tofetch a signed payload, and exchange it for a session token for a workspace agent.

func (*Client)AuthGoogleInstanceIdentity

func (c *Client) AuthGoogleInstanceIdentity(ctxcontext.Context, serviceAccountstring, gcpClient *metadata.Client) (AuthenticateResponse,error)

AuthWorkspaceGoogleInstanceIdentity uses the Google Compute Engine Metadata API tofetch a signed JWT, and exchange it for a session token for a workspace agent.

The requesting instance must be registered as a resource in the latest history for a workspace.

func (*Client)GetServiceBanneradded inv0.25.0

func (c *Client) GetServiceBanner(ctxcontext.Context) (codersdk.ServiceBannerConfig,error)

GetServiceBanner relays the service banner config.

func (*Client)GitAuth

func (c *Client) GitAuth(ctxcontext.Context, gitURLstring, listenbool) (GitAuthResponse,error)

GitAuth submits a URL to fetch a GIT_ASKPASS username and password for.nolint:revive

func (*Client)GitSSHKey

func (c *Client) GitSSHKey(ctxcontext.Context) (GitSSHKey,error)

GitSSHKey will return the user's SSH key pair for the workspace.

func (*Client)Listen

func (c *Client) Listen(ctxcontext.Context) (net.Conn,error)

Listen connects to the workspace agent coordinate WebSocketthat handles connection negotiation.

func (*Client)Manifestadded inv0.21.3

func (c *Client) Manifest(ctxcontext.Context) (Manifest,error)

Manifest fetches manifest for the currently authenticated workspace agent.

func (*Client)PatchStartupLogsadded inv0.21.0

func (c *Client) PatchStartupLogs(ctxcontext.Context, reqPatchStartupLogs)error

PatchStartupLogs writes log messages to the agent startup script.Log messages are limited to 1MB in total.

func (*Client)PostAppHealth

func (c *Client) PostAppHealth(ctxcontext.Context, reqPostAppHealthsRequest)error

PostAppHealth updates the workspace agent app health status.

func (*Client)PostLifecycle

func (c *Client) PostLifecycle(ctxcontext.Context, reqPostLifecycleRequest)error

func (*Client)PostMetadataadded inv0.21.3

func (c *Client) PostMetadata(ctxcontext.Context, keystring, reqPostMetadataRequest)error

func (*Client)PostStartupadded inv0.17.1

func (c *Client) PostStartup(ctxcontext.Context, reqPostStartupRequest)error

func (*Client)PostStats

func (c *Client) PostStats(ctxcontext.Context, stats *Stats) (StatsResponse,error)

func (*Client)ReportStats

func (c *Client) ReportStats(ctxcontext.Context, logslog.Logger, statsChan <-chan *Stats, setInterval func(time.Duration)) (io.Closer,error)

ReportStats begins a stat streaming connection with the Coder server.It is resilient to network failures and intermittent coderd issues.

func (*Client)SetSessionToken

func (c *Client) SetSessionToken(tokenstring)

typeGitAuthResponse

type GitAuthResponse struct {Usernamestring `json:"username"`Passwordstring `json:"password"`URLstring `json:"url"`}

typeGitSSHKey

type GitSSHKey struct {PublicKeystring `json:"public_key"`PrivateKeystring `json:"private_key"`}

typeGoogleInstanceIdentityToken

type GoogleInstanceIdentityToken struct {JSONWebTokenstring `json:"json_web_token" validate:"required"`}

typeManifestadded inv0.21.3

type Manifest struct {AgentIDuuid.UUID `json:"agent_id"`// GitAuthConfigs stores the number of Git configurations// the Coder deployment has. If this number is >0, we// set up special configuration in the workspace.GitAuthConfigsint                                          `json:"git_auth_configs"`VSCodePortProxyURIstring                                       `json:"vscode_port_proxy_uri"`Apps                     []codersdk.WorkspaceApp                      `json:"apps"`DERPMap                  *tailcfg.DERPMap                             `json:"derpmap"`EnvironmentVariables     map[string]string                            `json:"environment_variables"`StartupScriptstring                                       `json:"startup_script"`StartupScriptTimeouttime.Duration                                `json:"startup_script_timeout"`Directorystring                                       `json:"directory"`MOTDFilestring                                       `json:"motd_file"`ShutdownScriptstring                                       `json:"shutdown_script"`ShutdownScriptTimeouttime.Duration                                `json:"shutdown_script_timeout"`DisableDirectConnectionsbool                                         `json:"disable_direct_connections"`Metadata                 []codersdk.WorkspaceAgentMetadataDescription `json:"metadata"`}

typePatchStartupLogsadded inv0.21.0

type PatchStartupLogs struct {Logs []StartupLog `json:"logs"`}

typePostAppHealthsRequest

type PostAppHealthsRequest struct {// Healths is a map of the workspace app name and the health of the app.Healths map[uuid.UUID]codersdk.WorkspaceAppHealth}

typePostLifecycleRequest

type PostLifecycleRequest struct {Statecodersdk.WorkspaceAgentLifecycle `json:"state"`ChangedAttime.Time                        `json:"changed_at"`}

typePostMetadataRequestadded inv0.21.3

type PostMetadataRequest =codersdk.WorkspaceAgentMetadataResult

In the future, we may want to support sending back multiple values forperformance.

typePostStartupRequestadded inv0.17.1

type PostStartupRequest struct {Versionstring                  `json:"version"`ExpandedDirectorystring                  `json:"expanded_directory"`Subsystemcodersdk.AgentSubsystem `json:"subsystem"`}

typeStartupLogadded inv0.21.0

type StartupLog struct {CreatedAttime.Time         `json:"created_at"`Outputstring            `json:"output"`Levelcodersdk.LogLevel `json:"level"`}

typeStartupLogsNotifyMessageadded inv0.21.0

type StartupLogsNotifyMessage struct {CreatedAfterint64 `json:"created_after"`}

typeStats

type Stats struct {// ConnectionsByProto is a count of connections by protocol.ConnectionsByProto map[string]int64 `json:"connections_by_proto"`// ConnectionCount is the number of connections received by an agent.ConnectionCountint64 `json:"connection_count"`// ConnectionMedianLatencyMS is the median latency of all connections in milliseconds.ConnectionMedianLatencyMSfloat64 `json:"connection_median_latency_ms"`// RxPackets is the number of received packets.RxPacketsint64 `json:"rx_packets"`// RxBytes is the number of received bytes.RxBytesint64 `json:"rx_bytes"`// TxPackets is the number of transmitted bytes.TxPacketsint64 `json:"tx_packets"`// TxBytes is the number of transmitted bytes.TxBytesint64 `json:"tx_bytes"`// SessionCountVSCode is the number of connections received by an agent// that are from our VS Code extension.SessionCountVSCodeint64 `json:"session_count_vscode"`// SessionCountJetBrains is the number of connections received by an agent// that are from our JetBrains extension.SessionCountJetBrainsint64 `json:"session_count_jetbrains"`// SessionCountReconnectingPTY is the number of connections received by an agent// that are from the reconnecting web terminal.SessionCountReconnectingPTYint64 `json:"session_count_reconnecting_pty"`// SessionCountSSH is the number of connections received by an agent// that are normal, non-tagged SSH sessions.SessionCountSSHint64 `json:"session_count_ssh"`// Metrics collected by the agentMetrics []AgentMetric `json:"metrics"`}

Stats records the Agent's network connection statistics for use inuser-facing metrics and debugging.

typeStatsResponse

type StatsResponse struct {// ReportInterval is the duration after which the agent should send stats// again.ReportIntervaltime.Duration `json:"report_interval"`}

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp