overrides

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JXScoutTamperRuleCollectionName = "jxscout-overrides"
	JXScoutTamperRuleNamePrefix     = "jxscout-"
)

Variables

View Source
var ErrAssetContentTypeNotSupported = errors.New("override is only supported for HTML or JS files")
View Source
var ErrAssetNoLongerExists = errors.New("asset no longer exists")
View Source
var ErrAssetNotFound = errors.New("asset not found")

Functions

func NewOverridesModule

func NewOverridesModule(caidoHostname string, caidoPort int) *overridesModule

Types

type AuthenticationRequest

type AuthenticationRequest struct {
	ID              string `graphql:"id"`
	ExpiresAt       string `graphql:"expiresAt"`
	UserCode        string `graphql:"userCode"`
	VerificationURL string `graphql:"verificationUrl"`
}

AuthenticationRequest represents the response from startAuthenticationFlow

type AuthenticationResponse

type AuthenticationResponse struct {
	AuthenticationFlow struct {
		Token string `graphql:"token"`
	} `graphql:"authenticationFlow"`
}

AuthenticationResponse represents the response from the authentication subscription

type CaidoClient

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

CaidoClient manages communication with the Caido GraphQL API

func NewCaidoClient

func NewCaidoClient(hostname string, port int, log *slog.Logger) (*CaidoClient, error)

NewCaidoClient creates a new Caido API client

func (*CaidoClient) Authenticate

func (c *CaidoClient) Authenticate(ctx context.Context, authCompleteChan chan<- bool) (string, error)

func (*CaidoClient) CreateTamperRule

func (c *CaidoClient) CreateTamperRule(ctx context.Context, collectionID string, name string, content string, host string, path string) (TamperRule, error)

CreateTamperRule creates a new tamper rule

func (*CaidoClient) CreateTamperRuleCollection

func (c *CaidoClient) CreateTamperRuleCollection(ctx context.Context, name string) (TamperRuleCollection, error)

CreateTamperRuleCollection creates a new tamper rule collection

func (*CaidoClient) DeleteTamperRule

func (c *CaidoClient) DeleteTamperRule(ctx context.Context, ruleID string) (string, error)

DeleteTamperRule deletes a tamper rule

func (*CaidoClient) GetTamperRuleCollections

func (c *CaidoClient) GetTamperRuleCollections(ctx context.Context) ([]TamperRuleCollection, error)

GetTamperRuleCollections retrieves all tamper rule collections

func (*CaidoClient) IsAuthenticated

func (c *CaidoClient) IsAuthenticated() bool

func (*CaidoClient) ToggleTamperRule

func (c *CaidoClient) ToggleTamperRule(ctx context.Context, ruleID string, enabled bool) (TamperRule, error)

ToggleTamperRule enables or disables a tamper rule

func (*CaidoClient) UpdateTamperRule

func (c *CaidoClient) UpdateTamperRule(ctx context.Context, ruleID string, name string, content string, host string, path string) (TamperRule, error)

UpdateTamperRule updates an existing tamper rule

type CreateTamperRuleCollectionInput

type CreateTamperRuleCollectionInput struct {
	Name string `json:"name"`
}

CreateTamperRuleCollectionInput represents the input for creating a tamper rule collection

type CreateTamperRuleCollectionResponse

type CreateTamperRuleCollectionResponse struct {
	Collection TamperRuleCollection `graphql:"collection"`
}

CreateTamperRuleCollectionResponse represents the response from creating a tamper rule collection

type CreateTamperRuleInput

type CreateTamperRuleInput struct {
	CollectionID string            `json:"collectionId"`
	Name         string            `json:"name"`
	Section      TamperRuleSection `json:"section"`
}

CreateTamperRuleInput represents the input for creating a tamper rule

type CreatedAuthenticationToken

type CreatedAuthenticationToken struct {
	CreatedAuthenticationToken struct {
		Token struct {
			AccessToken string `graphql:"accessToken"`
		} `graphql:"token"`
	} `graphql:"createdAuthenticationToken(requestId: $requestId)"`
}

type OverridesModule

type OverridesModule interface {
	IsCaidoAuthenticated(ctx context.Context) bool
	AuthenticateCaido(ctx context.Context, authCompleteChan chan<- bool) (string, error)
	ToggleOverride(ctx context.Context, request ToggleOverrideRequest) (bool, error)
	GetOverrides(ctx context.Context, page, pageSize int) ([]*override, int, error)
	StartContentCheck()
}

type TamperRule

type TamperRule struct {
	ID   string `graphql:"id"`
	Name string `graphql:"name"`
}

TamperRule represents a tamper rule in Caido

type TamperRuleCollection

type TamperRuleCollection struct {
	ID   string `graphql:"id"`
	Name string `graphql:"name"`
}

TamperRuleCollection represents a collection of tamper rules

type TamperRuleFull

type TamperRuleFull struct {
	Full bool `json:"full"`
}

TamperRuleFull represents the full matcher of a tamper rule

type TamperRuleMatcher

type TamperRuleMatcher struct {
	Full TamperRuleFull `json:"full"`
}

TamperRuleMatcher represents the matcher of a tamper rule

type TamperRuleOperation

type TamperRuleOperation struct {
	Raw TamperRuleRaw `json:"raw"`
}

TamperRuleOperation represents the operation of a tamper rule

type TamperRuleRaw

type TamperRuleRaw struct {
	Matcher  TamperRuleMatcher  `json:"matcher"`
	Replacer TamperRuleReplacer `json:"replacer"`
}

TamperRuleRaw represents the raw operation of a tamper rule

type TamperRuleReplacer

type TamperRuleReplacer struct {
	Term TamperRuleTerm `json:"term"`
}

TamperRuleReplacer represents the replacer of a tamper rule

type TamperRuleResponseBody

type TamperRuleResponseBody struct {
	Operation TamperRuleOperation `json:"operation"`
}

TamperRuleResponseBody represents the response body section of a tamper rule

type TamperRuleSection

type TamperRuleSection struct {
	ResponseBody TamperRuleResponseBody `json:"responseBody"`
}

TamperRuleSection represents the section of a tamper rule

type TamperRuleTerm

type TamperRuleTerm struct {
	Term string `json:"term"`
}

TamperRuleTerm represents the term replacer of a tamper rule

type ToggleOverrideRequest

type ToggleOverrideRequest struct {
	AssetURL string
}

Jump to

Keyboard shortcuts

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