Skip to content

Commit 894d9a2

Browse files
Update AngularJS to 1.8 (Hackalist#631)
* Remove Google Analytics scripts and validate URL fields in test.js for security Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Update Node.js CI workflow to use newer Node.js versions and action versions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 64a3036 commit 894d9a2

File tree

4 files changed

+13
-25
lines changed

4 files changed

+13
-25
lines changed

.github/workflows/node.js.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [10.x, 12.x, 14.x]
19+
node-version: [18.x, 20.x, 22.x]
2020

2121
steps:
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v4
2323
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v1
24+
uses: actions/setup-node@v4
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
- run: node test.js

404.html

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,6 @@
77
<meta name="description" content="An archive of hackathons from around the world (2014-2025).">
88
<meta name="keywords" content="hackathon, hackathons, list">
99
<link rel="shortcut icon" href="/images/favicon.ico" />
10-
<!-- Start Google Javascript -->
11-
<script>
12-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
13-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
14-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
15-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
16-
ga('create', 'UA-51284668-3', 'auto');
17-
ga('require', 'displayfeatures');
18-
ga('send', 'pageview');
19-
</script>
2010
<link rel="stylesheet" type="text/css" href="css/skeleton.css">
2111
<link rel="stylesheet" href="css/style.css">
2212
</head>

index.html

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,6 @@
77
<meta name="viewport" content="width=device-width, initial-scale=1">
88
<meta name="description" content="An archive of hackathons from around the world (2014-2025).">
99
<meta name="keywords" content="hackathon, hackathons, list, directory">
10-
<!-- Start Google Javascript -->
11-
<script>
12-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
13-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
14-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
15-
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
16-
ga('create', 'UA-51284668-3', 'auto');
17-
ga('require', 'displayfeatures');
18-
ga('send', 'pageview');
19-
</script>
2010
<link rel="shortcut icon" href="images/favicon.ico" />
2111
<link rel="stylesheet" type="text/css" href="css/skeleton.css">
2212
<link rel="stylesheet" type="text/css" href="css/style.css">
@@ -217,6 +207,6 @@ <h2>{{hackathon.title}}</h2>
217207
</div>
218208
</body>
219209

220-
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
210+
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.3/angular.min.js"></script>
221211
<script src="js/app.js"></script>
222212
</html>

test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,16 @@ for (const year of years) {
4444
let lastHackathon;
4545

4646
for (const hackathon of obj[monthName]) {
47+
// Validate URL fields don't use dangerous schemes (e.g. javascript:)
48+
for (const field of ['url', 'facebookURL', 'twitterURL']) {
49+
const val = (hackathon[field] || '').trim();
50+
if (val && /^[a-z][a-z0-9+.-]*:/i.test(val) && !/^https?:/i.test(val)) {
51+
bail(`${hackathon.title} has unsafe ${field}: ${val}`);
52+
}
53+
}
54+
4755
let startDate = Date.parse(hackathon.startDate);
48-
if (startDate !== undefined) {
56+
if (!isNaN(startDate)) {
4957
if (lastStartDate > startDate) {
5058
bail(`${hackathon.title} should be before ${lastHackathon.title}`);
5159
}

0 commit comments

Comments
 (0)