diff options
| author | Jan Tuomi <jan.tuomi@eficode.com> | 2020-02-05 11:35:13 +0200 |
|---|---|---|
| committer | Jan Tuomi <jan.tuomi@eficode.com> | 2020-02-05 11:35:13 +0200 |
| commit | 81573cd2c7d7d7a5f7237c4283ba97a55300aa4d (patch) | |
| tree | 5076d326c317757ff22d5b3b4569f79203656355 | |
| parent | 2011d3f6f9938825a36670779fa0d7894bda338f (diff) | |
Implement CSP
| -rw-r--r-- | docker-compose.yml | 3 | ||||
| -rw-r--r-- | frontend/public/index.html | 3 | ||||
| -rw-r--r-- | frontend/src/Home.js | 3 | ||||
| -rw-r--r-- | frontend/src/Login.js | 2 | ||||
| -rw-r--r-- | frontend/src/Register.js | 2 |
5 files changed, 10 insertions, 3 deletions
diff --git a/docker-compose.yml b/docker-compose.yml index a52fa93..06a0b88 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,13 +29,14 @@ services: frontend: build: frontend - tty: true + tty: false environment: REACT_APP_API_BASE_URL: http://localhost:4000 ports: - 3000:3000 volumes: - ./frontend/src:/app/src + - ./frontend/public:/app/public volumes: dbdata: diff --git a/frontend/public/index.html b/frontend/public/index.html index aa069f2..cc94d49 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -5,6 +5,9 @@ <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="#000000" /> + <meta http-equiv="Content-Security-Policy" content="default-src 'self' localhost:4000; + style-src 'self' 'unsafe-inline'; + img-src * data:;" /> <meta name="description" content="Web site created using create-react-app" diff --git a/frontend/src/Home.js b/frontend/src/Home.js index cc37156..c67c69a 100644 --- a/frontend/src/Home.js +++ b/frontend/src/Home.js @@ -19,6 +19,9 @@ const Home = observer(({ user }) => { <div> <LogoutBtn /> Hello {user.username}! + <div> + <img src="https://placehold.it/200x200" alt="Placeholder" /> + </div> </div> ); }); diff --git a/frontend/src/Login.js b/frontend/src/Login.js index 1a1cb2b..d17a5ab 100644 --- a/frontend/src/Login.js +++ b/frontend/src/Login.js @@ -6,7 +6,7 @@ import axios from './axios'; import userState from './UserState'; const Login = () => { - const { register, handleSubmit, watch, errors } = useForm(); + const { register, handleSubmit } = useForm(); const [ loginError, setLoginError ] = useState(null); const onSubmit = async data => { diff --git a/frontend/src/Register.js b/frontend/src/Register.js index e49b4ea..f4a6ec3 100644 --- a/frontend/src/Register.js +++ b/frontend/src/Register.js @@ -6,7 +6,7 @@ import axios from './axios'; import userState from './UserState'; const Register = () => { - const { register, handleSubmit, watch, errors } = useForm(); + const { register, handleSubmit } = useForm(); const [ loginError, setLoginError ] = useState(null); const onSubmit = async data => { |
