• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / blurts-server / #12870

pending completion
#12870

push

circleci

Vinnl
Don't pass unsanitised user input into HTML

It should now no longer be possible to pass arbitrary HTML (e.g.
including malicious JS) into the query parameters and have that
show up on the unsubscribe page. Additionally, the query parameters
get validated, and only the relevant parameters are sent to the
back-end.

282 of 1473 branches covered (19.14%)

Branch coverage included in aggregate %.

12 of 12 new or added lines in 1 file covered. (100.0%)

959 of 4003 relevant lines covered (23.96%)

1.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/controllers/unsubscribe.js
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4

5
import { guestLayout } from '../views/guestLayout.js'
6
import {
7
  unsubscribe,
8
  unsubscribeMonthly
9
} from '../views/partials/unsubscribe.js'
10
import { generateToken } from '../utils/csrf.js'
11
import { unsubscribeFromMonthlyReport } from '../utils/email.js'
12

13
function unsubscribePage (req, res) {
14
  const data = {
×
15
    csrfToken: generateToken(res),
16
    partial: unsubscribe,
17
    queryParams: req.query
18
  }
19

20
  res.send(guestLayout(data))
×
21
}
22

23
async function unsubscribeMonthlyPage (req, res) {
24
  try {
×
25
    await unsubscribeFromMonthlyReport(req, res)
×
26
  } catch (error) {
27
    console.log(error)
×
28
    return res.redirect('/')
×
29
  }
30

31
  const data = {
×
32
    csrfToken: generateToken(res),
33
    partial: unsubscribeMonthly
34
  }
35

36
  res.send(guestLayout(data))
×
37
}
38

39
export {
40
  unsubscribePage,
41
  unsubscribeMonthlyPage
42
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc