h1

package
v0.0.0-...-dec58da Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package h1 provides a client for the HackerOne API. Usage:

import "github.com/uber-go/hackeroni/h1"

Construct a new HackerOne client, then use the various services on the client to access different parts of the HackerOne API. For example:

authTransport := h1.APIAuthTransport{
	APIIdentifier: "your-h1-api-token-identifier",
	APIToken: "big-long-api-token-from-h1",
}
client := authTransport.NewClient(tp.Client())

report, _, err := client.Report.Get("123456")
if err != nil {
	panic(err)
}

fmt.Println("Report Title:", *report.Title)

Authentication

The h1 library does not directly handle authentication. Instead, when creating a new client, you can pass a http.Client that handles authentication for you. It does provide a APIAuthTransport structure when using API Token authentication.

Pagination

All requests for listing resources such as `Report` support pagination. Pagination options are described in the h1.ListOptions struct and passed to the list methods as an optional parameter. Pages information is available via the h1.ResponseLinks struct embedded in the h1.Response struct.

filter := h1.ReportListFilter{
	Program: []string{"uber"},
}
var listOpts h1.ListOptions

var allReports []h1.Report
for {
	reports, resp, err := client.Report.List(filter, &listOpts)
	if err != nil {
		panic(err)
	}
	allReports = append(allReports, reports...)
	if resp.Links.Next == "" {
		break
	}
	listOpts.Page = resp.Links.NextPageNumber()
}

Index

Constants

View Source
const (
	AddressTShirtSizeSmall   string = "Small"
	AddressTShirtSizeMedium  string = "Medium"
	AddressTShirtSizeLarge   string = "Large"
	AddressTShirtSizeXLarge  string = "X-Large"
	AddressTShirtSizeXXLarge string = "XX-Large"
)

AddressTShirtSize represent possible T-Shirt sizes for an address

HackerOne API docs: https://api.hackerone.com/docs/v1#address

View Source
const (
	GroupPermissionRewardManagement  string = "reward_management"
	GroupPermissionProgramManagement string = "program_management"
	GroupPermissionUserManagement    string = "user_management"
	GroupPermissionReportManagement  string = "report_management"
)

GroupPermission represent possible permissions sizes for a group

HackerOne API docs: https://api.hackerone.com/docs/v1#group

View Source
const (
	MemberPermissionRewardManagement  string = "reward_management"
	MemberPermissionProgramManagement string = "program_management"
	MemberPermissionUserManagement    string = "user_management"
	MemberPermissionReportManagement  string = "report_management"
)

MemberPermission represent possible permissions sizes for a member

HackerOne API docs: https://api.hackerone.com/docs/v1#member

View Source
const (
	ReportSummaryCategoryResearcher string = "researcher"
	ReportSummaryCategoryTeam       string = "team"
)

ReportSummaryCategory represent possible categorys for a report summary

HackerOne API docs: https://api.hackerone.com/docs/v1#report-summary

View Source
const (
	ReportStateNew           string = "new"
	ReportStateTriaged       string = "triaged"
	ReportStateNeedsMoreInfo string = "needs-more-info"
	ReportStateResolved      string = "resolved"
	ReportStateNotApplicable string = "not-applicable"
	ReportStateInformative   string = "informative"
	ReportStateDuplicate     string = "duplicate"
	ReportStateSpam          string = "spam"
)

ReportState represent possible states for a report

HackerOne API docs: https://api.hackerone.com/docs/v1#report

