Rapid Models Statistics Module API Definition

This API definition facilitates auditing static analysis alerts using classifiers, optional adaptive heuristics, and alert prioritization. The API enables jump-starting labeled datasets using test suites. It is intended to enable a wide range of users (with widely varying datasets, static analysis tools, machine learning expertise, and amount of labeled data) to benefit from using classifiers and sophisticated prioritization to automatically triage static analysis alerts.
More information: https://www.sei.cmu.edu/research-capabilities/all-work/display.cfm?customel_datapageid_4050=6453
Contact Info: lflynn@cert.org
Version: 0.0.4
BasePath:
Software Engineering Institute - Copyright (c) 2007-2019 Carnegie Mellon University. All Rights Reserved.
http://apache.org/licenses/LICENSE-2.0.html

Access

Methods

[ Jump to Models ]

Table of Contents

DataHubToStats

StatsServer

UIToStats

DataHubToStats

Up
put /projects/{project_id}/packages/{package_id}/alerts
Forward new Alerts that have been uploaded to the DataHub and have a current open adaptive heuristic request for its respective package. Returns status message for the DataHub to track if the request was completed. (sendAlertUpdatesForClassifier)

Path parameters

project_id (required)
Path Parameter — The id of the project associated with these alerts
package_id (required)
Path Parameter — The id of the package associated with these alerts

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

multiple_alerts multiple_alerts (required)
Body Parameter — Updated alert data

Request headers

Return type

alert_updates_response

Example data

