Skip to main content

About Veracode Fix

Veracode Fix is an intelligent remediation solution that helps your development teams reduce the time and effort they spend securing their applications. Developers can use Fix to get AI-generated code patches, review the suggested patches, and directly apply them to flaws in their application source, without writing any code.

How Veracode Fix helps developers

Veracode data shows that organizations are not keeping up with their security debt. Developers lack the training, experience, and tools to find and fix security findings in their code. A 2022 report by Techstrong Research showed that 73% of developers are expected to write secure code, but lack the adequate tools and knowledge.

The amount of time it takes for developers to remediate only half of their open findings in a given codebase continues to grow. Typically, developers must update codebases that have several security findings, and they are responsible for the overall security of any applications they build with these codebases. Their organization might also hold them accountable for addressing the security debt of their applications. Developers must spend time and work through the frustration of finding, researching, and fixing, security findings that they might not have created, in code they might not have written.

Veracode Fix provides contextual suggestions for each finding. Developers can quickly review and apply each suggested fix to their code, which can reduce the time they spend researching and fixing findings in all codebases.

How Veracode Fix works

Veracode Fix uses a combination of your application source files and the findings from a Static Analysis of your application. It identifies flaws in the source code and suggests fixes you can apply to the flaws. Fix uses a machine learning (ML) model that continually trains on thousands of samples of vulnerable code with suggested code patches. These patches come from real-world code that contains the appropriate fix for a security issue. Veracode continually curates these patches against its data set of Static Analysis flaws and against flaws in real-world code.

Each time you run Fix, it does the following:

  1. Uploads a copy of your source files and SAST results file to the Veracode Intelligent Remediation Engine.
  2. Uses the ML model to compare the code in your source files to its code samples.
  3. Returns a numbered list of issues, in your IDE or command prompt window, which are the flaws you can fix. Each issue shows the Common Weakness Enumeration (CWE) ID, a brief description of the flaw, and the line of code where the flaw exists.
  4. After you specify the issue you want to fix, Fix matches the patch in the code sample to your code and returns a list of between one and five suggested fixes. If no fixes are available, instead of suggesting fixes that might fix a flaw, Fix returns No fixes found.
  5. After you specify the fix you want to apply, Fix applies the patch by rewriting the code that contains the flaw.
  6. Discards the copy of your source file, so that it is no longer available to Veracode.

After you apply a fix for a routine injection flaw, such as CRLF injection, cross-site scripting (XSS), or SQL injection, Veracode recommends that you test your code before committing it. For other flaw categories, you might need to perform other tasks. For example, if Veracode recommends that you update a hashing algorithm to a version that is more cryptographically secure, such as moving from MD5 to SHA, you must update any instances of hashed data. If the hashed data is part of an interface, you must also update the definition for that interface, including all parties that use that definition.

Best practices

Consider the following best practices when you use Veracode Fix.

Rebuild and scan after you fix a flaw

To ensure a flaw is fixed, after each fix you apply, Veracode recommends that you always:

  • Rebuild your application.
  • Run a Static Analysis on the application to generate new scan results.
  • Re-run Fix on the application.

You can apply multiple suggested fixes to your application without rebuilding and rescanning it between fixes. Although, if an applied fix causes the build to break, you might find it easier to troubleshoot the errors with fewer code changes from the applied fixes.

Resolve build errors after applying a fix

Fix attempts to verify that all suggested fixes are compilable, but you might apply a fix that is incompatible with your application.

For example, a fix might use an import statement that adds a new library, so that the applied fix can use a supported cleansing function. This change requires an update to your package manager file, such as pom.xml, but Fix does not update this file. This change might cause your application build to fail. To fix the build, you can review your code to see if the applied fix added an import statement and, if it did, add the library to your package manager file.

If your application fails to build after you apply a fix, continue with your regular development processes, such as unit testing, to understand what broke and to resolve the errors. Because Fix makes highly constrained changes to only the area of code where the flaw exists, developer usually do not need to intervene. There could be cases where Fix adds code, such as the import statement in the previous example, which would require a developer to modify code outside the file in which they are working.

Even if an applied fix breaks a build, the flaw is still fixed. Developers might need to spend additional time modifying their code to reach a successful build, but they still spend much less time learning about a flaw and attempting to fix it manually, without Fix.

If your application fails to build after applying a fix, and fixing the package manager file does not resolve the problem, please contact Veracode Technical Support.

Supported integrations

Veracode Fix is integrated with the following products:

Applying fixes to flaws

Apply suggested fixes as a single fix or apply multiple fixes as a batch. You apply suggested fixes differently with the CLI and the GitHub action.

Apply fixes with the CLI

To fix flaws in your CLI, you can generate fixes with single fix or batch fix.

Single fix

To apply a single fix, Veracode Fix generates multiple fix options for each security flaw in a selected file. You can choose the most appropriate fix from the available options for each flaw. To generate fixes in a single file, set the --type flag to file.

Batch fix

To apply multiple fixes as a batch, Veracode Fix consolidates all suggested fixes for all security flaws in a directory and selects the first fix for the flaws in your batch of files. You apply all necessary fixes at once, which streamlines the process. To generate fixes for the flaws in multiple files in a directory, set the --type flag to directory.

Apply fixes with the GitHub action

To fix flaws in a GitHub repository with a pull request, configure the action with single fix or batch fix.

Account requirements

To use Fix, you must have one of the following accounts:

  • User account with the Submitter user role.
  • API account with the Submitter API role.

Supported languages

Supported CWEs

Fix supports the following CWEs for each supported language. For the complete list of CWEs that each Veracode scan type supports, see Veracode and the CWE.

C#

CWE IDCWE nameSingle fix supportBatch fix support
73External Control of File Name or PathX
80Improper Neutralization of Script-Related HTML Tags in a Web PageXX
89Improper Neutralization of Special Elements used in an SQL CommandXX
117Improper Output Neutralization for LogsXX
209Information Exposure Through an Error MessageXX
316Cleartext Storage of Sensitive Information in MemoryXX
327Use of a Broken or Risky Cryptographic AlgorithmX
331Insufficient EntropyXX
352Cross-Site Request Forgery (CSRF)XX
404Improper Resource Shutdown or ReleaseXX
601URL Redirection to Untrusted Site ('Open Redirect')X
611Improper Restriction of XML External Entity ReferenceXX

Go

CWE IDCWE nameSingle fix supportBatch fix support
73External Control of File Name or PathXX
78Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')XX
117Improper Output Neutralization for LogsXX

Java

CWE IDCWE nameSingle fix supportBatch fix support
80Improper Neutralization of Script-Related HTML Tags in a Web PageXX
89Improper Neutralization of Special Elements used in an SQL CommandXX
113Improper Neutralization of CRLF Sequences in HTTP HeadersXX
117Improper Output Neutralization for LogsXX
159Improper Handling of Invalid Use of Special ElementsXX
209Generation of Error Message Containing Sensitive InformationXX
327Use of a Broken or Risky Cryptographic AlgorithmX
331Insufficient EntropyXX
404Improper Resource Shutdown or ReleaseXX
502Deserialization of Untrusted DataX
597Use of Wrong Operator in String ComparisonXX
601URL Redirection to Untrusted Site ('Open Redirect')X
611Improper Restriction of XML External Entity ReferenceXX

JavaScript and TypeScript

CWE IDCWE nameSingle fix supportBatch fix support
73External Control of File Name or PathX
78Improper Neutralization of Special Elements used in an OS CommandX
80Improper Neutralization of Script-Related HTML Tags in a Web PageXX
89Improper Neutralization of Special Elements used in an SQL CommandXX
113Improper Neutralization of CRLF Sequences in HTTP HeadersXX
117Improper Output Neutralization for LogsXX
209Generation of Error Message Containing Sensitive InformationXX
311Missing Encryption of Sensitive DataX
312Cleartext Storage of Sensitive InformationX
327Use of a Broken or Risky Cryptographic AlgorithmX
352Cross-Site Request Forgery (CSRF)XX
601URL Redirection to Untrusted Site ('Open Redirect')XX
611Improper Restriction of XML External Entity ReferenceXX
614Sensitive Cookie in HTTPS Session Without 'Secure' AttributeXX

Kotlin

CWE IDCWE nameSingle fix supportBatch fix support
80Improper Neutralization of Script-Related HTML Tags in a Web PageXX
89Improper Neutralization of Special Elements used in an SQL CommandXX
113Improper Neutralization of CRLF Sequences in HTTP HeadersXX
117Improper Output Neutralization for LogsXX
331Insufficient EntropyXX
404Improper Resource Shutdown or ReleaseXX

PHP

CWE IDCWE nameSingle fix supportBatch fix support
73External Control of File Name or PathX
80Improper Neutralization of Script-Related HTML Tags in a Web PageXX
89Improper Neutralization of Special Elements used in an SQL CommandXX
117Improper Output Neutralization for LogsXX

Python

CWE IDCWE nameSingle fix supportBatch fix support
73External Control of File Name or PathX
78Improper Neutralization of Special Elements used in an OS CommandXX
80Improper Neutralization of Script-Related HTML Tags in a Web PageXX
89Improper Neutralization of Special Elements used in an SQL CommandXX
295Improper Certificate ValidationXX
327Use of a Broken or Risky Cryptographic AlgorithmX
331Insufficient EntropyXX
601URL Redirection to Untrusted Site ('Open Redirect')X
757Selection of Less-Secure Algorithm During Negotiation ('Algorithm Downgrade')XX

Ruby

CWE IDCWE nameSingle fix supportBatch fix support
73External Control of File Name or PathXX
80Improper Neutralization of Script-Related HTML Tags in a Web PageXX
89Improper Neutralization of Special Elements used in an SQL CommandXX
117Improper Output Neutralization for LogsXX
601URL Redirection to Untrusted Site ('Open Redirect')XX

Scala

CWE IDCWE nameSingle fix supportBatch fix support
78Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')XX
80Improper Neutralization of Script-Related HTML Tags in a Web Page (HTML Injection)XX
117Improper Output Neutralization for LogsXX
611Improper Restriction of XML External Entity ReferenceXX

Technical support

If you need help, contact Veracode Technical Support or visit the Community.