View Source
const (
	ActivityAgreedOnGoingPublicType             string = "activity-agreed-on-going-public"
	ActivityBountyAwardedType                   string = "activity-bounty-awarded"
	ActivityBountySuggestedType                 string = "activity-bounty-suggested"
	ActivityBugClonedType                       string = "activity-bug-cloned"
	ActivityBugDuplicateType                    string = "activity-bug-duplicate"
	ActivityBugFiledType                        string = "activity-bug-filed"
	ActivityBugInformativeType                  string = "activity-bug-informative"
	ActivityBugNeedsMoreInfoType                string = "activity-bug-needs-more-info"
	ActivityBugNewType                          string = "activity-bug-new"
	ActivityBugNotApplicableType                string = "activity-bug-not-applicable"
	ActivityBugReopenedType                     string = "activity-bug-reopened"
	ActivityBugResolvedType                     string = "activity-bug-resolved"
	ActivityBugSpamType                         string = "activity-bug-spam"
	ActivityBugTriagedType                      string = "activity-bug-triaged"
	ActivityCommentType                         string = "activity-comment"
	ActivityExternalUserInvitationCancelledType string = "activity-external-user-invitation-cancelled"
	ActivityExternalUserInvitedType             string = "activity-external-user-invited"
	ActivityExternalUserJoinedType              string = "activity-external-user-joined"
	ActivityExternalUserRemovedType             string = "activity-external-user-removed"
	ActivityGroupAssignedToBugType              string = "activity-group-assigned-to-bug"
	ActivityHackerRequestedMediationType        string = "activity-hacker-requested-mediation"
	ActivityManuallyDisclosedType               string = "activity-manually-disclosed"
	ActivityMediationRequestedType              string = "activity-mediation-requested"
	ActivityNotEligibleForBountyType            string = "activity-not-eligible-for-bounty"
	ActivityReferenceIDAddedType                string = "activity-reference-id-added"
	ActivityReportBecamePublicType              string = "activity-report-became-public"
	ActivityReportTitleUpdatedType              string = "activity-report-title-updated"
	ActivityReportVulnerabilityTypesUpdatedType string = "activity-report-vulnerability-types-updated"
	ActivityReportSeverityUpdatedType           string = "activity-report-severity-updated"
	ActivitySwagAwardedType                     string = "activity-swag-awarded"
	ActivityUserAssignedToBugType               string = "activity-user-assigned-to-bug"
	ActivityUserBannedFromProgramType           string = "activity-user-banned-from-program"
	AddressType                                 string = "address"
	AttachmentType                              string = "attachment"
	BountyType                                  string = "bounty"
	GroupType                                   string = "group"
	ProgramType                                 string = "program"
	ReportSummaryType                           string = "report-summary"
	MemberType                                  string = "member"
	ReportType                                  string = "report"
	SwagType                                    string = "swag"
	SeverityType                                string = "severity"
	UserType                                    string = "user"
	VulnerabilityTypeType                       string = "vulnerability-type"
	WeaknessType                                string = "weakness"
)

Type represent the possible values for the "Type" attribute

View Source
const (
	SeverityRatingNone              string = "none"
	SeverityRatingLow               string = "low"
	SeverityRatingMedium            string = "medium"
	SeverityRatingHigh              string = "high"
	SeverityAuthorTypeUser          string = "User"
	SeverityAuthorTypeTeam          string = "Team"
	SeverityAttackVectorNetwork     string = "network"
	SeverityAttackVectorAdjacent    string = "adjacent"
	SeverityAttackVectorLocal       string = "local"
	SeverityAttackVectorPhysical    string = "physical"
	SeverityAttackComplexityLow     string = "low"
	SeverityAttackComplexityHigh    string = "high"
	SeverityPrivilegesRequiredLow   string = "low"
	SeverityPrivilegesRequiredHigh  string = "high"
	SeverityUserInteractionNone     string = "none"
	SeverityUserInteractionRequired string = "required"
	SeverityScopeUnchanged          string = "unchanged"
	SeverityScopeChanged            string = "changed"
	SeverityConfidentialityLow      string = "low"
	SeverityConfidentialityHigh     string = "high"
	SeverityIntegrityLow            string = "low"
	SeverityIntegrityHigh           string = "high"
	SeverityAvailabilityLow         string = "low"
	SeverityAvailabilityHigh        string = "high"
)

SeverityRating represent possible severity ratings

HackerOne API docs: https://api.hackerone.com/docs/v1#severity

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool allocates a new bool value to store v at and returns a pointer to it.

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse determines if the given http.Response was an error and converts it to a h1.ErrorResponse if so

func Float64

func Float64(v float64) *float64

Float64 allocates a new float64 value to store v at and returns a pointer to it.

func Int

func Int(v int) *int

Int allocates a new bool value to store v at and returns a pointer to it.

func String

func String(v string) *string

String allocates a new bool value to store v at and returns a pointer to it.

func Uint64

func Uint64(v uint64) *uint64

