Commit Graph
720 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
Hivert Quentin 2a8f20e080 i18n(hu): Update Hungarian translations 2026-08-13 10:03:55 +02:00
Hivert Quentin 47133fdf3b fix(mail): escape angularJS directive for description 2026-08-10 19:34:25 +02:00
Vincent Bonamy a99a848064 Revert cleanup of usesCASAuthentication on c3234882eb - useful for CAS-specific frontend recovery logic 2026-06-15 08:56:23 +02:00
Hivert Quentin 4e5c2516d4 i18n(pl): Update Polish translations 2026-05-11 09:16:30 +02:00
Hivert Quentin f9b71059f4 fix(acl): only add existing uid 2026-04-20 09:08:40 +02:00
Hivert Quentin 40228c619b i18n(all): update several translations 2026-03-30 10:06:08 +02:00
Hivert Quentin 1fdb4d3026 i18n(pt): Add Greek (partial) 2026-03-02 15:01:52 +01:00
Hivert Quentin 6ce884b3e7 i18n(es_ES): Update SpanishSpain translations 2026-03-02 11:49:55 +01:00
Hivert Quentin 4a587fe000 i18n(ca): Update Catalan translations 2026-03-02 11:49:54 +01:00
vrubim 47239ba0fd add remaining traslations for catalan and spanish 2025-12-12 10:27:17 +01:00
Hivert Quentin 16fcb46c4b i18n(pl): Update Polish translations 2025-10-06 09:47:37 +02:00
Hivert Quentin f252e0e2c2 i18n(cs): Update Czech translations 2025-10-06 09:47:37 +02:00
Hivert Quentin f5f8f112cd chore(language): Add Thai language 2025-07-03 16:59:56 +02:00
Hivert Quentin 08bc6aff3f chore(language): Add Korean language 2025-07-03 09:35:50 +02:00
Hivert Quentin e9c03d3cf7 i18n(tr_TR): Update TurkishTurkey translations 2025-06-25 08:52:35 +02:00
Hivert Quentin 031e117cba i18n(nl): Update Dutch translations 2025-06-25 08:52:34 +02:00
Hivert Quentin 7c36a65b7c i18n(cy): Update Welsh translations 2025-03-24 09:57:16 +01:00
Hivert Quentin 52ae03d064 i18n(uk): Update Ukrainian translations 2025-03-24 09:57:16 +01:00
Hivert Quentin a860101003 i18n(tr_TR): Update TurkishTurkey translations 2025-03-24 09:57:16 +01:00
Hivert Quentin 397d0ee5fc i18n(sv): Update Swedish translations 2025-03-24 09:57:16 +01:00
Hivert Quentin da15327c92 i18n(es_ES): Update SpanishSpain translations 2025-03-24 09:57:15 +01:00
Hivert Quentin f273d3e513 i18n(es_AR): Update SpanishArgentina translations 2025-03-24 09:57:15 +01:00
Hivert Quentin 9a3a06c957 i18n(sl_SI): Update Slovenian translations 2025-03-24 09:57:15 +01:00
Hivert Quentin 5753a52ab4 i18n(sk): Update Slovak translations 2025-03-24 09:57:15 +01:00
Hivert Quentin b86f59411a i18n(sr@latin): Update SerbianLatin translations 2025-03-24 09:57:15 +01:00
Hivert Quentin 20d6b98f07 i18n(sr): Update Serbian translations 2025-03-24 09:57:14 +01:00
Hivert Quentin 80abd1d896 i18n(ru): Update Russian translations 2025-03-24 09:57:14 +01:00
Hivert Quentin 4438a2e647 i18n(ro_RO): Update Romanian translations 2025-03-24 09:57:14 +01:00
Hivert Quentin 81406434d6 i18n(pt): Update Portuguese translations 2025-03-24 09:57:14 +01:00
Hivert Quentin 65f7b2552a i18n(pl): Update Polish translations 2025-03-24 09:57:13 +01:00
Hivert Quentin d23bb125a3 i18n(nn_NO): Update NorwegianNynorsk translations 2025-03-24 09:57:13 +01:00
Hivert Quentin 39fa4fc38f i18n(nb_NO): Update NorwegianBokmal translations 2025-03-24 09:57:13 +01:00
Hivert Quentin ae4d6a07f3 i18n(sr_ME@latin): Update Montenegrin translations 2025-03-24 09:57:13 +01:00
Hivert Quentin d43f3378a5 i18n(mk_MK): Update Macedonian translations 2025-03-24 09:57:13 +01:00
Hivert Quentin 2bf0780942 i18n(lt): Update Lithuanian translations 2025-03-24 09:57:12 +01:00
Hivert Quentin 4367ca5247 i18n(lv): Update Latvian translations 2025-03-24 09:57:12 +01:00
Hivert Quentin 7617db7383 i18n(kk): Update Kazakh translations 2025-03-24 09:57:12 +01:00
Hivert Quentin 4d5cf314b5 i18n(it): Update Italian translations 2025-03-24 09:57:12 +01:00
Hivert Quentin 7b0319d616 i18n(id_ID): Update Indonesian translations 2025-03-24 09:57:12 +01:00
Hivert Quentin 0f2faec7d4 i18n(is): Update Icelandic translations 2025-03-24 09:57:12 +01:00
Hivert Quentin 51cf90d620 i18n(hu): Update Hungarian translations 2025-03-24 09:57:12 +01:00
Hivert Quentin ef6f53f48c i18n(he): Update Hebrew translations 2025-03-24 09:57:11 +01:00
Hivert Quentin 1f379d51fd i18n(de): Update German translations 2025-03-24 09:57:11 +01:00
Hivert Quentin a98d4b9944 i18n(gl): Update Galician translations 2025-03-24 09:57:11 +01:00
Hivert Quentin e0677705aa i18n(fi): Update Finnish translations 2025-03-24 09:57:11 +01:00
Hivert Quentin f110498d3f i18n(nl): Update Dutch translations 2025-03-24 09:57:11 +01:00
Hivert Quentin 2912e07e0b i18n(da_DK): Update Danish translations 2025-03-24 09:57:10 +01:00
Hivert Quentin ac6abb66ec i18n(cs): Update Czech translations 2025-03-24 09:57:10 +01:00
Hivert Quentin 6bb9796550 i18n(hr_HR): Update Croatian translations 2025-03-24 09:57:09 +01:00