You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 4, 2017. It is now read-only.
<a href="https://seclab.stanford.edu/websec/csrf/csrf.pdf" target="_blank">Robust Defenses for Cross-Site Request Forgery</a> is a rich source of detail.
258
+
259
+
See also Dave Smith's easy-to-understand
260
+
<a href="https://www.youtube.com/watch?v=9inczw6qtpY" target="_blank" title="Cross Site Request Funkery Securing Your Angular Apps From Evil Doers">talk on XSRF at AngularConnect 2016</a>.
<li> [More fun with observables](#more-observables).</li>
34
34
</ul>
35
+
- [Guarding against Cross-Site Request Forgery](#xsrf)
35
36
- [Appendix: Tour of Heroes in-memory server](#in-mem-web-api).
36
37
37
38
A <live-example>live example</live-example> illustrates these topics.
@@ -46,7 +47,7 @@ block demos-list
46
47
:marked
47
48
- [The Tour of Heroes *HTTP* client demo](#http-client).
48
49
- [Fall back to !{_Promise}s](#promises).
49
-
- [Cross-origin requests: Wikipedia example](#cors).
50
+
- [Cross-Origin Requests: Wikipedia example](#cors).
50
51
- [More fun with observables](#more-observables).
51
52
52
53
:marked
@@ -446,7 +447,7 @@ block hero-list-comp-add-hero
446
447
447
448
To understand the implications and consequences of subscriptions, watch [Ben Lesh's talk on observables](https://www.youtube.com/watch?v=3LKMwkuK0ZE) or his video course on [egghead.io](https://egghead.io/lessons/rxjs-rxjs-observables-vs-promises).
448
449
449
-
h2#cors Cross-origin requests: Wikipedia example
450
+
h2#cors Cross-Origin Requests: Wikipedia example
450
451
:marked
451
452
You just learned how to make `XMLHttpRequests` using the !{_Angular_Http} service.
452
453
This is the most common approach for server communication, but it doesn't work in all scenarios.
@@ -628,6 +629,24 @@ block wikipedia-jsonp+
628
629
You added the `debounceTime`, `distinctUntilChanged`, and `switchMap` operators to the RxJS `Observable` class
629
630
in `rxjs-operators` as [described above](#rxjs).
630
631
632
+
a#xsrf
633
+
.l-main-section
634
+
:marked
635
+
## Guarding against Cross-Site Request Forgery
636
+
637
+
In a cross-site request forgery (CSRF or XSRF), an attacker tricks the user into visiting
638
+
a different web page with malignant code that secretly sends a malicious request to your application's web server,
639
+
640
+
The server and client application must work together to thwart this attack.
641
+
Angular's `Http` client does its part by applying a default `CookieXSRFStrategy` automatically to all requests.
642
+
643
+
The `CookieXSRFStrategy` supports a common anti-XSRF technique in which the server sends a randomly
644
+
generated authentication token in a cookie named `XSRF-TOKEN`.
645
+
The HTTP client adds an `X-XSRF-TOKEN` header with that token value to subsequent requests.
646
+
The server receives both the cookie and the header, compares them, and processes the request only if the cookie and header match.
647
+
648
+
See the [XSRF topic on the Security page](security.html#xsrf) for more information about XSRF and Angular's `XSRFStrategy` counter measures.
0 commit comments