Uint64 allocates a new uint64 value to store v at and returns a pointer to it.

Types

type APIAuthTransport

type APIAuthTransport struct {
	APIIdentifier string // API Identifier
	APIToken      string // API Token

	// Transport is the underlying HTTP transport to use when making requests.
	// It will default to http.DefaultTransport if nil.
	Transport http.RoundTripper
}

APIAuthTransport is an http.RoundTripper that authenticates all requests using HTTP Basic Authentication using the provided identifier and token.

func (*APIAuthTransport) Client

func (t *APIAuthTransport) Client() *http.Client

Client returns an *http.Client that makes requests that are authenticated using HTTP Basic Authentication.

func (*APIAuthTransport) RoundTrip

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

RoundTrip implements the RoundTripper interface.

type Activity

type Activity struct {
	ID          *string         `json:"id"`
	Type        *string         `json:"type"`
	Message     *string         `json:"message"`
	Internal    *bool           `json:"internal"`
	CreatedAt   *Timestamp      `json:"created_at"`
	UpdatedAt   *Timestamp      `json:"updated_at"`
	RawActor    json.RawMessage `json:"actor"` // Used by the Actor() method
	Attachments []Attachment    `json:"attachments,omitempty"`
	// contains filtered or unexported fields
}

Activity represents activities that have occured in a given report.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity

func (*Activity) Activity

func (a *Activity) Activity() (activity interface{})

Activity returns the parsed activity. For recognized activity types, a value of the corresponding struct type will be returned.

func (*Activity) Actor

func (a *Activity) Actor() (actor interface{})

Actor returns returns the parsed actor. For recognized actor types, a value of the corresponding struct type will be returned.

func (*Activity) Report

func (a *Activity) Report() *Report

Report returns the report this activity is a child of

func (*Activity) UnmarshalJSON

func (a *Activity) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityBountyAwarded

type ActivityBountyAwarded struct {
	BountyAmount *string `json:"bounty_amount"`
	BonusAmount  *string `json:"bonus_amount"`
}

ActivityBountyAwarded occurs when a bounty is awarded.

HackerOne API docs:https://api.hackerone.com/docs/v1#activity-bounty-awarded

func (*ActivityBountyAwarded) UnmarshalJSON

func (a *ActivityBountyAwarded) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityBountySuggested

type ActivityBountySuggested struct {
	BountyAmount *string `json:"bounty_amount"`
	BonusAmount  *string `json:"bonus_amount"`
}

ActivityBountySuggested occurs when a bounty is suggested.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-bounty-suggested

func (*ActivityBountySuggested) UnmarshalJSON

func (a *ActivityBountySuggested) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityBugCloned

type ActivityBugCloned struct {
	OriginalReportID *int `json:"original_report_id"`
}

ActivityBugCloned occurs when a bug is cloned.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-bug-cloned

func (*ActivityBugCloned) UnmarshalJSON

func (a *ActivityBugCloned) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityBugTriaged

type ActivityBugTriaged struct {
	Message *string `json:"message"`
}

ActivityBugTriaged occurs when a bug is triaged.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-bug-triaged

func (*ActivityBugTriaged) UnmarshalJSON

func (a *ActivityBugTriaged) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityComment

type ActivityComment struct {
	Message *string `json:"message"`
}

ActivityComment occurs when a comment is added.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-comment

func (*ActivityComment) UnmarshalJSON

func (a *ActivityComment) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityExternalUserInvitationCancelled

type ActivityExternalUserInvitationCancelled struct {
	Email *string `json:"email"`
}

ActivityExternalUserInvitationCancelled occurs when a external user's invitiation is cancelled.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-external-user-invitation-cancelled

func (*ActivityExternalUserInvitationCancelled) UnmarshalJSON

func (a *ActivityExternalUserInvitationCancelled) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityExternalUserInvited

type ActivityExternalUserInvited struct {
	Email *string `json:"email"`
}

ActivityExternalUserInvited occurs when a external user is invited.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-external-user-invited

func (*ActivityExternalUserInvited) UnmarshalJSON

func (a *ActivityExternalUserInvited) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityExternalUserJoined

type ActivityExternalUserJoined struct {
	DuplicateReportID *int `json:"duplicate_report_id"`
}

