Commit Graph
25 Commits
Author SHA1 Message Date
Jordi Mallach a863283680 feat(web): add optional Content Security Policy
AngularJS (EOL since 2022-01) and AngularJS Material no longer receive
security fixes, so any new vulnerability in them will stay unpatched.
In AngularJS, templates are code: any attacker-controlled text that
ends up in a compiled template is evaluated as an expression, and
since 1.6 there is no expression sandbox, so a single
{{constructor.constructor('...')()}} gives full script execution.
SOGo renders untrusted data (mail bodies, invitations, attachment
names, contact fields) into such templates and currently relies on
server-side filtering, like stripping "{{" and "}}", to prevent this.
Any gap in that filtering, or a bypass of $sanitize/ng-bind-html,
would mean XSS in the webmail session: reading and sending mail as
the user, and access to calendars and contacts.

A Content Security Policy adds a second layer in the browser that
doesn't depend on catching every injection. The new
SOGoContentSecurityPolicy system default ("report-only" or "enforce",
disabled when unset) sends a strict policy with the pages of the web
interface:

  script-src 'self' 'nonce-<random>'   (no 'unsafe-inline'/'unsafe-eval')
  style-src 'self' 'unsafe-inline'     (Angular Material, CKEditor 5)
  object-src 'none'; base-uri 'self'; frame-ancestors 'self'; ...

The policy is generated by sogod, since a fresh 128-bit nonce is needed
per response: it is shared by all components of the response and set
on the inline configuration scripts of the page frame and module views.
The page also gets ng-csp="no-unsafe-eval", so AngularJS evaluates
expressions with its interpreter instead of Function().

With the policy enforced, an expression injected into a compiled
template, such as {{constructor.constructor('...')()}}, can no longer
reach Function() and fails with an EvalError, and injected inline
scripts are blocked. Injected expressions are limited to calling
functions available on the scope.

Tested with Chromium in both modes on login, Mail (HTML messages,
remote content, invitations, compose), Calendar and Contacts editors,
Preferences and Administration: no violations from SOGo's own code.
With the default unset, the generated output is unchanged.

form-action is deliberately not restricted, so SAML2/CAS/OpenID
logins posting to an external IdP keep working. Scripts listed in
SOGoUIAdditionalJSFiles are served from WebServerResources and allowed,
but must not load scripts from other origins, use eval() or rely on
inline handlers; their dependencies have to be installed and listed
alongside them.
2026-11-06 16:22:03 +01:00
Francis Lachapelle 4b47e5de83 Calendar module: initial AngularJS-based templates 2015-06-12 11:41:25 -04:00
Francis Lachapelle 6a25ccfe96 Remove data- prefix in attributes of HTML tags 2015-06-12 11:17:50 -04:00
Francis Lachapelle d9ca1051b3 Improve headers of multicolumns view 2014-07-25 11:34:33 -04:00
Francis Lachapelle 45553be122 Fix rename of calendars, improve tasks count badge 2014-07-08 17:19:55 -04:00
Alexandre Cloutier de2ee2322a Change the NSString with NSNumber and add some JavaScript 2014-06-11 10:24:04 -04:00
Alexandre Cloutier 43ac57b671 display the number of active tasks in calendar view 2014-06-10 16:18:12 -04:00
Francis Lachapelle 616ee7c6e4 GUI changes for mail labels management 2013-11-13 14:46:08 -05:00
Francis Lachapelle 3cd91846a6 Fix CSS color refresh of calendars 2013-04-11 16:32:17 -04:00
Francis Lachapelle e7f0c9c03f See ChangeLog
Monotone-Parent: eb22f4d3b368a79ce56bcad18f9f176fff0cb73c
Monotone-Revision: 157670819f732591d0987b295faeb89c843803db

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2012-09-07T19:46:49
Monotone-Branch: ca.inverse.sogo
2012-09-07 19:46:49 +00:00
Francis Lachapelle 79dbdd7638 Monotone-Parent: ae5fd1cb71edba3016f8edd102e7a43615acc56c
Monotone-Revision: 58b4ca502998bfaf9c6b14b5d849b8e4fd883bce

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2012-03-13T16:06:59
2012-03-13 16:06:59 +00:00
Francis Lachapelle fd207d4b18 generic.css
Monotone-Parent: d0a487816750ff28414ee58d1b18b6958dba1a95
Monotone-Revision: ae5fd1cb71edba3016f8edd102e7a43615acc56c

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2012-03-13T15:56:03
2012-03-13 15:56:03 +00:00
Francis Lachapelle e9a9134d92 Fix CSS in UIxComponentEditor
Monotone-Parent: f094a21d8e470bf3e243d0c7413263f48be70226
Monotone-Revision: 9f67c189b2251b9511b4088c2ea0553e82a50502

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2009-11-25T19:21:58
Monotone-Branch: ca.inverse.sogo
2009-11-25 19:21:58 +00:00
Francis Lachapelle 468073b131 Major refresh of CSS stylesheets.
Monotone-Parent: 508bbe52515b0ad7119c755b4cc91d17e313c06b
Monotone-Revision: d09001490c2d88332ef3ec446bfd0aa488d0de8c

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2009-11-04T22:13:20
Monotone-Branch: ca.inverse.sogo
2009-11-04 22:13:20 +00:00
C Robert 9d46c890d1 Added support for remote iCal calendars.
Monotone-Parent: a1fe20acf2d2d8408bcf2e8c36a38204f8d1bfad
Monotone-Revision: bb2513b08d345dfc89b0cd702a39ac0eeb276c3d

