Skip to content

Commit e7af87f

Browse files
committed
fix #46: Add Content-Security-Policy header
The added Content-Security-Policy header instructs browsers to not execute scripts that are served by the servlet. It does so by defining an empty collection of valid sources for scripts.
1 parent 26fb977 commit e7af87f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/nl/goodbytes/xmpp/xep0363/Servlet.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017-2023 Guus der Kinderen. All rights reserved.
2+
* Copyright (c) 2017-2024 Guus der Kinderen. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -75,6 +75,7 @@ protected void service( HttpServletRequest request, HttpServletResponse response
7575
response.setHeader("Access-Control-Allow-Methods", "PUT, GET, HEAD, OPTIONS");
7676
response.setHeader("Access-Control-Allow-Headers", "Overwrite, Destination, Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control");
7777
}
78+
response.setHeader("Content-Security-Policy", "script-src ;");
7879
super.service(request, response);
7980
}
8081

0 commit comments

Comments
 (0)