ActivityExternalUserJoined occurs when a external user joins.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-external-user-joined

func (*ActivityExternalUserJoined) UnmarshalJSON

func (a *ActivityExternalUserJoined) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityExternalUserRemoved

type ActivityExternalUserRemoved struct {
	RemovedUser *User `json:"removed_user"`
}

ActivityExternalUserRemoved occurs when a external user is removed

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-external-user-removed

func (*ActivityExternalUserRemoved) UnmarshalJSON

func (a *ActivityExternalUserRemoved) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityGroupAssignedToBug

type ActivityGroupAssignedToBug struct {
	Group *Group `json:"group"`
}

ActivityGroupAssignedToBug occurs when a group is assigned to a report.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-group-assigned-to-bug

func (*ActivityGroupAssignedToBug) UnmarshalJSON

func (a *ActivityGroupAssignedToBug) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityHackerRequestedMediation

type ActivityHackerRequestedMediation struct {
	Message *string `json:"message"`
}

ActivityHackerRequestedMediation occurs when a hacker requests mediation.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-bounty-suggested

func (*ActivityHackerRequestedMediation) UnmarshalJSON

func (a *ActivityHackerRequestedMediation) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityMediationRequested

type ActivityMediationRequested struct {
	Message *string `json:"message"`
}

ActivityMediationRequested occurs when occurs when a mediation is requested.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-bounty-suggested

func (*ActivityMediationRequested) UnmarshalJSON

func (a *ActivityMediationRequested) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityReferenceIDAdded

type ActivityReferenceIDAdded struct {
	Reference    *string `json:"reference"`
	ReferenceURL *string `json:"reference_url"`
}

ActivityReferenceIDAdded occurs when a reference id/url is added to a report.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-reference-id-added

func (*ActivityReferenceIDAdded) UnmarshalJSON

func (a *ActivityReferenceIDAdded) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityReportTitleUpdated

type ActivityReportTitleUpdated struct {
	OldTitle *string `json:"old_title"`
	NewTitle *string `json:"new_title"`
}

ActivityReportTitleUpdated occurs when report title is updated

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-report-title-updated

func (*ActivityReportTitleUpdated) UnmarshalJSON

func (a *ActivityReportTitleUpdated) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityReportVulnerabilityTypesUpdated

type ActivityReportVulnerabilityTypesUpdated struct {
	OldVulnerabilityTypes []VulnerabilityType `json:"old_vulnerability_types"`
	NewVulnerabilityTypes []VulnerabilityType `json:"new_vulnerability_types"`
}

ActivityReportVulnerabilityTypesUpdated occurs when vulnerability types for a report are updated.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-report-vulnerability-types-updated

func (*ActivityReportVulnerabilityTypesUpdated) UnmarshalJSON

func (a *ActivityReportVulnerabilityTypesUpdated) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivitySwagAwarded

type ActivitySwagAwarded struct {
	Swag *Swag `json:"swag"`
}

ActivitySwagAwarded occurs when swag is awarded

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-swag-awarded

func (*ActivitySwagAwarded) UnmarshalJSON

func (a *ActivitySwagAwarded) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityUserAssignedToBug

type ActivityUserAssignedToBug struct {
	AssignedUser *User `json:"assigned_user"`
}

ActivityUserAssignedToBug occurs when a user is assigned to a report.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-user-assigned-to-bug

func (*ActivityUserAssignedToBug) UnmarshalJSON

func (a *ActivityUserAssignedToBug) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ActivityUserBannedFromProgram

type ActivityUserBannedFromProgram struct {
	RemovedUser *User `json:"removed_user"`
}

ActivityUserBannedFromProgram occurs when a user is banned from a program.

HackerOne API docs: https://api.hackerone.com/docs/v1#activity-user-banned-from-program

func (*ActivityUserBannedFromProgram) UnmarshalJSON

func (a *ActivityUserBannedFromProgram) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type Address

