Skip to content

Commit 00821ad

Browse files
Add a template (#472)
Signed-off-by: David A. Wheeler <[email protected]>
1 parent bf1d125 commit 00821ad

File tree

10 files changed

+140
-6
lines changed

10 files changed

+140
-6
lines changed

docs/labs/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Here are the labs available:
2121
* [csp1](csp1.html) - Content Security Policy (CSP)
2222
* [oob1](oob1.html) - Out-of-bounds (OOB)
2323

24+
We also have a [template](template.html) available.
25+
2426
## Please contribute labs
2527

2628
We would love to have people contribute relevant labs to help
@@ -36,6 +38,7 @@ See below for how to create labs and our lab roadmap.
3638
See [create labs](create_labs) if you want to learn how to create labs.
3739
In particular, that page will link to how to
3840
[create labs using checker](create_checker).
41+
We suggest using the [template](template.html) as a start.
3942

4043
To submit new or updated labs, create a pull request on the
4144
[OpenSSF Best Practices WG](https://github.com/ossf/wg-best-practices-os-developers/)

docs/labs/create_checker.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ There are three basic tasks, which can be done by different people:
2727
[input1.html](input1.html), and modify it for your situation.
2828
See David A. Wheeler who can help you get started.
2929

30-
The text below discusses these in more detail. You can also see our
30+
The text below discusses these in more detail.
31+
We suggest using the [template](template.html) as a start.
32+
You can also see our
3133
[potential future directions](#potential-future-directions).
3234

3335
## Creating the lab instructions and correct answer
@@ -46,6 +48,8 @@ See [input1.html](input1.html),
4648
[input2.html](input2.html), and
4749
[csp1.html](csp1.html) for examples of how to do this.
4850

51+
We suggest using the [template](template.html) as a starting point.
52+
4953
## Creating the lab HTML file
5054

5155
Each lab is captured in its own HTML file.
@@ -65,12 +69,9 @@ The system is implemented by the client-side JavaScript file `checker.js`.
6569
### TL;DR
6670

6771
An easy way implement a lab is to copy
68-
[input1.html](input1.html) and modify it for your situation.
72+
use our [template](template.html) and modify it for your situation.
6973
Modify the `expected0` section to have a sample expected answer, and
7074
`correct0` to have a full pattern for a correct answer.
71-
You can comment out the `info` section (put `#` in front of each line)
72-
to start.
73-
7475
See [input1.html](input1.html) and [input2.html](input2.html)
7576
for examples.
7677

docs/labs/csp1.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,11 @@ <h2>Interactive Lab (<span id="grade"></span>)</h2>
409409
<button type="button" class="resetButton">Reset</button>
410410
<button type="button" class="giveUpButton">Give up</button>
411411
<br><br>
412+
<p>
413+
<i>This lab was developed by David A. Wheeler at
414+
<a href="https://www.linuxfoundation.org/"
415+
>The Linux Foundation</a>.</i>
416+
<br><br>
412417
<p id="correctStamp" class="small">
413418
<textarea id="debugData" class="displayNone" rows="20" cols="65" readonly>
414419
</textarea>

docs/labs/hello.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ <h2>Interactive Lab (<span id="grade"></span>)</h2>
174174
<button type="button" class="resetButton">Reset</button>
175175
<button type="button" class="giveUpButton">Give up</button>
176176
<br><br>
177+
<p>
178+
<i>This lab was developed by David A. Wheeler at
179+
<a href="https://www.linuxfoundation.org/"
180+
>The Linux Foundation</a>.</i>
181+
<br><br>
177182
<p id="correctStamp" class="small">
178183
<textarea id="debugData" class="displayNone" rows="20" cols="65" readonly>
179184
</textarea>

docs/labs/input1.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ <h2>Interactive Lab (<span id="grade"></span>)</h2>
224224
<button type="button" class="hintButton">Hint</button>
225225
<button type="button" class="resetButton">Reset</button>
226226
<button type="button" class="giveUpButton">Give up</button>
227+
<br><br>
228+
<p>
229+
<i>This lab was developed by David A. Wheeler at
230+
<a href="https://www.linuxfoundation.org/"
231+
>The Linux Foundation</a>.</i>
227232
<br><br><!-- These go in the last form if there's more than one: -->
228233
<p id="correctStamp" class="small">
229234
<textarea id="debugData" class="displayNone" rows="20" cols="65" readonly>

docs/labs/input2.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@ <h2>Interactive Lab (<span id="grade"></span>)</h2>
238238
<button type="button" class="resetButton">Reset</button>
239239
<button type="button" class="giveUpButton">Give up</button>
240240
<br><br>
241+
<p>
242+
<i>This lab was developed by David A. Wheeler at
243+
<a href="https://www.linuxfoundation.org/"
244+
>The Linux Foundation</a>.</i>
245+
<br><br>
241246
<p id="correctStamp" class="small">
242247
<textarea id="debugData" class="displayNone" rows="20" cols="65" readonly>
243248
</textarea>

docs/labs/oob1.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ <h2>Interactive Lab (<span id="grade"></span>)</h2>
278278
<button type="button" class="giveUpButton">Give up</button>
279279
<br><br>
280280
<p>
281+
<i>This lab was developed by David A. Wheeler at
282+
<a href="https://www.linuxfoundation.org/"
283+
>The Linux Foundation</a>.</i>
284+
<br><br>
285+
<p>
281286
<details>
282287
<summary>Source: This example was extracted from
283288
<a href="https://github.com/openssl/openssl/blob/731f431497f463f3a2a97236fe0187b11c44aead/ssl/d1_both.c">OpenSSL file <tt>ssl/d1_both.c</tt>

docs/labs/regex0.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ <h3>Part 2</h2>
187187
<button type="button" class="giveUpButton">Give up</button>
188188
</form>
189189

190+
<br><br>
191+
<p>
192+
<i>This lab was developed by David A. Wheeler at
193+
<a href="https://www.linuxfoundation.org/"
194+
>The Linux Foundation</a>.</i>
190195
<br><br>
191196
<p id="correctStamp" class="small">
192197
<textarea id="debugData" class="displayNone" rows="20" cols="65" readonly>

docs/labs/regex1.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,11 @@ <h3>Part 5</h2>
445445
<button type="button" class="giveUpButton">Give up</button>
446446
</form>
447447

448-
448+
<br><br>
449+
<p>
450+
<i>This lab was developed by David A. Wheeler at
451+
<a href="https://www.linuxfoundation.org/"
452+
>The Linux Foundation</a>.</i>
449453
<br><br><!-- These go in the last form if there's more than one: -->
450454
<p id="correctStamp" class="small">
451455
<textarea id="debugData" class="displayNone" rows="20" cols="65" readonly>

docs/labs/template.html

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<link rel="stylesheet" href="https://best.openssf.org/assets/css/style.css">
7+
<link rel="stylesheet" href="checker.css">
8+
<script src="js-yaml.min.js"></script>
9+
<script src="checker.js"></script>
10+
<link rel="license" href="https://creativecommons.org/licenses/by/4.0/">
11+
12+
<!-- See create_labs.md for how to create your own lab! -->
13+
14+
<!-- Sample expected answer -->
15+
<script id="expected0" type="plain/text">
16+
EXPECTED0
17+
</script>
18+
<!--
19+
-->
20+
<script id="expected1" type="plain/text">
21+
EXPECTED1
22+
</script>
23+
24+
<!-- Full pattern of correct answer -->
25+
<script id="correct0" type="plain/text">
26+
\s* EXPECTED0 \s*
27+
</script>
28+
<script id="correct1" type="plain/text">
29+
\s* EXPECTED1 \s*
30+
</script>
31+
32+
<script id="info" type="application/yaml">
33+
---
34+
hints:
35+
- present: "unknown"
36+
text: Unknown is not part of the answer.
37+
# debug: true
38+
</script>
39+
</head>
40+
<body>
41+
<!-- For GitHub Pages formatting: -->
42+
<div class="container-lg px-3 my-5 markdown-body">
43+
<h1>Lab Exercise template???</h1>
44+
<p>
45+
This is a lab exercise on developing secure software.
46+
For more information, see the <a href="introduction.html" target="_blank">introduction to
47+
the labs</a>.
48+
49+
<p>
50+
<h2>Task</h2>
51+
<p>
52+
<b>Please ???overall instruction.</b>
53+
54+
<p>
55+
<h2>Background</h2>
56+
<p>
57+
In this exercise, we'll ???.
58+
59+
<p>
60+
<h2>Task Information</h2>
61+
<p>
62+
63+
<p>
64+
Please change the code below so ???
65+
66+
67+
<p>
68+
<h2>Interactive Lab (<span id="grade"></span>)</h2>
69+
<p>
70+
<form id="lab">
71+
<pre><code
72+
>// If you use a one-line input:
73+
<input id="attempt0" type="text" size="60" spellcheck="false" value="initial text0">
74+
75+
// If you use a textarea:
76+
<textarea id="attempt1" rows="10" cols="60" spellcheck="false">
77+
initial text 1;
78+
</textarea>
79+
// Code afterwards.
80+
</code></pre>
81+
<button type="button" class="hintButton">Hint</button>
82+
<button type="button" class="resetButton">Reset</button>
83+
<button type="button" class="giveUpButton">Give up</button>
84+
<br><br>
85+
<p>
86+
<i>This lab was developed by David A. Wheeler at
87+
<a href="https://www.linuxfoundation.org/"
88+
>The Linux Foundation</a>.</i>
89+
<br><br>
90+
<p id="correctStamp" class="small">
91+
<textarea id="debugData" class="displayNone" rows="20" cols="65" readonly>
92+
</textarea>
93+
</form>
94+
</div><!-- End GitHub pages formatting -->
95+
</body>
96+
</html>

0 commit comments

Comments
 (0)