Monotone-Author: crobert@inverse.ca
Monotone-Date: 2009-09-10T17:26:57
Monotone-Branch: ca.inverse.sogo
2009-09-10 17:26:57 +00:00
Francis Lachapelle acdce07ee0 Monotone-Parent: 38a512204cb4c49fbc144379e8587aaea3394a3a
Monotone-Revision: 62820f08c88e6bd9bf5b0d9c61b83fb3d1a337e8

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2008-08-25T19:13:18
Monotone-Branch: ca.inverse.sogo
2008-08-25 19:13:18 +00:00
Wolfgang Sourdeau 99d4c95556 Monotone-Parent: 4da2e2aa68da3f6c69bddae3167041872607c9d2
Monotone-Revision: 589cbe87a5260166298c57c4fa50494edb7b9fbd

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-04-22T17:16:37
Monotone-Branch: ca.inverse.sogo
2008-04-22 17:16:37 +00:00
Francis Lachapelle 9b5553e678 Monotone-Parent: 9932c60ae3f371eb7352ff77e53ef5ca51f43aec
Monotone-Revision: 82f96380d04412c3a15ffd57500fa486d0f62a80

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2007-11-12T21:20:18
Monotone-Branch: ca.inverse.sogo
2007-11-12 21:20:18 +00:00
Francis Lachapelle d1bc275c1f Monotone-Parent: 144891fa296b6c974c0d29524a0c1c6609d48279
Monotone-Revision: d82071db080ca95a635a31828f573df51471c057

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2007-10-24T17:10:16
Monotone-Branch: ca.inverse.sogo
2007-10-24 17:10:16 +00:00
Francis Lachapelle 2ff9d68fbd Monotone-Parent: 150dfc7aab21ae2733a4b789463f361e2a53ad97
Monotone-Revision: 144891fa296b6c974c0d29524a0c1c6609d48279

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2007-10-24T15:52:08
Monotone-Branch: ca.inverse.sogo
2007-10-24 15:52:08 +00:00
Francis Lachapelle 3e46e3a10c Monotone-Parent: 8aa07a8f048c7e50cdc15d7dd7aa1b00d822b02f
Monotone-Revision: 7db6fbb0b2c9e675b2ca5efecf2fbe3abb0ea5f9

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2007-10-02T15:29:16
Monotone-Branch: ca.inverse.sogo
2007-10-02 15:29:16 +00:00
Wolfgang Sourdeau bd194575df Monotone-Parent: 63bcd763cff414d885e16f073fd75273e3b16ddb
Monotone-Revision: 4d261df2cf600b1a2b203cffba49ea6559226fdd

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-09-15T02:31:34
Monotone-Branch: ca.inverse.sogo
2007-09-15 02:31:34 +00:00
Wolfgang Sourdeau e2340b4c9f UI/Scheduler/Toolbars/SOGoAppointmentFolders.toolbar
Monotone-Parent: c4c95e670daa9c22e838239469a51f3d23b84ab0
Monotone-Revision: 92e93f3527a76deed69fa61275517490d57f9a4f

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-09-14T22:01:02
Monotone-Branch: ca.inverse.sogo
2007-09-14 22:01:02 +00:00
Wolfgang Sourdeau 9a844795ba Monotone-Parent: d257ee0d09b25821c14d4343634d3a8c6554d18e
Monotone-Revision: fd1d566347aebd2d239e2ab3b7674b263512dcc7

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-04-04T17:12:33
Monotone-Branch: ca.inverse.sogo
2007-04-04 17:12:33 +00:00
Wolfgang Sourdeau 707c56056f Monotone-Parent: eea420a3a6baf8b6e4fd36b41c6108614dfca6db
Monotone-Revision: 96d15a7e69b71adabbc43e1d452fe64be7f28b73

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-03-29T18:05:29
Monotone-Branch: ca.inverse.sogo
2007-03-29 18:05:29 +00:00