type Address struct {
	ID          *string    `json:"id"`
	Type        *string    `json:"type"`
	Name        *string    `json:"name"`
	Street      *string    `json:"street"`
	City        *string    `json:"city"`
	PostalCode  *string    `json:"postal_code"`
	State       *string    `json:"state"`
	Country     *string    `json:"country"`
	TShirtSize  *string    `json:"tshirt_size,omitempty"`
	PhoneNumber *string    `json:"phone_number,omitempty"`
	CreatedAt   *Timestamp `json:"created_at"`
}

Address represents an address for a user.

HackerOne API docs: https://api.hackerone.com/docs/v1#address

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type Attachment

type Attachment struct {
	ID          *string    `json:"id"`
	Type        *string    `json:"type"`
	FileName    *string    `json:"file_name"`
	ContentType *string    `json:"content_type"`
	FileSize    *int       `json:"file_size"`
	ExpiringURL *string    `json:"expiring_url"`
	CreatedAt   *Timestamp `json:"created_at"`
}

Attachment represents an attachment (typically to a report or comment).

HackerOne API docs: https://api.hackerone.com/docs/v1#attachment

func (*Attachment) UnmarshalJSON

func (a *Attachment) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type Bounty

type Bounty struct {
	ID          *string    `json:"id"`
	Type        *string    `json:"type"`
	Amount      *string    `json:"amount"`
	BonusAmount *string    `json:"bonus_amount"`
	CreatedAt   *Timestamp `json:"created_at"`
}

Bounty represents a bounty awarded.

HackerOne API docs: https://api.hackerone.com/docs/v1#bounty

func (*Bounty) UnmarshalJSON

func (bo *Bounty) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type Client

type Client struct {

	// Base URL for API requests. Defaults to the public H1 API. BaseURL should always be specified with a trailing slash.
	BaseURL *url.URL

	// User agent used when communicating with the H1 API.
	UserAgent string

	// Services used for talking to different parts of the H1 API.
	Report  *ReportService
	Program *ProgramService
	// contains filtered or unexported fields
}

A Client manages communication with the H1 API.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new H1 API client. If a nil httpClient is provided, http.DefaultClient will be used.

func (*Client) Do

func (c *Client) Do(req *http.Request, resource interface{}) (*Response, error)

Do sends an API request and returns the API response.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr

type Error

type Error struct {
	Status uint        `json:"status"`
	Title  string      `json:"title"`
	Detail string      `json:"detail"`
	Source ErrorSource `json:"source"`
}

Error represents an Error from the JSONAPI specification.

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response // HTTP response that caused this error
	Errors   []Error        `json:"errors"` // The individual errors that occured
}

ErrorResponse wraps a http.Response and is returned when the API returns an error.

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

ErrorResponse needs to implement Error to be a valid error type.

type ErrorSource

type ErrorSource struct {
	Parameter string `json:"parameter"`
}

ErrorSource represents an ErrorSource from the JSONAPI specification.

type Group

type Group struct {
	ID          *string    `json:"id"`
	Type        *string    `json:"type"`
	Name        *string    `json:"name"`
	Permissions []*string  `json:"permissions"`
	CreatedAt   *Timestamp `json:"created_at"`
}

Group represents a group of users.

HackerOne API docs: https://api.hackerone.com/docs/v1#group

func (*Group) UnmarshalJSON

func (g *Group) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ListOptions

type ListOptions struct {
	// For paginated results which page to retrieve.
	Page uint64 `url:"page[number],omitempty"`

	// For paginated results the size of pages to retrieve
	PageSize uint64 `url:"page[size],omitempty"`

	// For lists the index to sort by
	Sort string `url:"sort,omitempty"`
}

ListOptions specifies the optional parameters to various List methods that support pagination.

type Member

type Member struct {
	ID          *string    `json:"id"`
	Type        *string    `json:"type"`
	Permissions []*string  `json:"permissions"`
	CreatedAt   *Timestamp `json:"created_at"`
	User        *User      `json:"user"`
}

Member represents a user in a program

HackerOne API docs: https://api.hackerone.com/docs/v1#member

func (*Member) UnmarshalJSON

func (m *Member) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type Program

type Program struct {
	ID        *string    `json:"id"`
	Type      *string    `json:"type"`
	Handle    *string    `json:"handle"`
	CreatedAt *Timestamp `json:"created_at"`
	UpdatedAt *Timestamp `json:"updated_at"`
	Groups    []*Group   `json:"groups,omitempty"`
	Members   []*Member  `json:"member,omitempty"`
}

