Documentation ¶
Index ¶
- func Bool(v bool) *bool
- func CheckResponse(r *http.Response) error
- func Int(v int) *int
- func String(v string) *string
- type Activity
- type Attachment
- type Badge
- type Client
- type CommonResponse
- type ErrorResponse
- type Group
- type ProfilePictureURLs
- type Report
- type ReportAbilities
- type ReportBulkResponse
- type ReportChangeStateOptions
- type ReportCloseOptions
- type ReportService
- func (s *ReportService) ChangeState(id uint64, message string, state string, opts *ReportChangeStateOptions) (*ReportBulkResponse, *Response, error)
- func (s *ReportService) Close(id uint64, message string, state string, opts *ReportCloseOptions) (*ReportBulkResponse, *Response, error)
- func (s *ReportService) Comment(id uint64, message string, internal bool) (*ReportBulkResponse, *Response, error)
- func (s *ReportService) Create(handle string, report *Report) (*Response, error)
- func (s *ReportService) Get(id uint64) (*Report, *Response, error)
- type ReportSummary
- type Response
- type SessionService
- type SessionUser
- type Team
- type TeamProfile
- type TeamProfileMetrics
- type TeamService
- type Timestamp
- type User
- type UserService
- type UserTeamContext
- type VulnerabilityType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse determines if the given http.Response was an error and converts it to a h1.ErrorResponse if so
Types ¶
type Activity ¶
type Activity struct { ID *uint64 `json:"id"` Editable *bool `json:"editable"` IsInternal *bool `json:"is_internal"` Message *string `json:"message"` MarkdownMessage *string `json:"markdown_message"` AutomatedResponse *bool `json:"automated_response"` CreatedAt *Timestamp `json:"created_at"` UpdatedAt *Timestamp `json:"updated_at"` RawActor json.RawMessage `json:"actor"` AssignedUser *User `json:"assigned_user"` GeniusExecutionID *string `json:"genius_execution_id"` // TODO: This may be wrong type FileName *string `json:"file_name"` ExpiringURL *string `json:"expiring_url"` Type *string `json:"type"` }
Activity represents a report activity
type Attachment ¶
type Attachment struct { ID *uint64 `json:"id"` FileName *string `json:"file_name"` ExpiringURL *string `json:"expiring_url"` Type *string `json:"type"` }
Attachment represents a report attachment
type Client ¶
type Client struct { // Base URL for requests. Defaults to the public H1. BaseURL should always be specified with a trailing slash. BaseURL *url.URL // User agent used when communicating with H1. UserAgent string // Services used for talking to different parts of H1. Session *SessionService User *UserService Team *TeamService Report *ReportService // contains filtered or unexported fields }
A Client manages communication with the H1.
func NewClient ¶
NewClient returns a new client. If a nil httpClient is provided, http.DefaultClient will be used.
type CommonResponse ¶
type CommonResponse struct { ID *uint64 `json:"id"` Title *string `json:"title"` Message *string `json:"message"` }
CommonResponse represents a common ersponse object
type ErrorResponse ¶
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 Group ¶
type Group struct { ID *uint64 `json:"id"` Name *string `json:"name"` TeamMembersCount *uint64 `json:"team_members_count"` Permissions []string `json:"permissions"` Immutable *bool `json:"immutable"` TeamMemberIDs []User `json:"team_member_ids"` }
Group represents a group
type ProfilePictureURLs ¶
type ProfilePictureURLs struct { Small *string `json:"small"` Medium *string `json:"medium"` Large *string `json:"large"` }
ProfilePictureURLs represents the profile pic
type Report ¶
type Report struct { ID *uint64 `json:"id"` URL *string `json:"url"` Title *string `json:"title"` State *string `json:"state"` Substate *string `json:"substate"` ReadableSubstate *string `json:"readable_substate"` CreatedAt *Timestamp `json:"created_at"` Assignee *User `json:"assignee"` // TODO: this is probably wrong CreateReferenceURL *string `json:"create_reference_url"` Reporter *User `json:"reporter"` // TODO: There are special objects like team_context here PromoteBounties *bool `json:"promote_bounties"` Team *Team `json:"team"` HasBounty *bool `json:"has_bounty?"` CanViewTeam *bool `json:"can_view_team"` IsExternalBug *bool `json:"is_external_bug"` IsParticipant *bool `json:"is_participant"` Stage *uint `json:"stage"` // TODO: No idea what this is and the type Public *bool `json:"public"` CVEIDs []string `json:"cve_ids"` // TODO: Is this the correct type? DisclosedAt *Timestamp `json:"disclosed_at"` BugReporterAgreedOnGoingPublicAt *Timestamp `json:"bug_reporter_agreed_on_going_public_at"` TeamMemberAgreedOnGoingPublicAt *Timestamp `json:"team_member_agreed_on_going_public_at"` MediationRequested *bool `json:"mediation_requested"` Subscribed *bool `json:"subscribed"` SuggestedBounty *uint64 `json:"suggested_bounty"` VulnerabilityInformation *string `json:"vulnerability_information"` VulnerabilityInformationHTML *string `json:"vulnerability_information_html"` Triggers map[string]CommonResponse `json:"triggers"` VulnerabilityTypes []VulnerabilityType `json:"vulnerability_types"` Attachments []Attachment `json:"attachments"` Abilities ReportAbilities `json:"abilities"` IsMemberOfTeam *bool `json:"is_member_of_team"` Activities []Activity `json:"activities"` Summaries []ReportSummary `json:"summaries"` }
Report represents a report
type ReportAbilities ¶
type ReportAbilities struct { CanManage *bool `json:"can_manage?"` CanExport *bool `json:"can_export?"` CanAddComment *bool `json:"can_add_comment?"` CanChangeState *bool `json:"can_change_state?"` CanReopen *bool `json:"can_reopen?"` CanAwardBounty *bool `json:"can_award_bounty?"` CanAwardSwag *bool `json:"can_award_swag?"` CanSuggestBountyAmount *bool `json:"can_suggest_bounty_amount?"` CanAssignToUser *bool `json:"can_assign_to_user?"` CanHideTimeline *bool `json:"can_hide_timeline?"` CanAgreeOnGoingPublic *bool `json:"can_agree_on_going_public?"` CanBePubliclyDisclosed *bool `json:"can_be_publicly_disclosed?"` CanPostInternalComments *bool `json:"can_post_internal_comments?"` CanManageCommonResponses *bool `json:"can_manage_common_responses?"` CanChangeTitle *bool `json:"can_change_title?"` CanChangeVulnerabilityTypes *bool `json:"can_change_vulnerability_types?"` CanBeManuallyDisclosed *bool `json:"can_be_manually_disclosed?"` CanClone *bool `json:"can_clone?"` CanClose *bool `json:"can_close?"` CanBanResearcher *bool `json:"can_ban_researcher?"` AssignableTeamMembers []User `json:"assignable_team_members"` AssignableTeamMemberGroups []Group `json:"assignable_team_member_groups"` }
ReportAbilities dictates what can be done with a report
type ReportBulkResponse ¶
ReportBulkResponse is used as a response for multiple report methods
type ReportChangeStateOptions ¶
type ReportChangeStateOptions struct {
Reference *string
}
ReportChangeStateOptions provides optional arguments to ReportService's ChangeState method
type ReportCloseOptions ¶
ReportCloseOptions provides optional arguments to ReportService's Close method
type ReportService ¶
type ReportService service
ReportService handles communication with the bug related methods of H1.
func (*ReportService) ChangeState ¶
func (s *ReportService) ChangeState(id uint64, message string, state string, opts *ReportChangeStateOptions) (*ReportBulkResponse, *Response, error)
ChangeState changes a report state
func (*ReportService) Close ¶
func (s *ReportService) Close(id uint64, message string, state string, opts *ReportCloseOptions) (*ReportBulkResponse, *Response, error)
Close closes a report
func (*ReportService) Comment ¶
func (s *ReportService) Comment(id uint64, message string, internal bool) (*ReportBulkResponse, *Response, error)
Comment comments on a report
type ReportSummary ¶
type ReportSummary struct { Category *string `json:"category"` CanView *bool `json:"can_view?"` CanCreate *bool `json:"can_create?"` Content *string `json:"content"` ContentHTML *string `json:"content_html"` }
ReportSummary represents a report summary
type Response ¶
Response is a H1 response. This wraps the standard http.Response and provides convenience fields for pagination
type SessionService ¶
type SessionService service
SessionService handles communication with the session related methods of H1.
func (*SessionService) Acquire ¶
func (s *SessionService) Acquire(email string, password string) (*Response, error)
Acquire attempts to authenticate with the provided credentials
func (*SessionService) GetCurrentUser ¶
func (s *SessionService) GetCurrentUser() (*SessionUser, *Response, error)
GetCurrentUser returns information about the logged in user for the session (including the current CSRF token)
type SessionUser ¶
type SessionUser struct { CSRFToken *string `json:"csrf_token"` SignedIn *bool `json:"signed_in?"` }
SessionUser describes the current user for a session
type Team ¶
type Team struct { ID uint64 `json:"id"` Handle *string `json:"handle"` URL *string `json:"url"` Profile TeamProfile `json:"profile"` Policy *string `json:"policy"` Scopes []string `json:"scopes"` CoverColor *string `json:"cover_color"` TwitterHandle *string `json:"twitter_handle"` IBB *bool `json:"ibb"` HasCoverPhoto *bool `json:"has_cover_photo"` ProfilePictureURLs ProfilePictureURLs `json:"profile_picture_urls"` ExternalURL *string `json:"external_url"` RejectingSubmissions *bool `json:"rejecting_submissions"` OffersSwag *bool `json:"offers_swag"` OffersBounties *bool `json:"offers_bounties"` BountiesPaid *float64 `json:"bounties_paid"` ResearcherCount *uint64 `json:"researcher_count"` BugCount *uint64 `json:"bug_count"` BaseBounty *uint64 `json:"base_bounty"` ShowTotalBountiesPaid *bool `json:"show_total_bounties_paid"` ShowAverageBounty *bool `json:"show_average_bounty"` ShowTopBounties *bool `json:"show_top_bounties"` ShowMeanBountyTime *bool `json:"show_mean_bounty_time"` ShowMeanFirstResponseTime *bool `json:"show_mean_first_response_time"` ShowMeanResolutionTime *bool `json:"show_mean_resolution_time"` TargetSignal *int64 `json:"target_signal"` CurrentUserReachedAbuseLimit *bool `json:"current_user_reached_abuse_limit"` CurrentUserReachedTeamSignalLimit *bool `json:"current_user_reached_team_signal_limit"` TeamsUploadCoverPhotoEnabled *bool `json:"teams_upload_cover_photo_enabled"` CanViewThanks *bool `json:"can_view_thanks"` CanViewPolicyVersions *bool `json:"can_view_policy_versions"` LastPolicyChangeAt *Timestamp `json:"last_policy_change_at"` CanManageTeamMemberGroups *bool `json:"can_manage_team_member_groups"` CanInviteTeamMember *bool `json:"can_invite_team_member"` HackbotGeniusEnabled *bool `json:"hackbot_genius_enabled"` Permissions []string `json:"permissions"` }
Team represents a H1 team
type TeamProfile ¶
type TeamProfile struct { Name *string `json:"name"` TwitterHandle *string `json:"twitter_handle"` Website *string `json:"website"` About string `json:"about"` }
TeamProfile represents a H1 team
type TeamProfileMetrics ¶
type TeamProfileMetrics struct { MeanTimeToFirstResponse *float64 `json:"mean_time_to_first_response"` MeanTimeToResolution *float64 `json:"mean_time_to_resolution"` MeanTimeToBounty *float64 `json:"mean_time_to_bounty"` TotalBountiesPaidPrefix *string `json:"total_bounties_paid_prefix"` // TODO: Is this the correct type? TotalBountiesPaid *float64 `json:"total_bounties_paid"` AverageBountyLowerRange *float64 `json:"average_bounty_lower_range"` AverageBountyUpperRange *float64 `json:"average_bounty_upper_range"` TopBountyLowerRange *float64 `json:"top_bounty_lower_range"` TopBountyUpperRange *float64 `json:"top_bounty_upper_range"` }
TeamProfileMetrics represents a H1 team's profile metrics
type TeamService ¶
type TeamService service
TeamService handles communication with the report related methods of the H1 API.
func (*TeamService) ListVulnerabilityTypes ¶
func (s *TeamService) ListVulnerabilityTypes(handle string) ([]VulnerabilityType, *Response, error)
type Timestamp ¶
Timestamp represents a time generated from a JSON string
func NewTimestamp ¶
NewTimestamp creates a new Timestamp object from a ISO8601 date string
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON helps unmarshal ISO8601 dates in JSON
type User ¶
type User struct { ID *uint64 `json:"id"` Username *string `json:"username"` Name *string `json:"name"` Biography *string `json:"bio"` URL *string `json:"url"` ProfilePictureURLs ProfilePictureURLs `json:"profile_picture_urls"` Disabled *bool `json:"disabled"` ReportCount *uint64 `json:"report_count"` TargetCount *uint64 `json:"target_count"` Reputation *uint64 `json:"reputation"` Rank *uint64 `json:"rank"` Signal *float64 `json:"signal"` Impact *float64 `json:"impact"` SignalPercentile *uint `json:"signal_percentile"` ImpactPercentile *uint `json:"impact_percentile"` TeamContext *UserTeamContext `json:"team_context"` }
User represents a H1 user
type UserService ¶
type UserService service
UserService handles communication with the report related methods of the H1 API.
type UserTeamContext ¶
type UserTeamContext struct { NumberOfReportsToSameTeam *uint64 `json:"number_of_reports_to_same_team"` NumberOfResolvedReportsToSameTeam *uint64 `json:"number_of_resolved_reports_to_same_team"` NumberOfBountiesReceivedFromSameTeam *uint64 `json:"number_of_bounties_received_from_same_team"` SumBountyAmountReceivedFromSameTeam *string `json:"sum_bounty_amount_received_from_same_team"` }
UserTeamContext appears on some user objects
type VulnerabilityType ¶
type VulnerabilityType struct { ID *uint64 `json:"id"` Name *string `json:"name"` State *string `json:"state"` }
VulnerabilityType represents a report's vulnerability type