Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safer X-User #5267

Open
6 tasks
chibenwa opened this issue Sep 11, 2024 · 4 comments
Open
6 tasks

Safer X-User #5267

chibenwa opened this issue Sep 11, 2024 · 4 comments
Labels
Milestone

Comments

@chibenwa
Copy link
Member

Why?

As of today, James relies on Apisix for OIDC enforcement and propagates the calls to james, identifying the user through the mean of X-User header.

This means that any access to the JMAP port onto James means full compromission (integrity and confidentiallity) of the underlying data.

While of course an attacker shall not breach onto a private network, having a seat-belt for this definitly can save the day!

Having a shared secret to prove identity of the caller could achieve this (caller would need either man-in-the-middle / compromise either APisix or James which would anyway in itself compromise the email data).

Such a shared secret would greatly reduce the attack surface...

How?

Have a configurable shared secret for X-User in jmap.properties:

authentication.strategy.rfc8621.xUser.secret=abcdefghijkl

If configured, XUserAuthenticationSStrategy would enforce the incoming request to have the following header:

X-User-Secret: abcdefghijkl

And reject non compliant request with 401

We would need to modify our Apisix plugin to add the shared secret optionnally there too.

If omitted all requests are accepted (today behaviour)

Dod

  • James code modified
  • Apisix code plugin modified
  • imap.linagora.com updated
  • CNB updated
  • Twake workplace updated
  • MU updated
@chibenwa
Copy link
Member Author

Safer version: have the secret being a JWT with as a scope the user and an expiration.

James would only need public key. Apisix shall hold the privateKey.

Costs is a bit higher as James shall verify the signature.

We could keep that as a possible enhancement?

@quantranhong1999
Copy link
Member

I propose a new XUserWithSecretAuthenticationStrategy to avoid breaking changes.

@chibenwa
Copy link
Member Author

chibenwa commented Sep 23, 2024

I propose a new XUserWithSecretAuthenticationStrategy to avoid breaking changes.

+1 good idea.

And @deprecate the older one...

@chibenwa
Copy link
Member Author

(Moved in Todo as I really want this....)

@chibenwa chibenwa added this to the Sprint #43 milestone Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants