v2

package module
v2.1.42 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	URL  string `json:"url"`
	Name string `json:"name"`
	Code int    `json:"code"`
	Type string `json:"type"`
}

custm structs made by Radu Boian

type Destroyed

type Destroyed struct {
	DestroyedBy *DestroyedBy `json:"destroyedBy,omitempty"`
	DestroyedAt TimeStamp    `json:"destroyedAt,omitempty"`
}

type DestroyedBy

type DestroyedBy struct {
	UserID    string `json:"userId"`
	UserName  string `json:"userName"`
	AvatarURL string `json:"avatarUrl"`
	Role      string `json:"role"`
	Email     string `json:"email"`
}

type Endpoint

type Endpoint struct {
	Logger *logrus.Logger

	URLAPI string

	Client     *http.Client
	OauthToken *oauth2.Token

	ApiScopes []string
	// contains filtered or unexported fields
}

func New

func New(cfg config.Config) (Endpoint, error)

New creates an Intigriti endpoint object to use this is the main object to interact with the SDK

func (*Endpoint) GetClient added in v2.1.42

return the http client which automatically injects the right authentication credentials

func (*Endpoint) GetOauth2Config added in v2.1.42

func (e *Endpoint) GetOauth2Config(apiScopes []string) oauth2.Config

retrieve the oauth2 configuration to use

func (*Endpoint) GetProgram added in v2.1.4

func (e *Endpoint) GetProgram(id string) (Program, error)

func (*Endpoint) GetProgramSubmissions

func (e *Endpoint) GetProgramSubmissions(programId string) ([]Submission, error)

GetProgramSubmissions returns a slice of submissions from orgs specific program by id

func (*Endpoint) GetPrograms added in v2.1.4

func (e *Endpoint) GetPrograms() ([]Program, error)

func (*Endpoint) GetSubmission

func (e *Endpoint) GetSubmission(code string) (*Submission, error)

GetSubmission returns submission by its code

func (*Endpoint) GetSubmissionEvents

func (e *Endpoint) GetSubmissionEvents(submissionCode string) ([]Event, error)

func (*Endpoint) GetSubmissionPayouts

func (e *Endpoint) GetSubmissionPayouts(submissionCode string) ([]Payout, error)

func (*Endpoint) GetSubmissions

func (e *Endpoint) GetSubmissions() ([]SubmissionGeneral, error)

GetSubmissions returns a slice of submissions from all orgs programs

func (*Endpoint) GetToken added in v2.1.42

func (e *Endpoint) GetToken() (*oauth2.Token, error)

fetch the latest (valid) oauth2 access and refresh token

func (*Endpoint) IsAuthenticated

func (e *Endpoint) IsAuthenticated() bool

IsAuthenticated returns whether the current SDK instance has successfully authenticated

type Event

type Event struct {
	Type struct {
		ID    int    `json:"id,omitempty"`
		Value string `json:"value,omitempty"`
	} `json:"type,omitempty"`
	From struct {
		Status struct {
			ID    int    `json:"id,omitempty"`
			Value string `json:"value,omitempty"`
		} `json:"status,omitempty"`
		CloseReason            interface{} `json:"closeReason,omitempty"`
		DuplicateSubmissionURL string      `json:"duplicateSubmissionUrl,omitempty"`
		UserID                 string      `json:"userId,omitempty"`
		UserName               string      `json:"userName,omitempty"`
		AvatarURL              string      `json:"avatarUrl,omitempty"`
		Email                  string      `json:"email,omitempty"`
		Role                   string      `json:"role,omitempty"`
		DuplicateInfo          struct {
			ParentSubmissionCode interface{} `json:"parentSubmissionCode,omitempty"`
			ChildSubmissionCodes interface{} `json:"childSubmissionCodes,omitempty"`
		} `json:"duplicateInfo,omitempty"`
	} `json:"from,omitempty"`
	To struct {
		Status struct {
			ID    int    `json:"id,omitempty"`
			Value string `json:"value,omitempty"`
		} `json:"status,omitempty"`
		CloseReason            interface{} `json:"closeReason,omitempty"`
		DuplicateSubmissionURL string      `json:"duplicateSubmissionUrl,omitempty"`
		UserID                 string      `json:"userId,omitempty"`
		UserName               string      `json:"userName,omitempty"`
		AvatarURL              string      `json:"avatarUrl,omitempty"`
		Email                  string      `json:"email,omitempty"`
		Role                   string      `json:"role,omitempty"`
		DuplicateInfo          struct {
			ParentSubmissionCode interface{} `json:"parentSubmissionCode,omitempty"`
			ChildSubmissionCodes interface{} `json:"childSubmissionCodes,omitempty"`
		} `json:"duplicateInfo,omitempty"`
	} `json:"to,omitempty"`
	Message                string       `json:"message,omitempty"`
	Attachments            []Attachment `json:"attachments,omitempty"`
	DestroyMessageMetadata interface{}  `json:"destroyMessageMetadata,omitempty"`
	LastEditedAt           int64        `json:"lastEditedAt,omitempty"`
	DeletedAt              int64        `json:"deletedAt,omitempty"`
	CreatedAt              int64        `json:"createdAt"`
	Visibility             interface{}  `json:"visibility"`
	User                   User         `json:"user,omitempty"`
	Amount                 struct {
		Value    float64 `json:"value,omitempty"`
		Currency string  `json:"currency,omitempty"`
	} `json:"amount,omitempty"`
	PayoutType struct {
		ID    int    `json:"id,omitempty"`
		Value string `json:"value,omitempty"`
	} `json:"payoutType"`
	PayoutID string `json:"payoutId,omitempty"`
}

type Payout

type Payout struct {
	ID          string `json:"id"`
	Originators struct {
		ProgramID       string      `json:"programId"`
		PentestCode     interface{} `json:"pentestCode"`
		SubmissionCode  string      `json:"submissionCode"`
		RewardRequestID interface{} `json:"rewardRequestId"`
	} `json:"originators"`
	Amount struct {
		Value    float64 `json:"value"`
		Currency string  `json:"currency"`
	} `json:"amount"`
	Type struct {
		ID    int    `json:"id"`
		Value string `json:"value"`
	} `json:"type"`
	Researcher struct {
		Ranking struct {
			Rank       int `json:"rank"`
			Reputation int `json:"reputation"`
			Streak     struct {
				ID    int    `json:"id"`
				Value string `json:"value"`
			} `json:"streak"`
		} `json:"ranking"`
		IdentityChecked bool        `json:"identityChecked"`
		UserID          string      `json:"userId"`
		UserName        string      `json:"userName"`
		AvatarURL       interface{} `json:"avatarUrl"`
		Role            string      `json:"role"`
	} `json:"researcher"`
	Status struct {
		ID    int    `json:"id"`
		Value string `json:"value"`
	} `json:"status"`
	CreatedAt     int `json:"createdAt"`
	PaidAt        int `json:"paidAt"`
	LastUpdatedAt int `json:"lastUpdatedAt"`
}

type Program

type Program struct {
	ProgramID     string `json:"programId"`
	Handle        string `json:"handle"`
	Name          string `json:"name"`
	CompanyID     string `json:"companyId"`
	CompanyHandle string `json:"companyHandle"`
	Description   string `json:"description"`
	Options       []struct {
		ID    int    `json:"id"`
		Value string `json:"value"`
	} `json:"options"`
	State struct {
		Status struct {
			ID    int    `json:"id"`
			Value string `json:"value"`
		} `json:"status"`
		LastStatusTriggerID struct {
			ID    int    `json:"id"`
			Value string `json:"value"`
		} `json:"lastStatusTriggerId"`
	} `json:"state"`
	ConfidentialityLevel struct {
		ID    int    `json:"id"`
		Value string `json:"value"`
	} `json:"confidentialityLevel"`
	MaxConfidentialityLevel struct {
		ID    int    `json:"id"`
		Value string `json:"value"`
	} `json:"maxConfidentialityLevel"`
	LogoURL string `json:"logoUrl"`
	Domain  []struct {
		ID   string `json:"id"`
		Type struct {
			ID    int    `json:"id"`
			Value string `json:"value"`
		} `json:"type"`
		Endpoint string `json:"endpoint"`
		Tier     struct {
			ID    int    `json:"id"`
			Value string `json:"value"`
		} `json:"tier"`
		Description string `json:"description"`
	} `json:"domain"`
	InScope             interface{}   `json:"inScope"`
	OutOfScope          interface{}   `json:"outOfScope"`
	Faq                 interface{}   `json:"faq"`
	SeverityAssessment  interface{}   `json:"severityAssessment"`
	RulesOfEngagement   interface{}   `json:"rulesOfEngagement"`
	SubmissionQuestions []interface{} `json:"submissionQuestions"`
	Bounties            []interface{} `json:"bounties"`
	AttachmentCount     int           `json:"attachmentCount"`
	BugBounty           struct {
		AutoSuspendThreshold struct {
			Value    float64 `json:"value"`
			Currency string  `json:"currency"`
		} `json:"autoSuspendThreshold"`
		LeaderboardVisibility struct {
			ID    int    `json:"id"`
			Value string `json:"value"`
		} `json:"leaderboardVisibility"`
	} `json:"bugBounty"`
	Type struct {
		ID    int    `json:"id"`
		Value string `json:"value"`
	} `json:"type"`
	ProgramBudget                interface{} `json:"programBudget"`
	TacRequired                  bool        `json:"tacRequired"`
	TacEmpty                     bool        `json:"tacEmpty"`
	IdentityCheckedRequired      bool        `json:"identityCheckedRequired"`
	SkipTriage                   bool        `json:"skipTriage"`
	AwardRep                     bool        `json:"awardRep"`
	AllowResearcherCollaboration bool        `json:"allowResearcherCollaboration"`
	DefaultAssignee              struct {
		UserID    string `json:"userId"`
		UserName  string `json:"userName"`
		AvatarURL string `json:"avatarUrl"`
		Role      string `json:"role"`
		Email     string `json:"email"`
	} `json:"defaultAssignee"`
	CreatedAt     int `json:"createdAt"`
	LastUpdatedAt int `json:"lastUpdatedAt"`
	WebLinks      struct {
		Details     string `json:"details"`
		Submissions string `json:"submissions"`
	} `json:"webLinks"`
}