Program represents a overall program.

HackerOne API docs: https://api.hackerone.com/docs/v1#program

func (*Program) UnmarshalJSON

func (p *Program) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ProgramService

type ProgramService service

ProgramService handles communication with the program related methods of the H1 API.

func (*ProgramService) Get

func (s *ProgramService) Get(ID string) (*Program, *Response, error)

Get fetches a Program by ID

type Report

type Report struct {
	ID                       *string             `json:"id"`
	Type                     *string             `json:"type"`
	Title                    *string             `json:"title"`
	VulnerabilityInformation *string             `json:"vulnerability_information,omitempty"`
	State                    *string             `json:"state"`
	CreatedAt                *Timestamp          `json:"created_at"`
	TriagedAt                *Timestamp          `json:"triaged_at,omitempty"`
	ClosedAt                 *Timestamp          `json:"closed_at,omitempty"`
	LastReporterActivityAt   *Timestamp          `json:"last_reporter_activity_at,omitempty"`
	FirstProgramActivityAt   *Timestamp          `json:"first_program_activity_at,omitempty"`
	LastProgramActivityAt    *Timestamp          `json:"last_program_activity_at,omitempty"`
	LastActivityAt           *Timestamp          `json:"last_activity_at,omitempty"`
	BountyAwardedAt          *Timestamp          `json:"bounty_awarded_at,omitempty"`
	SwagAwardedAt            *Timestamp          `json:"swag_awarded_at,omitempty"`
	DisclosedAt              *Timestamp          `json:"disclosed_at,omitempty"`
	IssueTrackerReferenceID  *string             `json:"issue_tracker_reference_id,omitempty"`
	IssueTrackerReferenceURL *string             `json:"issue_tracker_reference_url,omitempty"`
	Program                  *Program            `json:"program"`
	RawAssignee              json.RawMessage     `json:"assignee,omitempty"` // Used by Assignee()
	Attachments              []Attachment        `json:"attachments,omitempty"`
	Swag                     []Swag              `json:"swag,omitempty"`
	VulnerabilityTypes       []VulnerabilityType `json:"vulnerability_types"`
	Severity                 *Severity           `json:"severity,omitempty"`
	Reporter                 *User               `json:"reporter,omitempty"`
	Activities               []Activity          `json:"activities,omitempty"`
	Bounties                 []Bounty            `json:"bounties,omitempty"`
	Summaries                []ReportSummary     `json:"summaries,omitempty"`
	Weakness                 *Weakness           `json:"weakness,omitempty"`
}

Report represents a report.

HackerOne API docs: https://api.hackerone.com/docs/v1#report

func (*Report) Assignee

func (r *Report) Assignee() (assignee interface{})

Assignee returns returns the parsed assignee. For recognized assignee types, a value of the corresponding struct type will be returned.

func (*Report) Participants

func (r *Report) Participants(internal bool) (participants []User)

Participants returns a list of participants in the report. It does not include the reporter

func (*Report) UnmarshalJSON

func (r *Report) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type ReportListFilter

