Creating a dynamic web page using Spring internalizr (Gradle), IntelliJ, and AWS EC2 - Step 4 XXS prevention, writing test code

· Tech· Project
Project

1. Avoid XXS

Change and save the textarea value to prevent script attacks. In the case of the existing popol, the textarea is at the mail transmission end, and to set this part, security is processed when the mail sending button is pressed.


2. Write JUnit test code

I wrote test code for the email sending part. Although it is an extension of stage 3, it was written in stage 4 considering it as a maintenance and repair section.

As a result, when all tests are completed, you can see that the mail is sent as set as follows.


+ Resolving errors

When running the test, the email was sent well, but a failure message appeared while executing the Controller method of the original code.

Looking at the content, it appears that NullPointer has occurred. I thought it was because of the part where parameter values ​​were received in the existing method (there was a ModelAndView among the parameter values, but it was not received properly).

This was solved by setting the initial value of ModelAndView to new ModelAndView to prevent Nulls from occurring.


| 24. Spring - Thymeleaf 템플릿 메일발송

| Spring Boot 메일전송 : Spring Boot 2, Mail, Thymelef

| [Java - 기능 - (14) ] ModelAndView 서블릿

| django를 활용한 동적 웹사이트 제작 및 AWS 배포

| [AWS] 1.AWS란?

| 클라우드, EC2를 사용한 동적 웹 페이지 구성

Comments

No comments yet. Be the first!

    164 posts in 테크

    15 / 164