diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 88cdbf3..db86c07 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -16,12 +16,12 @@ jobs: strategy: matrix: - node-version: [10.x, 12.x, 14.x] + node-version: [18.x, 20.x, 22.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - run: node test.js diff --git a/404.html b/404.html index 41b779d..86cc6d3 100644 --- a/404.html +++ b/404.html @@ -7,16 +7,6 @@ - - diff --git a/index.html b/index.html index 421445f..fbff5f9 100644 --- a/index.html +++ b/index.html @@ -7,16 +7,6 @@ - - @@ -217,6 +207,6 @@

{{hackathon.title}}

- + diff --git a/test.js b/test.js index 4e440f9..0f780a8 100644 --- a/test.js +++ b/test.js @@ -44,8 +44,16 @@ for (const year of years) { let lastHackathon; for (const hackathon of obj[monthName]) { + // Validate URL fields don't use dangerous schemes (e.g. javascript:) + for (const field of ['url', 'facebookURL', 'twitterURL']) { + const val = (hackathon[field] || '').trim(); + if (val && /^[a-z][a-z0-9+.-]*:/i.test(val) && !/^https?:/i.test(val)) { + bail(`${hackathon.title} has unsafe ${field}: ${val}`); + } + } + let startDate = Date.parse(hackathon.startDate); - if (startDate !== undefined) { + if (!isNaN(startDate)) { if (lastStartDate > startDate) { bail(`${hackathon.title} should be before ${lastHackathon.title}`); }