Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

291
Views
How to sanitize or sandbox user input with Angular and Spring Boot RESTful Api

Our team is developing a project in Angular (FE) + Java/SpringBoot (BE) REST service. Angular app consists of defferent forms to fill, then the data is sent to BE.

We are on the stage of going live and have a list of rules to implement from our security team. One of the rules is:

 The application protects against template injection
 attacks by ensuring that any user input being included is sanitized or sandboxed.

We already added .xssProtection() to our Spring configuration.

Do we need to additionally escape HTML characters in all messages like in example below? What are best practises in Spring to sanitize the input? Or adding the .xssProtection() to Spring Security config is actually enough?

@Bean
public HttpMessageConverter<Object> jsonConverter() {
    StringDeserializer sanitizedStringSerializer = new StringDeserializer() {
        @Override
        public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
            String deserializedValue = super.deserialize(p, ctxt);
            return StringEscapeUtils.escapeHtml4(deserializedValue);
        }
    };

    ObjectMapper objectMapper = Jackson2ObjectMapperBuilder
            .json()
            .deserializerByType(String.class, sanitizedStringSerializer)
            .build();
    return new MappingJackson2HttpMessageConverter(objectMapper);
}
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!