doc/user/application_security/api_fuzzing/create_har_files.md
{{< details >}}
{{< /details >}}
HTTP archive (HAR) format files are an industry standard for exchanging information about HTTP
requests and HTTP responses. A HAR file's content is JSON formatted, containing browser interactions
with a web site. The file extension .har is commonly used.
HAR files can be used to perform web API fuzz testing in CI/CD pipelines.
[!warning] A HAR file stores information exchanged between web client and web server. It could also store sensitive information such as authentication tokens, API keys, and session cookies. We recommend that you review the HAR file contents before adding them to a repository.
You can create HAR files manually or by using a specialized tool for recording web sessions. We recommend using a specialized tool. However, it is important to make sure files created by these tools do not expose sensitive information, and can be safely used.
The following tools can be used generate a HAR file based on your network activity. They automatically record your network activity and generate the HAR file:
[!warning] HAR files may contain sensitive information such as authentication tokens, API keys, and session cookies. You should review the HAR file contents before adding them to a repository.
GitLab HAR Recorder is a command line tool for recording HTTP messages and saving them to HAR files.
Prerequisites:
Microsoft Visual C++ 14.0. It's included with
Build Tools for Visual Studio from the Visual Studio Downloads page.Install GitLab HAR recorder:
pip install gitlab-har-recorder --extra-index-url https://gitlab.com/api/v4/projects/22441624/packages/pypi/simple
Insomnia API client is an API design tool that among many uses, helps you to design, describe, and test your API. You can also use it to generate HAR files that can be used in web API fuzz testing.
Fiddler is a web debugger tool. It captures HTTP and HTTP(S) network traffic and allows you to examine each request. It also lets you export the requests and responses in HAR format.
Fiddler shows a popup message confirming the export has succeeded.
Safari is a web browser maintained by Apple. As web development evolves, browsers support new capabilities. With Safari you can explore network traffic and export it as a HAR file.
Prerequisites:
Develop menu item.
Show Develop menu item in menu bar.Chrome is a web browser maintained by Google. As web development evolves, browsers support new capabilities. With Chrome you can explore network traffic and export it as a HAR file.
Firefox is a web browser maintained by Mozilla. As web development evolves, browsers support new capabilities. With Firefox you can explore network traffic and export it as a HAR file.
Perform a request or Reload the page to see detailed information about network activity,
select Reload to start recording requests.Before using HAR files it's important to make sure they don't expose any sensitive information.
For each HAR file you should:
We recommend viewing a HAR file's content in a tool that can present its content in a structured way. Several HAR file viewers are available online. If you would prefer not to upload the HAR file, you can use a tool installed on your computer. HAR files used JSON format, so can also be viewed in a text editor.
Tools recommended for viewing HAR files include:
Review the HAR file for any of the following:
We strongly recommended that you edit or remove it any sensitive information.
Use the following as a checklist to start with. It's not an exhaustive list.
Edit or remove sensitive information found during the HAR file content review. HAR files are JSON files and can be edited in any text editor.
After editing the HAR file, open it in a HAR file viewer to verify its formatting and structure are intact.