type ReportListFilter struct {
	Program                           []string  `url:"program,brackets"`
	State                             []string  `url:"state,brackets,omitempty"`
	ID                                []uint64  `url:"id,brackets,omitempty"`
	CreatedAtGreaterThan              time.Time `url:"created_at__gt,omitempty"`
	CreatedAtLessThan                 time.Time `url:"created_at__lt,omitempty"`
	TriagedAtGreaterThan              time.Time `url:"triaged_at__gt,omitempty"`
	TriagedAtLessThan                 time.Time `url:"triaged_at__lt,omitempty"`
	TriagedAtNull                     bool      `url:"triaged_at__null,omitempty"`
	ClosedAtGreaterThan               time.Time `url:"closed_at__gt,omitempty"`
	ClosedAtLessThan                  time.Time `url:"closed_at__lt,omitempty"`
	ClosedAtNull                      bool      `url:"closed_at__null,omitempty"`
	DisclosedAtGreaterThan            time.Time `url:"disclosed_at__gt,omitempty"`
	DisclosedAtLessThan               time.Time `url:"disclosed_at__lt,omitempty"`
	DisclosedAtNull                   bool      `url:"disclosed_at__null,omitempty"`
	BountyAwardedAtGreaterThan        time.Time `url:"bounty_awarded_at__gt,omitempty"`
	BountyAwardedAtLessThan           time.Time `url:"bounty_awarded_at__lt,omitempty"`
	BountyAwardedAtNull               bool      `url:"bounty_awarded_at__null,omitempty"`
	SwagAtGreaterThan                 time.Time `url:"swag_at__gt,omitempty"`
	SwagAtLessThan                    time.Time `url:"swag_at__lt,omitempty"`
	SwagAtNull                        bool      `url:"swag_at__null,omitempty"`
	LastReporterActivityAtGreaterThan time.Time `url:"last_reporter_activity_at__gt,omitempty"`
	LastReporterActivityAtLessThan    time.Time `url:"last_reporter_activity_at__lt,omitempty"`
	LastReporterActivityAtNull        bool      `url:"last_reporter_activity_at__null,omitempty"`
	FirstProgramActivityAtGreaterThan time.Time `url:"first_program_activity_at__gt,omitempty"`
	FirstProgramActivityAtLessThan    time.Time `url:"first_program_activity_at__lt,omitempty"`
	FirstProgramActivityAtNull        bool      `url:"first_program_activity_at__null,omitempty"`
	LastProgramActivityAtGreaterThan  time.Time `url:"last_program_activity_at__gt,omitempty"`
	LastProgramActivityAtLessThan     time.Time `url:"last_program_activity_at__lt,omitempty"`
	LastActivityAtGreaterThan         time.Time `url:"last_activity_at__gt,omitempty"`
	LastActivityAtLessThan            time.Time `url:"last_activity_at__lt,omitempty"`
}

ReportListFilter specifies optional parameters to the ReportService.List method.

HackerOne API docs: https://api.hackerone.com/docs/v1#reports/query

type ReportService

type ReportService service

ReportService handles communication with the report related methods of the H1 API.

func (*ReportService) Get

func (s *ReportService) Get(ID string) (*Report, *Response, error)

Get fetches a Report by ID

func (*ReportService) List

func (s *ReportService) List(filterOpts ReportListFilter, listOpts *ListOptions) ([]Report, *Response, error)

List returns all Reports matching the specified criteria

HackerOne API docs: https://api.hackerone.com/docs/v1#reports/query

type ReportSummary

type ReportSummary struct {
	ID          *string      `json:"id"`
	Type        *string      `json:"type"`
	Content     *string      `json:"content"`
	Category    *string      `json:"category"`
	CreatedAt   *Timestamp   `json:"created_at"`
	UpdatedAt   *Timestamp   `json:"updated_at"`
	User        *User        `json:"user"`
	Attachments []Attachment `json:"attachments"`
}

ReportSummary represents a summary of a report.

HackerOne API docs: https://api.hackerone.com/docs/v1#report-summary

func (*ReportSummary) UnmarshalJSON

func (r *ReportSummary) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type Response

type Response struct {
	*http.Response

	// Links relating to the response
	Links ResponseLinks `json:"links"`
}

Response is a H1 API response. This wraps the standard http.Response and provides convenience fields for pagination

type ResponseLinks struct {
	First string `json:"first"`
	Prev  string `json:"prev"`
	Self  string `json:"self"`
	Next  string `json:"next"`
	Last  string `json:"last"`
}

ResponseLinks represents a JSONAPI ResponseLinks object

func (*ResponseLinks) FirstPageNumber

func (l *ResponseLinks) FirstPageNumber() uint64

FirstPageNumber extracts the page number from the ResponseLinks structure

func (*ResponseLinks) LastPageNumber

func (l *ResponseLinks) LastPageNumber() uint64

LastPageNumber extracts the page number from the ResponseLinks structure

func (*ResponseLinks) NextPageNumber

func (l *ResponseLinks) NextPageNumber() uint64

NextPageNumber extracts the page number from the ResponseLinks structure

func (*ResponseLinks) PrevPageNumber

func (l *ResponseLinks) PrevPageNumber() uint64

PrevPageNumber extracts the page number from the ResponseLinks structure

func (*ResponseLinks) SelfPageNumber