Content-Type: application/json
{
  "project_id" : "project_id",
  "package_id" : "package_id"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

OK alert_updates_response

400

Unable to Upload Alerts

404

Invalid Package

default

Unexpected Error error

Up
put /packages/tools/{tool_id}
Send FFSA or code metrics tool info to the Stats Module. When a new tool is uploaded, the DataHub can send new tool info for packages with open adaptive heuristic requests automatically to keep the Stats Module in sync. (sendNewTool)

Path parameters

tool_id (required)
Path Parameter — The id of the tool uploaded to the DataHub

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

packages_with_tool_data packages_with_tool_data (required)
Body Parameter — Tool info, including name, version, plus FFSA checker info OR code metrics field info and package ids associated with this new tool.

Request headers

Return type

Integer

Example data

Content-Type: application/json
0

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

OK Integer

400

Unable to Upload Tool Information

default

Unexpected Error error

StatsServer

Up
get /status
Provides Server Status (getStatus)

Request headers

Return type

request_token

Example data

Content-Type: application/json
{
  "message" : "message",
  "request_id" : "request_id"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

Server Is Running request_token

400

Database Connection Lost

default

Unexpected Error error

UIToStats

Up
put /classifiers/{classifier_instance_id}/adaptive_heuristics/close
Stop adaptive heuristic forward request. Send a request to close (set to false) the adaptive heuristic for the packages listed in the classifier instance. (closeAdaptiveHeuristicDataForwarding)

Path parameters

classifier_instance_id (required)
Path Parameter — The id of the classifier instance to run on the target domain

Consumes

This API call consumes the following media types via the Content-Type request header:

Request headers

Return type

close_adaptive_heuristics_response

Example data

Content-Type: application/json
{
  "message" : "message",
  "classifier_instance_id" : "classifier_instance_id"
}

Responses

200

OK close_adaptive_heuristics_response

400

Invalid Close Request

404

Classifier Instance Unavailable

default

Unexpected Error error

Up
post /classifiers
Create a new classifier instance. Send Classifier information including Automated Hyper-Parameter Optimization (AHPO) and Adaptive Heuristics to the Stats Module along with package_ids for packages to use in creating/training a classifier. Returns an id that is used to then run the classifier and any additional information for the classifier. (createClassifierInstance)

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

classifier_instance classifier_instance (required)
Body Parameter — Classifier information to create

Request headers

Return type

create_classifier_response

Example data

Content-Type: application/json
{
  "analysis_messages" : "{}",
  "project_id" : "project_id",
  "classifier_instance_id" : "classifier_instance_id"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

OK create_classifier_response

400

Unable to Create Classifier

default

Unexpected Error error

Up
delete /classifiers/{classifier_instance_id}
Delete a specific classifier from the Stats module by classifier_instance_id. (deleteClassifierInstance)

Path parameters

classifier_instance_id (required)
Path Parameter — The id of the classifier to delete

Consumes

This API call consumes the following media types via the Content-Type request header:

Request headers

Return type

request_token

Example data

Content-Type: application/json
{
  "message" : "message",
  "request_id" : "request_id"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

Classifier Successfully Deleted request_token

400

Invalid Request

404

Unable to Delete Classifier

default

Unexpected Error error

Up
put /classifiers/{classifier_instance_id}
Edit a specific classifier from the Stats module by classifier_instance_id. (editClassifierInstance)

Path parameters

classifier_instance_id (required)
Path Parameter — The id of the classifier instance to edit

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

classifier_instance classifier_instance (required)
Body Parameter — Classifier information to edit

Request headers

Return type

create_classifier_response

Example data

Content-Type: application/json
{
  "analysis_messages" : "{}",
  "project_id" : "project_id",
  "classifier_instance_id" : "classifier_instance_id"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

OK create_classifier_response

400

Unable to Edit Classifier

404

Invalid Request

default

Unexpected Error error

Up
get /classifiers/{classifier_instance_id}
Get analysis for a specific Classifier including performance metrics. (getClassifierInstanceAnalysis)

Path parameters

classifier_instance_id (required)
Path Parameter — The id of the classifier to get analysis info

Consumes

This API call consumes the following media types via the Content-Type request header:

Request headers

Return type

analysis_results

Example data

Content-Type: application/json
{
  "classifier_analysis" : "{}",
  "classifier_instance_id" : "classifier_instance_id"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

OK analysis_results

404

Classifier Information Unavailable

default

Unexpected Error error

Up
get /classifiers
List all classifiers and their associated data. Use the ids returned from this request to work with classifiers. (listClassifiers)

Consumes

This API call consumes the following media types via the Content-Type request header:

Request headers

Return type

array[list_classifiers_response]

Example data

Content-Type: application/json
[ {
  "classifier_id" : "classifier_id",
  "adaptive_heuristics" : [ {
    "adaptive_heuristic_name" : "adaptive_heuristic_name",
    "adaptive_heuristic_id" : "adaptive_heuristic_id",
    "adaptive_heuristic_parameters" : "{}"
  } ],
  "ahpos" : [ {
    "ahpo_id" : "ahpo_id",
    "ahpo_name" : "ahpo_name",
    "ahpo_parameters" : "{}"
  } ],
  "classifier_name" : "classifier_name"
}, {
  "classifier_id" : "classifier_id",
  "adaptive_heuristics" : [ {
    "adaptive_heuristic_name" : "adaptive_heuristic_name",
    "adaptive_heuristic_id" : "adaptive_heuristic_id",
    "adaptive_heuristic_parameters" : "{}"
  } ],
  "ahpos" : [ {
    "ahpo_id" : "ahpo_id",
    "ahpo_name" : "ahpo_name",
    "ahpo_parameters" : "{}"
  } ],
  "classifier_name" : "classifier_name"
} ]

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

OK

404

Classifiers Unavailable

default

Unexpected Error error

Up
put /classifiers/{classifier_instance_id}/retrain
Returns new probability values if there are updates from the selected classifier_instance. (retrain)

Path parameters

classifier_instance_id (required)
Path Parameter — The id of the classifier instance to run on the target domain

Consumes

This API call consumes the following media types via the Content-Type request header:

Request body

classifier_instance_data classifier_instance_data (required)
Body Parameter — Information to send close adaptive heuristic request

Request headers

Return type

classifier_results

Example data

Content-Type: application/json
{
  "probability_data" : [ {
    "probability" : 0.8008281904610115,
    "meta_alert_id" : "meta_alert_id"
  }, {
    "probability" : 0.8008281904610115,
    "meta_alert_id" : "meta_alert_id"
  } ],
  "project_id" : "project_id",
  "classifier_analysis" : "{}",
  "classifier_instance_id" : "classifier_instance_id"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

OK classifier_results

400

Unable to Run Classifier

404

Invalid Request

default

Unexpected Error error

Up
put /classifiers/{classifier_instance_id}/projects/{project_id}
Run a specific classifier instance on the project identified by id in the path. The response contains estimated class probablities and analysis of classifier performance. (runClassifierInstance)

Path parameters

classifier_instance_id (required)
Path Parameter — The id of the classifier instance to run on the target domain
project_id (required)
Path Parameter — The id of the project containing the packages

Consumes

This API call consumes the following media types via the Content-Type request header:

Request headers

Return type

classifier_results

Example data

Content-Type: application/json
{
  "probability_data" : [ {
    "probability" : 0.8008281904610115,
    "meta_alert_id" : "meta_alert_id"
  }, {
    "probability" : 0.8008281904610115,
    "meta_alert_id" : "meta_alert_id"
  } ],
  "project_id" : "project_id",
  "classifier_analysis" : "{}",
  "classifier_instance_id" : "classifier_instance_id"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

OK classifier_results

400

Unable to Run Classifier

404

Invalid Request

default

Unexpected Error error

Models

[ Jump to Methods ]

Table of Contents

  1. alert -
  2. alert_updates_response -
  3. analysis_results -
  4. checker_mappings -
  5. classifier_instance -
  6. classifier_instance_data -
  7. classifier_results -
  8. classifier_results_probability_data -
  9. close_adaptive_heuristics_response -
  10. condition -
  11. condition_languages -
  12. create_classifier_response -
  13. determination -
  14. determination_dangerous_construct_list -
  15. determination_dead_list -
  16. determination_flag_list -
  17. determination_ignored_list -
  18. determination_inapplicable_environment_list -
  19. determination_notes_list -
  20. determination_verdict_list -
  21. error -
  22. list_classifiers_response -
  23. list_classifiers_response_adaptive_heuristics -
  24. list_classifiers_response_ahpos -
  25. message -
  26. meta_alert -
  27. multiple_alerts -
  28. packages_with_tool_data -
  29. packages_with_tool_data_tool_data -
  30. request_token -
  31. source_mappings -
  32. secondary_message -

alert - Up

alert_id
tool_id
checker_id
primary_message
secondary_messages (optional)

alert_updates_response - Up

project_id (optional)
package_id (optional)

analysis_results - Up

classifier_instance_id (optional)
classifier_analysis (optional)

checker_mappings - Up

checker_id (optional)
checker_name (optional)
tool_id (optional)
conditions (optional)

classifier_instance - Up

classifier_id
classifier_type (optional)
classifier_instance_name (optional)
project_ids
ahpo_id (optional)
ahpo_parameters (optional)
adaptive_heuristic_id (optional)
adaptive_heuristic_parameters (optional)

classifier_instance_data - Up

project_id
String The id of the target project to run the classifier on
timestamp
Date The current time format: date-time

classifier_results - Up

classifier_instance_id (optional)
project_id
String ID of project in the target domain
probability_data
classifier_analysis (optional)

classifier_results_probability_data - Up

meta_alert_id (optional)
probability (optional)
Double format: double

close_adaptive_heuristics_response - Up

classifier_instance_id (optional)
message (optional)

condition - Up

condition_id (optional)
condition_name (optional)
title (optional)
platforms (optional)
condition_fields (optional)
Object Fields associated with this condition, i.e., likelihood

condition_languages - Up

condition (optional)
language_ids (optional)

create_classifier_response - Up

classifier_instance_id (optional)
project_id (optional)
analysis_messages (optional)
Object Additional information that will help to understand this classifier instance's performance

determination - Up

flag_list (optional)
verdict_list (optional)
ignored_list (optional)
dead_list (optional)
inapplicable_environment_list (optional)
dangerous_construct_list (optional)
notes_list (optional)

determination_dangerous_construct_list - Up

dangerous_construct (optional)
timestamp (optional)
Date format: date-time

determination_dead_list - Up

dead (optional)
timestamp (optional)
Date format: date-time

determination_flag_list - Up

flag (optional)
timestamp (optional)
Date format: date-time

determination_ignored_list - Up

ignored (optional)
timestamp (optional)
Date format: date-time

determination_inapplicable_environment_list - Up

inapplicable_environment (optional)
timestamp (optional)
Date format: date-time

determination_notes_list - Up

notes (optional)
timestamp (optional)
Date format: date-time

determination_verdict_list - Up

verdict (optional)
timestamp (optional)
Date format: date-time

error - Up

code
message

list_classifiers_response - Up

classifier_id (optional)
classifier_type (optional)
ahpos (optional)
adaptive_heuristics (optional)

list_classifiers_response_adaptive_heuristics - Up

adaptive_heuristic_id (optional)
adaptive_heuristic_name (optional)
adaptive_heuristic_parameters (optional)

list_classifiers_response_ahpos - Up

ahpo_id (optional)
ahpo_name (optional)
ahpo_parameters (optional)

message - Up

line_start
line_end (optional)
filepath

meta_alert - Up

meta_alert_id
condition_id (optional)
filepath (optional)
line_number (optional)
determination (optional)
alert_ids (optional)
auto_verdict (optional)

multiple_alerts - Up

meta_alerts (optional)
alerts (optional)

packages_with_tool_data - Up

package_ids (optional)
tool_data (optional)

packages_with_tool_data_tool_data - Up

tool_name (optional)
tool_version (optional)
tool_type (optional)
source_mappings (optional)
code_metrics_data (optional)

request_token - Up

request_id
String Id used to correlate messages with each other
message (optional)

source_mappings - Up

mapping_source (optional)
checker_mappings (optional)

secondary_message - Up

line_start
line_end (optional)
filepath
message_text