Integrate 42Crunch Platform with IntelliJ IDEA
You can integrate API Security Audit with JetBrains IntelliJ IDEA through the extension OpenAPI (Swagger) Editor.
For more details on IntelliJ integration, see IntelliJ integration.
- Install OpenAPI (Swagger) Editor extension to your IntelliJ editor.
- Open the API you want in IntelliJ in
.json
or.yaml
format. - To run Security Audit from IntelliJ, click the 42C button at the top edge of the editor. Security Audit checks your API definition and provides audit score and report on the found issues in the editor just like in the platform. The elements containing issues are also marked in your code. For more details, see Audit report in IntelliJ.
The extension uses a token to authenticate to Security Audit. On the first time, you must provide your email address so that we can send you the token, just follow the instructions on the UI. Configuring the token is done only once, on subsequent audits you just click the button.
- In the Problems panel, scroll through the issue titles, and click on an issue to jump to view it inline in your API definition. The issues are ordered from most to least severe, so it is easy for fix the worst offenders first. Recommendations are not listed in the Problems panel.
- Hover on an element marked in your code to see the list of issues in that spot, and click on the list to filter the text panel to show only these issues.
- Edit your API definition to fix found issues, save your changes, and click the 42C button to re-run the audit.
Load audit report from a file
You can open an audit report that has been exported from 42Crunch Platform to view it in your IntelliJ editor without auditing the API again. This way, you can work on fixing audit issues from an audit report that, for example, someone in a different team shared with you.
- Obtain the audit report (either from someone else, or download it yourself) from 42Crunch Platform as a JSON file. See Export audit report.
- Open the API definition that the audit report was for in IntelliJ, either as
.json
or.yaml
. - Right-click on the API definition, and click Load Security Audit Report from File.
IntelliJ loads the exported report from the file and you can now navigate it just as if the audit had been run in IntelliJ.
If you fix an issue and run Security Audit in IntelliJ to verify your fix, the audit report your loaded from the file is replaced by the report that the IntelliJ extension generated.
The exported audit report is a static file: if you reload the exported report file again after fixing an issue in your API, the report still contains the details of that issue and the place you already fixed is highlighted in the editor.
View API collections in the IDE
You can also view and manage API collections available to you in 42Crunch Platform directly in the IDE. The IDE extension uses IDE tokens to access and authenticate to 42Crunch Platform. You can create IDE tokens in 42Crunch Platform, either on the landing page or in your account settings.
Creating IDE tokens requires a user account in 42Crunch Platform. If you have so far just used the token that was mailed to you when you first run Security Audit in the IDE, you must sign up for an account before you can configure the integration for viewing the APIs and API collections in your IDE.
- Log in to 42Crunch Platform and click Create a new IDE token on the landing page.
- Copy the value of your IDE token, you need it to configure your IDE extension.
- In IntelliJ, go to the IDE settings, and click Tools > OpenAPI (Swagger) Editor.
- In 42Crunch Platform Credentials, configure your IDE to authenticate to 42Crunch Platform:
- Enter the URL your organization uses to access 42Crunch Platform. For most users, this is
https://platform.42crunch.com
. If you are not sure what your platform URL is, contact our support. - Enter the value of the IDE token you copied.
When ready, click OK. The IDE extension can now read the API collections available to you and APIs in them when you click the 42Crunch button on the tool window bar.
- Enter the URL your organization uses to access 42Crunch Platform. For most users, this is
- To open the API definition in the IDE, click OpenAPI definition. To view the audit report, click Security Audit.
- To open the API definition in 42Crunch Platform, rename it, or delete it, right-click on the API, and select the action you want.
Deleting an API permanently removes it from 42Crunch Platform. This action cannot be undone.