type ProgramOld added in v2.1.4

type ProgramOld struct {
	ID            string `json:"id"`
	Handle        string `json:"handle"`
	CompanyID     string `json:"companyId"`
	CompanyHandle string `json:"companyHandle"`
	LogoURL       string `json:"logoUrl"`
	Name          string `json:"name"`
	Status        struct {
		ID    int    `json:"id"`
		Value string `json:"value"`
	} `json:"status"`
	ConfidentialityLevel struct {
		ID    int    `json:"id"`
		Value string `json:"value"`
	} `json:"confidentialityLevel"`
	WebLinks struct {
		Details string `json:"details"`
	} `json:"webLinks"`
	Type struct {
		ID    int    `json:"id"`
		Value string `json:"value"`
	} `json:"type"`
}

type Submission

type Submission struct {
	Code        string `json:"code"`
	Originators struct {
		ProgramID   string `json:"programId"`
		PentestCode string `json:"pentestCode"`
	} `json:"originators"`
	ProgramDetails    Program `json:"program"`
	InternalReference struct {
		Reference string `json:"reference"`
		URL       string `json:"url"`
	} `json:"internalReference"`
	Title  string `json:"title"`
	Report struct {
		OriginalTitle string `json:"originalTitle"`
		Type          struct {
			Name     string `json:"name"`
			Category string `json:"category"`
			Cwe      string `json:"cwe"`
		} `json:"type"`
		Questions []struct {
			Question string `json:"question"`
			Type     struct {
				ID    int    `json:"id"`
				Value string `json:"value"`
			} `json:"type"`
			Answer string `json:"answer"`
		} `json:"questions"`
		Domain struct {
			Name       string `json:"name"`
			Motivation string `json:"motivation"`
			Type       struct {
				ID    int    `json:"id"`
				Value string `json:"value"`
			} `json:"type"`
			Tier struct {
				ID    int    `json:"id"`
				Value string `json:"value"`
			} `json:"tier"`
			Description string `json:"description"`
		} `json:"domain"`
		EndpointVulnerableComponent string       `json:"endpointVulnerableComponent"`
		PocDescription              string       `json:"pocDescription"`
		Impact                      string       `json:"impact"`
		PersonalData                bool         `json:"personalData"`
		RecommendedSolution         string       `json:"recommendedSolution"`
		Attachments                 []Attachment `json:"attachments"`
		IP                          string       `json:"ip"`
	} `json:"report"`
	State struct {
		Status struct {
			ID    int    `json:"id"`
			Value string `json:"value"`
		} `json:"status"`
		CloseReason struct {
			ID    int    `json:"id"`
			Value string `json:"value"`
		} `json:"closeReason"`
		DuplicateInfo interface{} `json:"duplicateInfo"`
		ValidatedAt   int         `json:"validatedAt"`
		AcceptedAt    int         `json:"acceptedAt"`
		ClosedAt      int         `json:"closedAt"`
		ArchivedAt    int         `json:"archivedAt"`
	} `json:"state"`
	Severity struct {
		ID     int    `json:"id"`
		Vector string `json:"vector"`
		Value  string `json:"value"`
	} `json:"severity"`
	AwaitingFeedback bool `json:"awaitingFeedback"`
	Reward           struct {
		TotalPayout struct {
			Value    float64 `json:"value"`
			Currency string  `json:"currency"`
		} `json:"totalPayout"`
		TotalBountyPayout struct {
			Value    float64 `json:"value"`
			Currency string  `json:"currency"`
		} `json:"totalBountyPayout"`
		TotalBonusPayout struct {
			Value    float64 `json:"value"`
			Currency string  `json:"currency"`
		} `json:"totalBonusPayout"`
		PossibleBounty struct {
			Value    float64 `json:"value"`
			Currency string  `json:"currency"`
		} `json:"possibleBounty"`
	} `json:"reward"`
	CreatedAt int        `json:"createdAt"`
	Destroyed *Destroyed `json:"-,omitempty"`
	Assignee  User       `json:"assignee"`
	Tags      []string   `json:"tags"`
	GroupID   string     `json:"groupId"`
	Submitter struct {
		UserID    string `json:"userId"`
		UserName  string `json:"userName"`
		AvatarURL string `json:"avatarUrl"`
		Role      string `json:"role"`
		Ranking   struct {
			Rank       int `json:"rank"`
			Reputation int `json:"reputation"`
			Streak     struct {
				ID    int    `json:"id"`
				Value string `json:"value"`
			} `json:"streak"`
		} `json:"ranking"`
		IdentityChecked bool `json:"identityChecked"`
	} `json:"submitter"`
	LastUpdated struct {
		LastUpdater struct {
			UserID    string `json:"userId"`
			UserName  string `json:"userName"`
			AvatarURL string `json:"avatarUrl"`
			Role      string `json:"role"`
		} `json:"lastUpdater"`
		LastUpdatedAt int `json:"lastUpdatedAt"`
	} `json:"lastUpdated"`
	AttachmentCount int `json:"attachmentCount"`
	WebLinks        struct {
		Details string `json:"details"`
	} `json:"webLinks"`
	IntegrationCount int `json:"integrationCount"`
	// custom fields added by Radu Boian
	Payouts []Payout `json:"payouts"`
	Events  []Event  `json:"events"`
}

