Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement scan module #42

Closed
RomanReznichenko opened this issue Apr 20, 2022 · 0 comments · Fixed by #43
Closed

Implement scan module #42

RomanReznichenko opened this issue Apr 20, 2022 · 0 comments · Fixed by #43
Assignees
Labels
Type: enhancement New feature or request.

Comments

@RomanReznichenko
Copy link
Contributor

RomanReznichenko commented Apr 20, 2022

The package defines a simple public API to manage scans, create, and send the reporters after the scan has been finished.

Implement ScanFactory which provides a simple API to create Scan.
To configure Scan should be used ScanSettings.

export interface Target {
  // The server URL that will be used for the request
  url: string;
  // The query parameters to be sent with the request
  query?: URLSearchParams | Record<string, string>;
  // The data to be sent as the request body.
  // The only required for POST, PUT, PATCH, and DELETE
  body?: FormData | URLSearchParams | string | unknown;
  // The request method to be used when making the request, GET by default
  method?: string;
  // The headers
  headers?: Record<string, string>;
  // The optional method of serializing `query`
  // (e.g. https://www.npmjs.com/package/qs, http://api.jquery.com/jquery.param/)
  serializeQuery?(params: URLSearchParams | Record<string, unknown>): string;
}

export interface ScanSettings {
  // The Scan name
  name: string;
  // The list of tests to be performed against the target application
  tests: TestType[];
  // The target that will be attacked
  target: Target;
  // Determine whether scan is smart or simple
  smart?: boolean;
  // Pool size
  poolSize?: number;
  // Allows to skip testing static parameters.
  skipStaticParams?: boolean;
  // Defines which part of the request to attack
  attackParamLocations?: AttackParamLocation[];
}

To Generate HAR file should be implemented HarEntityBuilder that will be used like on example

const entry = new HarEntryBuilder(target.method, target.url)
  .headers(target.headers)
  .query(target.query)
  .postData(target.body)
  .build();

In Scan should be implemented next methods

  • issues - get a list of found issues;
  • status - ensure that the scan is done and nothing prevents the user to check for issues;
  • waitFor - check whether the scan satisfies the user’s expectation;
  • stop - method to stop a scan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: enhancement New feature or request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants