Skip to content

Commit af98e3c

Browse files
Also explain how to disable browser caching
Signed-off-by: David A. Wheeler <[email protected]>
1 parent 4316bb6 commit af98e3c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

secure_software_development_fundamentals.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3317,6 +3317,21 @@ When you are delivering web pages you can limit what can be done with the result
33173317

33183318
If your site is publicly accessible, you can easily test your headers using the [Security Headers website](https://securityheaders.com/).
33193319

3320+
If you are serving especially sensitive data, you should *only* serve that data from a few specific pages and completely disable caching of that data (to prevent accidental spills from a cache). The safest way to ensure that caching is disabled is through this set of HTTP headers
3321+
(["How do we control web page caching, across all browsers?"](https://stackoverflow.com/questions/49547/how-do-we-control-web-page-caching-across-all-browsers)):
3322+
3323+
~~~~
3324+
Cache-Control: no-cache, no-store, must-revalidate
3325+
Pragma: no-cache
3326+
Expires: 0
3327+
~~~~
3328+
3329+
Some of these settings are only relevant to extremely old browsers. If you only care about current browsers, this setting is enough:
3330+
3331+
~~~~
3332+
Cache-Control: no-store, must-revalidate
3333+
~~~~
3334+
33203335
Also, an important word about HTTP headers in general. You may decide, for various reasons, to provide other HTTP headers. If some of that header information might be from an attacker, be *especially careful*. As always, do very careful input validation. There is a nasty attack, in particular, where the attacker manages to insert a newline in the input; this will cause *HTTP header splitting* in HTTP versions 1.1 and 2, where the rest of the text after the newline may be interpreted as an HTTP header provided by the attacker. This could disable many protections or even implement an attack.
33213336

33223337
#### Quiz 4.4: Other HTTP Hardening Headers

0 commit comments

Comments
 (0)