json-to-go from https://api.intigriti.com/external/swagger/index.html?urls.primaryName=V1.2#/Submissions/Submissions_Get

func (*Submission) IsActive

func (s *Submission) IsActive() bool

func (*Submission) IsClosed

func (s *Submission) IsClosed() bool

type SubmissionGeneral added in v2.0.8

type SubmissionGeneral struct {
	Code        string `json:"code"`
	Originators struct {
		ProgramID   string      `json:"programId"`
		PentestCode interface{} `json:"pentestCode"`
	} `json:"originators"`
	InternalReference interface{} `json:"internalReference"`
	Title             string      `json:"title"`
	Severity          struct {
		ID     int         `json:"id"`
		Vector interface{} `json:"vector"`
		Value  string      `json:"value"`
	} `json:"severity"`
	State struct {
		Status struct {
			ID    int    `json:"id"`
			Value string `json:"value"`
		} `json:"status"`
		CloseReason struct {
			ID    int    `json:"id"`
			Value string `json:"value"`
		} `json:"closeReason"`
	} `json:"state"`
	TotalPayout struct {
		Value    float64 `json:"value"`
		Currency string  `json:"currency"`
	} `json:"totalPayout"`
	CreatedAt        int           `json:"createdAt"`
	LastUpdatedAt    int           `json:"lastUpdatedAt"`
	AwaitingFeedback bool          `json:"awaitingFeedback"`
	Destroyed        bool          `json:"destroyed"`
	Assignee         interface{}   `json:"assignee"`
	Tags             []interface{} `json:"tags"`
	GroupID          interface{}   `json:"groupId"`
	Submitter        struct {
		Ranking struct {
			Rank       int         `json:"rank"`
			Reputation int         `json:"reputation"`
			Streak     interface{} `json:"streak"`
		} `json:"ranking"`
		IdentityChecked bool        `json:"identityChecked"`
		UserID          string      `json:"userId"`
		UserName        string      `json:"userName"`
		AvatarURL       interface{} `json:"avatarUrl"`
		Role            string      `json:"role"`
	} `json:"submitter"`
	CollaboratorCount int `json:"collaboratorCount"`
	WebLinks          struct {
		Details string `json:"details"`
	} `json:"webLinks"`
}

type TaggedRoundTripper

type TaggedRoundTripper struct {
	Proxied http.RoundTripper
	Logger  *logrus.Logger
}

func (TaggedRoundTripper) RoundTrip

func (t TaggedRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip injects a http request header on every request and logs request/response

type TimeStamp

type TimeStamp struct {
	time.Time
}

func (*TimeStamp) UnmarshalJSON

func (s *TimeStamp) UnmarshalJSON(bytes []byte) error

type User

type User struct {
	UserID    string `json:"userId"`
	UserName  string `json:"userName"`
	AvatarURL string `json:"avatarUrl"`
	Role      string `json:"role"`
	Email     string `json:"email"`
}

Jump to

Keyboard shortcuts

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