13 - Cross-Origin Resource Sharing Flashcards

(22 cards)

1
Q

restricts how a document/script from one origin can interact with a resource from another origin

A

Same-Origin Policy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

two web pages have the same origin if they have the same (3)

A
  1. protocol
  2. host/domain
  3. port
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

a page attempting to interact with a resource from a different origin is making a ____

A

Cross-Origin Request

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Determine if the following requests are cross-origin requests:

a. http://localhost:3001 => http://localhost:3000

b. http://myapp.com => https://myapp.com

c. http://myapp.com => http://myapp.com/about

d. https://myapp.com => https://blog.myapp.com

e. http://myapp.com => http://myapp.com:81

A

a. Cross-Origin
b. Cross-Origin
c. Same Origin
d. Cross-Origin
e. Cross-Origin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

true/false

the website/web server restricts cross-origin HTTP requests

A

false, it is the browser that restricts such requests

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what are the exceptions to cross-origin requests (4)

A
  1. embedded requests
  2. cross-origin writes
  3. images
  4. linked stylesheets
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

why restrict cross-origin access?

A

cross-origin requests are a vector for online attacks, they are a way to steak cookies and can give an attacker access to a user’s sensitive information

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what do we do if we really need to access resources from another origin?

A

use cross-origin resource sharing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

a system that allows resources to be accessed across different origins

A

Cross-Origin Resource Sharing (CORS)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

are used by clients and servers to determine if the client can access the server’s resources

A

access-control headers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what access-control header specifies which origins are allowed access

A

access-control-allow-origin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what access-control header indicates if sending credentials are allowed

A

access-control-allow-credentials

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what access-control header indicates which http methods are allowed to be used for incoming requests

A

access-control-allow-methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what access-control header indicates which headers are allowed to be used for incoming requests

A

access-control-allow-headers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

some cross-origin requests trigger a ____

A

preflight request

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

automatically issued by the browser before sending some kinds of cross-origin requests

A

preflight requests

17
Q

it is a ‘preflight’ check to see if the actual request will be accepted and processed

A

preflight requests

18
Q

all preflight requests are ____ requests with particular headers

19
Q

what are the 3 particular headers of preflight requests

A
  1. Access-Control-Request-Method
  2. Access-Control-Request-Headers
  3. origin
20
Q

before the browser sends the actual request, it sends a/an ___ request to ask if the actual request will be allowed

21
Q

true/false

requests that will cause some sort of change in the server’s data will only trigger a preflight request if specified in the header

A

false, any request that will cause change in the server’s data will trigger a preflight request

22
Q

___ requests don’t trigger a preflight and only look for the ____ header in the response

A

Simple, Access-Control-Allow-Origin