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 9dbb77047e chore: remove SOGoUI/UIxJSClose 2021-06-14 11:38:43 -04:00
Francis Lachapelle e79494c43c Reflect active locale in HTML lang attribute
Fixes #4660
2019-01-28 10:04:55 -05:00
Ludovic Marcotte a30d620502 (fix) avoid using for now the XSRF code for proxy-auth (fixes #3668) 2016-05-11 08:55:05 -04:00
Francis Lachapelle 70fbeab27a (js) Improve sg-search directive
Will now respect the "listRequiresDot" source parameter and uses
ng-messages to show an error if the minimum number of characters is not
reached.

Fixes #438, #3464
2016-02-24 21:41:03 -05:00
Francis Lachapelle 6bfc44fb53 (js) Add support for %p in date formatting
Fixes #3480
2016-02-01 20:54:37 -05:00
Francis Lachapelle 77b80e27c6 Add support for themes 2015-06-11 15:25:24 -04:00
Francis Lachapelle 0181ec606d Cleanup months and weeks translations
Removed the translations of months and weeks from the Scheduler bundle
since they were already translated in Locale files.
 - The a3_<month> strings were removed (replaced by
   NSShortMonthNameArray)
- The months strings were removed (replaced by NSMonthNameArray)
- The weeks strings were removed (replaced by NSWeekDayNameArray)

Moved the a2_<weekday> strings to the Common bundle and added a new
method [UIxComponent commonLabelForKey:].
2012-09-21 21:48:39 -04:00
Francis Lachapelle 95e42d38f7 Monotone-Parent: b4900cbcd7c48cfd36bb5a262eec357e3ac1033a
Monotone-Revision: 533c5fea139373885b136bf6d41275a80a56967b

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-12-09T16:34:11
2011-12-09 16:34:11 +00:00
Wolfgang Sourdeau 7ec440bbc1 Monotone-Parent: 8641791497cbe0e199fc4b68731683dd533ce48e
Monotone-Revision: 8d583d2e8977d0d63e028818f6f961246d256bdd

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2011-12-09T14:53:44
2011-12-09 14:53:44 +00:00
Wolfgang Sourdeau fb9ac84533 Monotone-Parent: f9a04cc4832d7c1ca8d70b594faba3c5a0eda334
Monotone-Revision: f3dd7372c4f74c5e1e309b528107e222964ca70b

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2009-11-10T21:39:40
Monotone-Branch: ca.inverse.sogo
2009-11-10 21:39:40 +00:00
Francis Lachapelle 13f621c453 Improved login page
Monotone-Parent: 6b9f81899aec0db3909c9b036a5cb7166a9185bc
Monotone-Revision: 298cdcf2f6c47c075aa3da6b45deb9784730194d

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2009-07-14T17:20:49
Monotone-Branch: ca.inverse.sogo
2009-07-14 17:20:49 +00:00
Wolfgang Sourdeau bdc02c26ab Monotone-Parent: 52de90085e2d18ded0d0c315e7148e1c72feb785
Monotone-Revision: 99d14630f5294d40da6680a39d69b6f1b7853938

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-07-17T21:12:43
Monotone-Branch: ca.inverse.sogo
2008-07-17 21:12:43 +00:00
Wolfgang Sourdeau 74013564b1 Monotone-Parent: bb0d71310c5e05a41e1acc07768c6ec4c2b2b5fe
Monotone-Revision: ab2e4a9b9ea9d6fe4dbb85153205e15f4a080f30

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-06-20T04:11:41
Monotone-Branch: ca.inverse.sogo
2008-06-20 04:11:41 +00:00
Wolfgang Sourdeau 8d0a42abef Monotone-Parent: e94c8ae67d2887b188febc57c064c3e5be325bc9
Monotone-Revision: 3a52f24d5383740ac373578b476831142dd2d359

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-12-13T19:25:01
Monotone-Branch: ca.inverse.sogo
2007-12-13 19:25:01 +00:00
Wolfgang Sourdeau e1f063f50c Monotone-Parent: 7c581e0875343b221a79db4c4117358d726166f1
Monotone-Revision: 41663dd56ce370b47da06520cdf3f63f55b42cb6

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-09-11T19:32:52
Monotone-Branch: ca.inverse.sogo
2007-09-11 19:32:52 +00:00
Wolfgang Sourdeau 45e64e1465 Monotone-Parent: ec985fb9e6b66a8966484429823a42e99822facc
Monotone-Revision: 9710a1d0cb659a58b931bdacad52d1d28dbbbe47

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-09-05T14:55:58
Monotone-Branch: ca.inverse.sogo
2007-09-05 14:55:58 +00:00
Wolfgang Sourdeau c467af6aa2 Monotone-Parent: f1d6bbdddac1991718ebbf895c02a5b084ac7094
Monotone-Revision: 56401c752068eee483fe404dd572236401e9ae8d

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-10-12T16:44:40
Monotone-Branch: ca.inverse.sogo
2006-10-12 16:44:40 +00:00
Wolfgang Sourdeau 51e4e4046d Monotone-Parent: dd288587ff94f2fc40c82dd8e32cf52f45b50841
Monotone-Revision: b0ba815a88a1243ad497187fab3660f3ebef9f27

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-10-04T23:13:09
Monotone-Branch: ca.inverse.sogo
2006-10-04 23:13:09 +00:00
Wolfgang Sourdeau 7b1cd90d5b Monotone-Parent: 820b27e801f0d5e9a95d74d782342e33456b3b4d
Monotone-Revision: c818bd7fb6cf31cc71d77656fd51138b3237c073

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-09-08T15:26:46
Monotone-Branch: ca.inverse.sogo
2006-09-08 15:26:46 +00:00
Wolfgang Sourdeau 96cdace6fe Monotone-Parent: 6e571370868349ff9fdc22d99f98878688e1a798
Monotone-Revision: 648ca938b27c6fb6be0365e39d56a5441ded8ed5

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-09-05T20:13:16
Monotone-Branch: ca.inverse.sogo
2006-09-05 20:13:16 +00:00
Wolfgang Sourdeau c6201a01c6 Monotone-Parent: 91b936a7c3b51400c8170802ad0c722be8b8553b
Monotone-Revision: 6d9008be8a9f9eeb652c345572bad88c284033f6

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-09-05T18:42:18
Monotone-Branch: ca.inverse.sogo
2006-09-05 18:42:18 +00:00
Wolfgang Sourdeau 5eee673bd0 Monotone-Parent: bc78b9b254f96e0d0101e04673ec9e39cec14f8c
Monotone-Revision: 985fef86a89f89cae1460daa879141f78ad0b404

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-09-05T14:53:38
Monotone-Branch: ca.inverse.sogo
2006-09-05 14:53:38 +00:00
Wolfgang Sourdeau 39228fb130 Monotone-Parent: 8566d6fbfa896a774b9907c3125e7b3de87296cd
Monotone-Revision: 2ad8b0c019808014c990f51cc69c4457fdb537c6

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-07-28T22:59:11
Monotone-Branch: ca.inverse.sogo
2006-07-28 22:59:11 +00:00
dev-unix.inverse.qc.ca f18c764ffa see ChangeLog
Monotone-Revision: 9054022ef1ca8aeba6e34842d27d9b94ce002b89

Monotone-Author: dev-unix.inverse.qc.ca
Monotone-Date: 2006-06-15T19:34:10
Monotone-Branch: ca.inverse.sogo
2006-06-15 19:34:10 +00:00