This repository was archived by the owner on Dec 4, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 877
docs(security): improve xsrf description and add it to http chapter as well #2652
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,11 +27,12 @@ block includes | |
- [Always handle errors](#error-handling). | ||
- [Send data to the server](#update). | ||
<li if-docs="ts"> [Fall back to promises](#promises).</li> | ||
- [Cross-origin requests: Wikipedia example](#cors). | ||
- [Cross-Origin Requests: Wikipedia example](#cors). | ||
<ul if-docs="ts"> | ||
<li> [Search parameters](#search-parameters).</li> | ||
<li> [More fun with observables](#more-observables).</li> | ||
</ul> | ||
- [Guarding against Cross-Site Request Forgery](#xsrf) | ||
- [Appendix: Tour of Heroes in-memory server](#in-mem-web-api). | ||
|
||
A <live-example>live example</live-example> illustrates these topics. | ||
|
@@ -46,7 +47,7 @@ block demos-list | |
:marked | ||
- [The Tour of Heroes *HTTP* client demo](#http-client). | ||
- [Fall back to !{_Promise}s](#promises). | ||
- [Cross-origin requests: Wikipedia example](#cors). | ||
- [Cross-Origin Requests: Wikipedia example](#cors). | ||
- [More fun with observables](#more-observables). | ||
|
||
:marked | ||
|
@@ -446,7 +447,7 @@ block hero-list-comp-add-hero | |
|
||
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). | ||
|
||
h2#cors Cross-origin requests: Wikipedia example | ||
h2#cors Cross-Origin Requests: Wikipedia example | ||
:marked | ||
You just learned how to make `XMLHttpRequests` using the !{_Angular_Http} service. | ||
This is the most common approach for server communication, but it doesn't work in all scenarios. | ||
|
@@ -628,6 +629,24 @@ block wikipedia-jsonp+ | |
You added the `debounceTime`, `distinctUntilChanged`, and `switchMap` operators to the RxJS `Observable` class | ||
in `rxjs-operators` as [described above](#rxjs). | ||
|
||
a#xsrf | ||
.l-main-section | ||
:marked | ||
## Guarding against Cross-Site Request Forgery | ||
|
||
In a cross-site request forgery (CSRF or XSRF), an attacker tricks the user into visiting | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we repeat the same content here? should this link to the original doc, so we don't have two sources of truth that can diverge? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thought about that. We need some context here. I only repeat the intro and this is material that shouldn't change even if our implementation does. I didn't think making up a new summary description would make a difference. I'll crisp it up in the Http chapter. |
||
a different web page with malignant code that secretly sends a malicious request to your application's web server, | ||
|
||
The server and client application must work together to thwart this attack. | ||
Angular's `Http` client does its part by applying a default `CookieXSRFStrategy` automatically to all requests. | ||
|
||
The `CookieXSRFStrategy` supports a common anti-XSRF technique in which the server sends a randomly | ||
generated authentication token in a cookie named `XSRF-TOKEN`. | ||
The HTTP client adds an `X-XSRF-TOKEN` header with that token value to subsequent requests. | ||
The server receives both the cookie and the header, compares them, and processes the request only if the cookie and header match. | ||
|
||
See the [XSRF topic on the Security page](security.html#xsrf) for more information about XSRF and Angular's `XSRFStrategy` counter measures. | ||
|
||
a#in-mem-web-api | ||
.l-main-section | ||
:marked | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any particular reason why you're changing the link syntax here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. We want links to external sites to appear in a new browser tab by default. Can't specify that in markdown