> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/sast-and-sca/prezero/customization/policies/validation-function.md).

# Add a custom validation function

This article will show you how to create a policy that marks a specific method to be treated as a validation; this results in Qwiet AI by Harness suppressing some of the findings that would otherwise appear.

We will use the [shiftleft-java-example](https://github.com/shiftleftsecurity/shiftleft-java-example) repo to demonstrate this process. We want to mark the `isAdmin` method in `AdminController.java` so that Qwiet AI by Harness treats it as a validation, suppressing some of the findings.

## Creating the policy <a href="#creating-the-policy" id="creating-the-policy"></a>

1. In the source code, look at the [`AdminController.java` file](https://github.com/ShiftLeftSecurity/shiftleft-java-example/blob/master/src/main/java/io/shiftleft/controller/AdminController.java) and make a note of the following pieces of information:

   * Package name
   * Class name
   * Method name
   * Return type
   * Parameter(s) accepted

   Please note that you must express all types using the complete form (e.g., strings should be expressed as `java.lang.String` and objects should be expressed as `java.lang.Object`). You can express primitive types, such as `int`, `float`, and `Boolean`.
2. [Create a new policy.](/sast-and-sca/prezero/customization/policies/custom-policies.md)

   ```prism-code
   IMPORT io.shiftleft/default
   IMPORT io.shiftleft/defaultdict

   ### These methods are approved by AppSec ###

   ### TAG "CHECK" METHOD - This prefix indicates that the method is an approved validation method

   ### Pass the full name after -f using the below syntax
   ### Package name . Class name . Method name : Return type ( Argument type )
   # Package name: io.shiftleft.controller
   # Class name: AdminController
   # Method name: isAdmin
   # Return type: boolean
   # Arguments: String (Expressed as java.lang.String in full form)

   TAG "CHECK" METHOD -f "io.shiftleft.controller.AdminController.isAdmin:boolean(java.lang.String)"
   ```

   ![](/files/CRrxFX9wuboXxDrdB2dv) ![](/files/DfHDmRpYn5HJOmhRtTva) ![](/files/P5vj8JOtHNJWVEvAqKym)
3. Validate, push, and assign your policy when invoking `sl analyze`.
