Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8593865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:05:02+00:00 2026-06-12T00:05:02+00:00

I am trying to override an existing method in ESAPI OWASP library, by using

  • 0

I am trying to override an existing method in ESAPI OWASP library, by using ESAPI.override(). Somehow it does not work, do you know why?

Here my code:

public class AntiSamyDOMScannerExpansion extends AbstractAntiSamyScanner {

//...
public CleanResults scan(String html, String inputEncoding, String outputEncoding) throws ScanException {
        ESAPI.override(new DefaultSecurityConfiguration());
//...
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:05:03+00:00Added an answer on June 12, 2026 at 12:05 am

    ESAPI.override() is used only to override the configuration. In order to expand other kind of methods, in my case AntiSamy.scan, it is needed to extend every class in the call structure.
    This is because of a inflexible implementation. For instance we find in HTMLValidationRule.java:

    private String invokeAntiSamy( String context, String input ) throws ValidationException {
            // CHECKME should this allow empty Strings? "   " us IsBlank instead?
            if ( StringUtilities.isEmpty(input) ) {
                if (allowNull) {
                    return null;
                }
                throw new ValidationException( context + " is required", "AntiSamy validation error: context=" + context + ", input=" + input, context );
            }
    
            String canonical = super.getValid( context, input );
    
            try {
                AntiSamy as = new AntiSamy();
                CleanResults test = as.scan(canonical, antiSamyPolicy);
    
                List<String> errors = test.getErrorMessages();
                if ( !errors.isEmpty() ) {
                    LOGGER.info( Logger.SECURITY_FAILURE, "Cleaned up invalid HTML input: " + errors );
                }
    
                return test.getCleanHTML().trim();
    
            } catch (ScanException e) {
                throw new ValidationException( context + ": Invalid HTML input", "Invalid HTML input: context=" + context + " error=" + e.getMessage(), e, context );
            } catch (PolicyException e) {
                throw new ValidationException( context + ": Invalid HTML input", "Invalid HTML input does not follow rules in antisamy-esapi.xml: context=" + context + " error=" + e.getMessage(), e, context );
            }
        }
    

    Due to AntiSamy as = new AntiSamy(); we can not make it usable in a custom implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use mezzanine's overextends tag to both override and extends the existing
im trying to override the add() but it will not compile public class AVLTree<E
I'm trying to override a method inside a jquery widget. The method can be
I am trying to create python bindings to a vala library using the following
I'm trying to get an existing Preference subclass to work that saves a color
I'm trying to use code-first on an existing Point-Of-Sale kiosk application. This is a
I'm trying to use the Entity Framework code first without an existing database. I
I'm trying to make some existing JS backwards compatible. I need to override a
Trying to fill the listbox programatically I have written the following code: protected override
I'm trying to override Rails' fields_for method, which I'm currently doing as follows: module

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.