func (l *ResponseLinks) SelfPageNumber() uint64

SelfPageNumber extracts the page number from the ResponseLinks structure

type Severity

type Severity struct {
	ID                 *string    `json:"id"`
	Type               *string    `json:"type"`
	Rating             *string    `json:"rating"`
	AuthorType         *string    `json:"author_type"`
	UserID             *int       `json:"user_id"` // TODO: This is inconsistant with the rest of the API, maybe auto-cast to string
	Score              *float64   `json:"score,omitempty"`
	AttackVector       *string    `json:"attack_vector,omitempty"`
	AttackComplexity   *string    `json:"attack_complexity,omitempty"`
	PrivilegesRequired *string    `json:"privileges_required,omitempty"`
	UserInteraction    *string    `json:"user_interaction,omitempty"`
	Scope              *string    `json:"scope,omitempty"`
	Confidentiality    *string    `json:"confidentiality,omitempty"`
	Integrity          *string    `json:"integrity,omitempty"`
	Availability       *string    `json:"availability,omitempty"`
	CreatedAt          *Timestamp `json:"created_at"`
}

Severity represents a severity object

HackerOne API docs: https://api.hackerone.com/docs/v1#severity

func (*Severity) UnmarshalJSON

func (s *Severity) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type Swag

type Swag struct {
	ID        *string    `json:"id"`
	Type      *string    `json:"type"`
	Sent      *bool      `json:"sent"`
	CreatedAt *Timestamp `json:"created_at"`
	Address   *Address   `json:"address,omitempty"`
}

Swag represents swag that has/hasn't been sent to an address.

HackerOne API docs: https://api.hackerone.com/docs/v1#swag

func (*Swag) UnmarshalJSON

func (s *Swag) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp represents a time generated from a JSON string

func NewTimestamp

func NewTimestamp(date string) *Timestamp

NewTimestamp creates a new Timestamp object from a ISO8601 date string

func (Timestamp) String

func (t Timestamp) String() string

String calls time.Time's String method

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON helps unmarshal ISO8601 dates in JSON

type User

type User struct {
	ID             *string            `json:"id"`
	Type           *string            `json:"type"`
	Disabled       *bool              `json:"disabled"`
	Username       *string            `json:"username"`
	Name           *string            `json:"name"`
	ProfilePicture UserProfilePicture `json:"profile_picture"`
	Reputation     *uint64            `json:"reputation,omitempty"`
	Signal         *float64           `json:"signal,omitempty"`
	Impact         *float64           `json:"impact,omitempty"`
	CreatedAt      *Timestamp         `json:"created_at"`
}

User represents an individual user.

HackerOne API docs: https://api.hackerone.com/docs/v1#user

func (*User) UnmarshalJSON

func (u *User) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type UserProfilePicture

type UserProfilePicture struct {
	Size62x62   *string `json:"62x62"`
	Size82x82   *string `json:"82x82"`
	Size110x110 *string `json:"110x110"`
	Size260x260 *string `json:"260x260"`
}

UserProfilePicture is a nested struct of the User struct

type VulnerabilityType

type VulnerabilityType struct {
	ID          *string    `json:"id"`
	Type        *string    `json:"type"`
	Name        *string    `json:"name"`
	Description *string    `json:"description"`
	CreatedAt   *Timestamp `json:"created_at"`
}

VulnerabilityType represents a type of vulnerability.

HackerOne API docs: https://api.hackerone.com/docs/v1#vulnerablity-type

func (*VulnerabilityType) UnmarshalJSON

func (v *VulnerabilityType) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

type Weakness

type Weakness struct {
	ID          *string    `json:"id"`
	Type        *string    `json:"type"`
	Name        *string    `json:"name"`
	Description *string    `json:"description"`
	ExternalID  *string    `json:"external_id"`
	CreatedAt   *Timestamp `json:"created_at"`
}

Weakness represents a weakness object

HackerOne API docs: https://api.hackerone.com/docs/v1#weakness

func (*Weakness) UnmarshalJSON

func (w *Weakness) UnmarshalJSON(b []byte) error

UnmarshalJSON allows JSONAPI attributes and relationships to unmarshal cleanly.

Jump to

Keyboard shortcuts

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