Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ddad95d

Browse files
committed
include points inline in solutions.md
1 parent 527178e commit ddad95d

File tree

3 files changed

+39
-42
lines changed

3 files changed

+39
-42
lines changed

‎exercises/10/problem.md‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,29 @@ Fortunately, your competitor just deployed a new version of their site that incl
44

55
The feature is called "Competitor Comparison" and it includes links to competitor search engines so that users can compare search results and decide which search engine is best. Clearly, they feel pretty confident that their results are the best.
66

7-
They appear to be using the foolproof `htmlElementEscape()` function written for them by the Stanford CS 253 student to generate the HTML for these links so you think they're guaranteed to be safe.
7+
They appear to be using the foolproof `htmlElementEscape()` function written for them by the Stanford CS 253 student to generate the HTML for these links so you think they're guaranteed to be safe:
88

9-
But upon closer inspection, it appears that they're not using the function correctly. Time to teach them another lesson!
9+
```js
10+
router.get('/search', async (req, res) => {
11+
let q = req.query.q
12+
if (q == null) q = ''
13+
14+
q = htmlElementEscape(q)
1015

11-
## Goals
16+
const results = await getResults(q)
17+
res.render('caloogle-search-page', { q, results })
18+
})
19+
```
20+
21+
But upon closer inspection, it appears that they're not using the function correctly. Time to teach them another lesson!
1222

13-
1. Find the XSS vulnerability in the search input field. You can use any HTML you want to run the `success()` function.
23+
## Goal
1424

15-
1. Write out the code that you believe the server must be executing to process the input.
25+
Find the XSS vulnerability in the search input field. You can use any HTML you want to run the `success()` function.
1626

1727
## Tip
1828

19-
Try submitting various inputs and then look at the HTML source of the `<iframe>` to figure out what their sanitization code must be doing.
29+
Try submitting various inputs and then look at the HTML source of the `<iframe>` to figure out how the "sanitized" user input interacts with the context of the HTML source.
2030

2131
<iframe src='http://caloogle.xyz:4100'></iframe>
2232

‎src/SOLUTIONS.md‎

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,49 @@
22

33
N/A
44

5-
# 1. A Truly Disruptive Startup
5+
# 1. A Truly Disruptive Startup (3 points)
66

77
```
88
TODO: Replace this with your attack input.
99
```
1010

11-
# 2. No Script Allowed
11+
# 2. No Script Allowed (3 points)
1212

1313
```
1414
TODO: Replace this with your attack input.
1515
```
1616

17-
# 3. One More Time, Like You Mean It
17+
# 3. One More Time, Like You Mean It (3 points)
1818

1919
```
2020
TODO: Replace this with your attack input.
2121
```
2222

23-
# 4. An Open-and-Shut Case
23+
# 4. An Open-and-Shut Case (3 points)
2424

2525
```
2626
TODO: Replace this with your attack input.
2727
```
2828

29-
# 5. Time to Mix Things Up
29+
# 5. Time to Mix Things Up (3 points)
3030

3131
```
3232
TODO: Replace this with your attack input.
3333
```
3434

35-
# 6. A Picture is Worth a Thousand Words
35+
# 6. A Picture is Worth a Thousand Words (3 points)
3636

3737
```
3838
TODO: Replace this with your attack input.
3939
```
4040

41-
# 7. Between a Rock And a Hard Place
41+
# 7. Between a Rock And a Hard Place (3 points)
4242

4343
```
4444
TODO: Replace this with your attack input.
4545
```
4646

47-
# 8. Angle of Death
47+
# 8. Angle of Death (6 points)
4848

4949
Attack input:
5050

@@ -71,30 +71,13 @@ router.get('/search', async (req, res) => {
7171

7272
N/A
7373

74-
# 10. In the Wrong Place at the Wrong Time
75-
76-
Attack input:
74+
# 10. In the Wrong Place at the Wrong Time (3 points)
7775

7876
```
7977
TODO: Replace this with your attack input.
8078
```
8179

82-
Server code:
83-
84-
```js
85-
router.get('/search', async (req, res) => {
86-
let q = req.query.q
87-
if (q == null) q = ''
88-
89-
// TODO: Replace this with your solution.
90-
// q = ???
91-
92-
const results = await getResults(q)
93-
res.render('caloogle-search-page', { q, results })
94-
})
95-
```
96-
97-
# 11. You Can't Win 'em All
80+
# 11. You Can't Win 'em All (6 points)
9881

9982
Attack input:
10083

@@ -117,7 +100,7 @@ router.get('/search', async (req, res) => {
117100
})
118101
```
119102

120-
# 12. When All is Said and Done
103+
# 12. When All is Said and Done (6 points)
121104

122105
Attack input:
123106

@@ -144,27 +127,27 @@ router.get('/search', async (req, res) => {
144127

145128
N/A
146129

147-
# 14. Here Today and Gone Tomorrow
130+
# 14. Here Today and Gone Tomorrow (3 points)
148131

149132
Attack URL:
150133

151134
```
152135
TODO: Replace this with your solution. **This should be a URL!**
153136
```
154137

155-
# 15. The Early Bird Catches the Worm
138+
# 15. The Early Bird Catches the Worm (3 points)
156139

157140
```
158141
TODO: Replace this with your attack input.
159142
```
160143

161-
# 16. Tying Up Loose Ends
144+
# 16. Tying Up Loose Ends (3 points)
162145

163146
```
164147
TODO: Replace this with your attack input.
165148
```
166149

167-
# 17. Take a Page Out of Their Book
150+
# 17. Take a Page Out of Their Book (6 points)
168151

169152
Attack code:
170153

@@ -175,3 +158,7 @@ Attack code:
175158
# 18. Congrats
176159

177160
N/A
161+
162+
# Survey responses (3 points)
163+
164+
Write your survey responses in SURVEY.md!

‎src/SURVEY.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Assignment 1 Survey Questions
1+
# Assignment 1 Survey Questions (3 points)
22

3-
## Roughly how long did you spend on this assignment? (required)
3+
## Roughly how long did you spend on this assignment?
44

55
TODO: Replace this with your response
66

7-
## What was your favorite part of this assignment? (required)
7+
## What was your favorite part of this assignment?
88

99
TODO: Replace this with your response
1010

11-
## What was your least favorite part of this assignment? (required)
11+
## What was your least favorite part of this assignment?
1212

1313
TODO: Replace this with your response
1414

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /