Skip to main content

Crate hackerone_api

Crate hackerone_api 

Source
Expand description

§hackerone-api

Unofficial, dependency-light Rust client for the HackerOne API (v1).

Built for the boring, reliable half of bug-bounty tooling: list your programs, pull scopes, read reports, file reports, comment, and change state — with HTTP Basic auth and no async runtime.

use hackerone_api::{Client, ReportQuery};

fn main() -> Result<(), hackerone_api::Error> {
    let client = Client::new("api-identifier", "api-token");

    for program in client.programs()?.items() {
        println!("{:?}", program.handle);
    }

    let reports = client
        .reports(&ReportQuery::new().state("new").page(1, 25))?
        .into_items();
    println!("{} new reports", reports.len());
    Ok(())
}

§Auth

The API uses HTTP Basic auth: the username is your API token identifier and the password is the token value. Create one in your HackerOne account settings.

§Design

  • Blocking, no async runtime. ureq under the hood.
  • Injectable transport. The client is generic over Transport, so tests use a mock and embedders can swap the HTTP stack.
  • Forward-compatible types. Domain structs keep the documented fields and stash unknown ones in a flattened extra map.

§Disclaimer

This crate is unofficial and not affiliated with or endorsed by HackerOne. “HackerOne” is a trademark of its owner; the name is used only to describe what the library talks to.

Structs§

ApiError
A single entry from the HackerOne API’s errors array.
Client
A HackerOne API client.
CollectionDoc
A collection response (GET /v1/reports, GET /v1/me/programs, …).
CreateReport
A report to create. Build it with the chainable methods, then Client::create_report.
Links
JSON:API links object (pagination URLs).
Meta
JSON:API meta object, kept loose.
Page
A decoded page: the items plus the links needed to fetch more.
Program
See the HackerOne API reference for Program.
Report
See the HackerOne API reference for Report.
ReportQuery
Filters for Client::reports.
Request
A fully-built request handed to a Transport.
Resource
A single JSON:API resource: id + type + attributes.
Response
A raw HTTP response.
Severity
See the HackerOne API reference for Severity.
SingleDoc
A single-object response (GET /v1/me, GET /v1/reports/{id}, …).
StructuredScope
See the HackerOne API reference for StructuredScope.
UreqTransport
Default transport backed by blocking ureq.
User
See the HackerOne API reference for User.
Weakness
See the HackerOne API reference for Weakness.

Enums§

Error
Everything that can go wrong talking to the HackerOne API.
Method
HTTP method.
ReportState
Report states accepted by a state change.
SeverityRating
Severity rating supplied when creating a report.

Constants§

DEFAULT_BASE_URL
Default API root.

Traits§

Transport
Anything that can turn a Request into a Response.

Type Aliases§

Result
Convenience alias.