Fluid Attacks' Autofix feature allows you to efficiently remediate vulnerabilities within your source code. Leveraging the power of generative AI, Autofix suggests custom modifications that transform your vulnerable code into secure code. Currently, this feature is available only for Fluid Attacks' VS Code extension.
Below is a simple explanation of how Autofix works and how to use it.
How Autofix works
Autofix sits on Fluid Attacks' VS Code extension, which retrieves vulnerability reports from Fluid Attacks' platform to show which lines of code are vulnerable directly in the IDE. Autofix's efficiency stems from its integration with GPT-4's advanced code analysis and generation capabilities. This powerful AI model can accurately identify vulnerabilities and produce targeted fixes, saving you time and effort in the remediation process.
Once Autofix receives the code fragment, the model generates specific actions to address and remediate the vulnerability, returning the code with the implemented solution.
For details on Fluid Attacks' usage of GPT-4 to generate fixes and data privacy in relation to it, refer to the VS Code plugin FAQ.
Use Autofix
The Autofix functionality leverages GPT-4's ability to fix vulnerable code automatically. As a prerequisite, you must have installed Fluid Attacks' VS Code extension. With the extension installed, follow these steps:
- Click on the Fluid Attacks extension in VS Code's activity bar and locate the file containing the vulnerability you wish to fix.
- Click the hammer and wrench icon associated with that file to initiate Autofix.
Autofix automatically establishes a connection with the GPT-4 AI model. This connection enables the model to analyze the code and generate the necessary fixes. During this process, you see the message "Trying to fix the vulnerability automatically."
- After a few seconds, the code is automatically modified. Review the AI-generated fix suggestion and proceed only after verification that the resulting code is secure.