Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

293
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda