Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/instructor-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Read the lesson's safety instructions and the shared [setup guide](setup.md), [s

## 3. Download and distribute

Get the matching student ZIP from [Student kits and downloads](https://sonukapoor.github.io/cve-lite-classroom/downloads/). Keep the same release for your class so everyone starts with the same files.
Get the matching student ZIP from [Student kits and downloads](https://sonukapoor.github.io/cve-lite-classroom/downloads/). In your assignment, cite the **Kit release** listed beside that exercise and the ZIP filename. Exercises can come from different releases. Keep the same ZIP for everyone in the class.

Extract a kit into a fresh folder and follow its own README before distributing it through your learning-management system. The kit's layout differs from the full repository. Give students the complete kit, including its instructions, worksheet and submission template.

Expand Down
7 changes: 7 additions & 0 deletions exercises/00-cve-lookup/student-kit-readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Exercise 00 · Read your first vulnerability record

Extract the ZIP and open `app/index.html` in your browser. Keep the extracted files together. You can open the worksheet from disk without installing software. Use an internet connection for CVE and OSV lookups.

Work through 0.1–0.5 in order. Check each answer, read the feedback and try again as needed. For 0.6, look up the assigned record independently. Choose **Download submission.json** and hand in the downloaded file using your instructor’s submission method.

[Step-by-step worksheet](worksheet.md) · [Submission instructions](submission-template.md)
23 changes: 20 additions & 3 deletions tooling/package-student-kit.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cpSync, existsSync, mkdirSync, copyFileSync, readFileSync, writeFileSync } from 'node:fs';
import { cpSync, existsSync, mkdirSync, copyFileSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { readCourse, tracks as managers } from '../containers/course.mjs';
import { dirname, join, resolve, basename } from 'node:path';
Expand All @@ -10,10 +10,11 @@ const packageKit = managers.includes(manager) && (
publicTrackKits.includes(exercise) ||
readCourse(root).some(entry => entry.kind === 'tracks' && entry.id === exercise)
);
const lookupKit = exercise === '00-cve-lookup' && manager === 'browser';
const browserKit = exercise === '04-browser-security-basics' && manager === 'browser';
const nodeKit = ['05-broken-access-control','06-security-misconfiguration','07-cryptographic-failures','08-insecure-design','09-authentication-failures','10-software-data-integrity','11-security-logging-alerting'].includes(exercise) && manager === 'node';
if (!(browserKit || nodeKit || packageKit) || !output) {
console.error('Usage: node tooling/package-student-kit.mjs <exercise-id> <manager> <new-destination>\nFor 04-browser-security-basics use browser. For exercises 05–11 use node.');
if (!(lookupKit || browserKit || nodeKit || packageKit) || !output) {
console.error('Usage: node tooling/package-student-kit.mjs <exercise-id> <manager> <new-destination>\nFor Exercise 00 or 04 use browser. For exercises 05–11 use node.');
process.exit(1);
}
const destination = resolve(output);
Expand All @@ -23,6 +24,22 @@ if (existsSync(destination)) {
}
const source = join(root,'exercises',exercise);
mkdirSync(destination, {recursive:true});
if (lookupKit) {
copyFileSync(join(source, 'student-kit-readme.md'), join(destination, 'README.md'));
copyFileSync(join(root, 'LICENSE'), join(destination, 'LICENSE'));
cpSync(join(source, 'student'), join(destination, 'app'), { recursive: true });
for (const file of ['worksheet.md', 'submission-template.md']) {
copyFileSync(join(source, file), join(destination, file));
}
mkdirSync(join(destination, 'parts'));
const publishedWorksheet = 'https://sonukapoor.github.io/cve-lite-classroom/media/exercises/00-cve-lookup/student/';
for (const part of readdirSync(join(source, 'parts')).filter(file => file.endsWith('.md'))) {
const text = readFileSync(join(source, 'parts', part), 'utf8');
writeFileSync(join(destination, 'parts', part), text.replaceAll(publishedWorksheet, '../app/index.html'));
}
console.log('CVE lookup student kit created:', destination);
process.exit(0);
}
cpSync(join(source,'screenshots'),join(destination,'screenshots'),{recursive:true});
if (browserKit || nodeKit) {
copyFileSync(join(source,'student-kit-readme.md'),join(destination,'README.md'));
Expand Down
14 changes: 10 additions & 4 deletions website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ node --test tooling/*.test.mjs
node tooling/validate-exercises.mjs
```

The production build rejects broken links and anchors. Website tests include generating and inspecting all 23 student-kit ZIPs. The packager requires `zip` and the tests require `unzip` (available on macOS and Ubuntu).
The production build rejects broken links and anchors. Website tests include generating and inspecting all available student-kit ZIPs. The packager requires `zip` and the tests require `unzip` (available on macOS and Ubuntu).

## GitHub Releases

Expand All @@ -36,11 +36,17 @@ Build all student ZIPs from this directory:
npm run kits
```

The output is `../dist/release-kits/`: 23 ZIPs and `SHA256SUMS.txt`. Existing output is never overwritten; supply a new path with `npm run kits -- /absolute/path/to/new-directory` when rebuilding.
The output is `../dist/release-kits/` with one ZIP per available exercise and track, plus `SHA256SUMS.txt`. Supply a new destination for each build. To build only the two supplemental archives:

A full release contains all those files; a partial release must list only the exercises whose kit variants are published. Keep old releases unchanged so instructors can reuse a version throughout a semester. Publishing a release is a separate, explicitly authorized action, not part of a local build or preview.
```sh
npm run kits -- ../dist/supplement 00-cve-lookup 11-security-logging-alerting
```

Exercises 01–10 retain their 22 student ZIPs and checksums at `classroom-2026.11.24`. The `student-kits-2026.11.30` supplement provides the Exercise 00 browser worksheet and the Exercise 11 Node.js lab. The footer links both editions, and Downloads identifies the release to cite for each exercise.

Publish and verify all assets for an edition before deploying its entries in `releases.json`. Leave past tags and assets intact. For a partial edition, add its tag and complete exercise IDs to `supplements`, newest first. Each included exercise must have every track available at that tag. `node scripts/check-download-build.mjs` verifies rendered links against the inventory. Use a `student-kits-` tag for a ZIP-only edition. Tags beginning with `classroom-` trigger the separate course-image workflow.

`releases.json` points to `classroom-2026.11.24`, the verified release containing all 22 student ZIPs and their checksums. Its `exercises` list identifies the lessons actually included in that release. Exercises 01–10 have published kits. Exercise 11 is available from source and local kit export; its release ZIP is not published yet. For future releases, publish and verify all assets before updating both `tag` and `exercises` and rebuilding. Keep existing tags and assets unchanged so semester downloads remain reproducible. Never list a lesson unless all its kit variants exist in the selected release. `node scripts/check-download-build.mjs` verifies the rendered links against that explicit published inventory.
GitHub also offers source ZIP and tar archives of the tagged commit. For a student-only supplement, tag a separate parentless commit containing the extracted student kits, the checksum file and a README linking to the reviewed course revision. Verify that the source archives contain the same student files as the downloadable kits.

## Deployment

Expand Down
9 changes: 9 additions & 0 deletions website/releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,14 @@
"08-insecure-design",
"09-authentication-failures",
"10-software-data-integrity"
],
"supplements": [
{
"tag": "student-kits-2026.11.30",
"exercises": [
"00-cve-lookup",
"11-security-logging-alerting"
]
}
]
}
7 changes: 4 additions & 3 deletions website/scripts/browser-smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import { kitInventory } from "./content.mjs";
import { isKitPublished } from "./release-availability.mjs";
import { isKitPublished, kitReleaseTag } from "./release-availability.mjs";
const kits = kitInventory(fileURLToPath(new URL("../../", import.meta.url)));
const origin = process.env.CLASSROOM_PREVIEW_ORIGIN || "http://127.0.0.1:3001";
const release = JSON.parse(
Expand Down Expand Up @@ -210,10 +210,11 @@ try {
4,
);
const firstRowLinks = await evaluate(
'Array.from(document.querySelectorAll(".lesson-expanded:not([hidden]) a"), link => link.pathname.replace(/\\/$/, ""))',
'Array.from(document.querySelectorAll(".lesson-expanded:not([hidden]) a"), link => link.pathname.replace(/\\/$/, "") + link.hash)',
);
assert.deepEqual(firstRowLinks, [
"/cve-lite-classroom/learn/exercises/00-cve-lookup",
"/cve-lite-classroom/downloads#00-cve-lookup",
"/cve-lite-classroom/learn/exercises/00-cve-lookup/instructor/teaching-plan",
]);
await capture("exercises-desktop", 1440, 1050);
Expand All @@ -228,7 +229,7 @@ try {
'Array.from(document.links).filter(a=>a.href.includes("/releases/download/")).map(a=>a.href).sort()',
),
kits.filter(k => isKitPublished(release, k)).map(k =>
`https://github.com/sonukapoor/cve-lite-classroom/releases/download/${encodeURIComponent(release.tag)}/${k.file}`,
`https://github.com/sonukapoor/cve-lite-classroom/releases/download/${encodeURIComponent(kitReleaseTag(release, k.exercise))}/${k.file}`,
).sort(),
);
assert.ok(
Expand Down
4 changes: 2 additions & 2 deletions website/scripts/check-download-build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { kitInventory } from "./content.mjs";
import { isKitPublished } from "./release-availability.mjs";
import { isKitPublished, kitReleaseTag } from "./release-availability.mjs";
const root = fileURLToPath(new URL("../../", import.meta.url));
const release = JSON.parse(
readFileSync(new URL("../releases.json", import.meta.url), "utf8"),
Expand Down Expand Up @@ -31,7 +31,7 @@ const links = [
].map((m) => m[1]);
const expected = kitInventory(root).filter(k => isKitPublished(release, k)).map(
(k) =>
`https://github.com/sonukapoor/cve-lite-classroom/releases/download/${encodeURIComponent(release.tag)}/${k.file}`,
`https://github.com/sonukapoor/cve-lite-classroom/releases/download/${encodeURIComponent(kitReleaseTag(release, k.exercise))}/${k.file}`,
);
assert.deepEqual(links.sort(), expected.sort());
assert.equal(html.includes('ZIP pending release'), kitInventory(root).some(k => !isKitPublished(release, k)));
Expand Down
6 changes: 3 additions & 3 deletions website/scripts/content.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ export function rewriteMarkdown(text, source, root) {
}
export function kitInventory(root) {
return catalog(root)
.filter((e) => e.available && "exercises/" + e.id !== lookupExercise)
.filter((e) => e.available)
.flatMap((e) => {
const number = Number(e.id.slice(0, 2));
const tracks =
number <= 3
number >= 1 && number <= 3
? ["npm", "pnpm", "yarn-classic", "yarn-berry", "bun"]
: [number === 4 ? "browser" : "node"];
: [number === 0 || number === 4 ? "browser" : "node"];
return tracks.map((track) => ({
exercise: e.id,
title: e.title,
Expand Down
1 change: 1 addition & 0 deletions website/scripts/guided-content.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ export function buildGuidedContent(root, lookupParts = lookupPages(root)) {
],
resources: [
page("Exercise parts", outline),
page("Downloaded student kit", all(lookupExercise + "/student-kit-readme.md")),
...["worksheet.md", "examples/browser/README.md", "submission-template.md"]
.map((path) => {
const file = lookupExercise + "/" + path;
Expand Down
9 changes: 8 additions & 1 deletion website/scripts/package-releases.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ if (existsSync(output))
throw new Error(
"Refusing to overwrite existing output; choose a new directory.",
);
const requested = new Set(process.argv.slice(3));
const available = kitInventory(root);
for (const exercise of requested) {
if (!available.some(kit => kit.exercise === exercise))
throw new Error("Unknown exercise: " + exercise);
}
const kits = requested.size ? available.filter(kit => requested.has(kit.exercise)) : available;
mkdirSync(output, { recursive: true });
const temporary = mkdtempSync(join(tmpdir(), "classroom-release-"));
const checksums = [];
try {
for (const kit of kitInventory(root)) {
for (const kit of kits) {
const directory = join(temporary, kit.file.slice(0, -4));
execFileSync(
process.execPath,
Expand Down
9 changes: 7 additions & 2 deletions website/scripts/release-availability.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/** Only advertise ZIPs explicitly included in the configured published release. */
/** Supplements are listed newest first, so an exercise can be reissued independently. */
export function kitReleaseTag(release, exercise) {
const editions = [...(release.supplements ?? []), release];
return editions.find(edition => edition.tag && edition.exercises?.includes(exercise))?.tag ?? null;
}

export function isKitPublished(release, kit) {
return Boolean(release.tag && release.exercises?.includes(kit.exercise));
return kitReleaseTag(release, kit.exercise) !== null;
}
114 changes: 66 additions & 48 deletions website/src/pages/downloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Heading from "@theme/Heading";
import lessons from "../../.generated/catalog.json";
import kits from "../../.generated/kits.json";
import release from "../../releases.json";
import { isKitPublished } from "../../scripts/release-availability.mjs";
import { kitReleaseTag } from "../../scripts/release-availability.mjs";
const repo = "https://github.com/sonukapoor/cve-lite-classroom";
export default function Downloads() {
return (
Expand All @@ -24,20 +24,22 @@ export default function Downloads() {
<div>
<h2>All downloads, together on GitHub</h2>
<p>
Student kits are published together in versioned GitHub
Releases, so you can keep the same materials throughout your
semester.
Student kits are published in versioned GitHub Releases, so you
can keep the same materials throughout your semester.
</p>
<a className="button button--primary" href={repo + "/releases"}>
View all releases on GitHub ↗
</a>
</div>
<div className="release-status">
<span className="eyebrow">Student-kit release</span>
<span className="eyebrow">Student-kit releases</span>
<strong>{release.tag || "Local preview"}</strong>
{release.supplements?.map((edition) => (
<span key={edition.tag}>Supplement · {edition.tag}</span>
))}
<p>
{release.tag
? "Cite this release when assigning a student kit so your class uses the same files."
? "Cite the release listed beside your chosen exercise when assigning a kit."
: "The first kit release is not published yet. You can browse the kits below, download the repository, or export a kit locally."}
</p>
</div>
Expand All @@ -59,8 +61,8 @@ export default function Downloads() {
architecture from the same release.
</p>
<p>
If you see only ZIP kits, you can build the image locally or use
the one your instructor provides.{" "}
If you see only ZIP kits, you can build the image locally or use the
one your instructor provides.{" "}
<a href={repo + "/blob/main/containers/README.md"}>
Build and launch the classroom
</a>
Expand All @@ -69,46 +71,62 @@ export default function Downloads() {
<div className="download-list">
{lessons
.filter((l) => kits.some((kit) => kit.exercise === l.id))
.map((l) => (
<section key={l.id} className="download-lesson">
<div>
<Heading as="h2" id={l.id}>
{l.title}
</Heading>
<Link
to={`/learn/exercises/${l.id}`}
aria-label={`Read instructions for ${l.title}`}
>
Read instructions →
</Link>
</div>
<div className="kit-options">
{kits
.filter((k) => k.exercise === l.id)
.map((k) => (
<div key={k.file} className="kit-option">
<strong>
{k.track === "node"
? "Node.js"
: k.track === "browser"
? "Browser only"
: k.track}
</strong>
{isKitPublished(release, k) ? (
<a
href={`${repo}/releases/download/${encodeURIComponent(release.tag)}/${k.file}`}
aria-label={`Download ZIP for ${l.title} (${k.track}) kit`}
>
Download ZIP
</a>
) : (
<span className="muted">ZIP pending release. Use the lesson's local export instructions.</span>
)}
</div>
))}
</div>
</section>
))}
.map((l) => {
const tag = kitReleaseTag(release, l.id);
return (
<section key={l.id} className="download-lesson">
<div>
<Heading as="h2" id={l.id}>
{l.title}
</Heading>
{tag && (
<p>
Kit release ·{" "}
<a
href={`${repo}/releases/tag/${encodeURIComponent(tag)}`}
>
{tag}
</a>
</p>
)}
<Link
to={`/learn/exercises/${l.id}`}
aria-label={`Read instructions for ${l.title}`}
>
Read instructions →
</Link>
</div>
<div className="kit-options">
{kits
.filter((k) => k.exercise === l.id)
.map((k) => (
<div key={k.file} className="kit-option">
<strong>
{k.track === "node"
? "Node.js"
: k.track === "browser"
? "Browser only"
: k.track}
</strong>
{tag ? (
<a
href={`${repo}/releases/download/${encodeURIComponent(tag)}/${k.file}`}
aria-label={`Download ZIP for ${l.title} (${k.track}) kit`}
>
Download ZIP
</a>
) : (
<span className="muted">
ZIP pending release. Use the lesson's local export
instructions.
</span>
)}
</div>
))}
</div>
</section>
);
})}
</div>
<div className="info-panel">
<h2>Need the full collection?</h2>
Expand Down
8 changes: 8 additions & 0 deletions website/src/theme/Footer/Copyright/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ export default function ClassroomCopyright(props) {
) : (
<span>Student-kit release · Unpublished</span>
)}
{release.supplements?.map((edition) => (
<a
key={edition.tag}
href={`${repo}/releases/tag/${encodeURIComponent(edition.tag)}`}
>
Student-kit supplement · {edition.tag}
</a>
))}
</div>
<Copyright {...props} />
</>
Expand Down
Loading
Loading