This topic is under construction for the 24.7 (July 2024) release. For current documentation of this feature, click here.

Validators can be used to check for proper configuration and the existence of certain objects to ensure an application will run properly, such as:

  • Required schema objects, such as tables and columns
  • The existence of required fields in tables
  • The configuration of expected permissions, such as checking whether guests have permission to read the "home" project.
A validator can either be site level, or scoped to run at a specific container level, i.e. folder-scoped. Built-in validators can be run at either level. Developers implementing their own new validators can design them to be enabled only in folders where they are needed.

Run Site Validators

To access and run site validators:

  • Select (Admin) > Site > Admin Console.
  • Under Diagnostics, click Site Validation.
  • Select which validator(s) to run using checkboxes.
  • Select where to run them:
    • All the projects and folders in this site
    • Just the projects
  • Check the box if you want to Run in the background.
  • Click Validate to run. Depending on your selections, producing results could take considerable time.

Pipeline Validator

Validate pipeline roots

Wiki Validator

Detect wiki rendering exceptions and CSP violation issues, including for example, script tags without nonces and inline event handlers. Any wikis triggering this validator will be listed with a description of the issue and link.


Premium Resource Available

Subscribers to premium editions of LabKey Server can learn about making wikis compliant with a strict CSP in this topic:


Learn more about premium editions

Permissions Validator

This validator will report where guests (anyone not logged in, i.e. anonymous "public" users) have access to your server.

Run in the Background

Validating many folders can take a long time. Checking the Run in the background box will run them in a background pipeline job, avoiding proxy timeouts that a 'foreground' job might encounter.

If you run in the background, you'll see the pipeline status page for the job and can click Data when it is complete to see the same results page as if the job had run in the foreground.

Run Folder Validators

To run validation on a given project, folder, or folder tree:

  • Navigate to where you want to validate.
  • Select (Admin) > Folder > Management.
  • Click Validate.
  • You'll see the same options as at the site level, except that here the Folder Validation Option is to check or uncheck Include Subfolders.

Implement New Validators

Any validator should implement SiteValidationProvider, or more likely, the subclass SiteValidationProviderImpl. The methods getName() and getDescription() implement the name and description for the validator.

The boolean flag isSiteScope() controls whether the validator is site-scoped. The boolean flag shouldRun() controls whether the validator is applicable to a given container.

The method runValidation() returns a SiteValidationResultList of validation messages that will be displayed on the validation page in the admin console.

The messages can be set at different levels of severity: info, warn, or error. Errors will appear in red on the validation page. There are helper methods on SiteValidationResultList to aid in building the list. To build compound messages, SiteValidationResult behaves much like a StringBuilder, with an append() that returns itself.

Steps

  • Implement SiteValidationProvider
  • Implement runValidation():
    • Instantiate a SiteValidationResultList
    • For each of your validation steps, call SiteValidationResultList.addInfo(), addWarn() or addError()
    • In your module's doStartup(), call SiteValidationService.registerProvider() to register your validator

Example Code

An example validator that checks whether any Guest users have read or edit permissions: PermissionsValidator.java.

Related Topics

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand allcollapse all