Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

294
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda