Skip to content

[IMP] gmail: encrypt the database with the sub of the Gmail token#68

Open
std-odoo wants to merge 1 commit into
odoo:v2from
std-odoo:v2-gmail-encrypt-db
Open

[IMP] gmail: encrypt the database with the sub of the Gmail token#68
std-odoo wants to merge 1 commit into
odoo:v2from
std-odoo:v2-gmail-encrypt-db

Conversation

@std-odoo

Copy link
Copy Markdown
Collaborator

Purpose

Encrypt the database with the sub of the Gmail token, to reduce the damage in case of a database leak.

Technical

We don't even need to store the email anymore (the hash of the key is all we need).

What's not encrypted is

  • user_id, for the foreign key between the log and the users
  • create_date, so the CRON can clean the old log

Nor of those information are really important, and we won't be able to link them to a specific Odoo / Gmail user without the encryption key.

The tricky point is the Odoo authentication process, the user is redirected to Odoo to accept the plugin, and then is redirected to the plugin with the Odoo token in the URL. We need to save the Odoo token in database, and so we need the encryption key. So we derive an application key from the application secret (for convenience, so there's no restriction on application secret size), and we encrypt with the application key, the user's key, user's email, login token, etc. That way those informations do not appear in the URL (and his browser history).

Task-6366629

@std-odoo
std-odoo force-pushed the v2-gmail-encrypt-db branch 8 times, most recently from bca6d0f to 7d01326 Compare July 15, 2026 13:21
Purpose
=======
Encrypt the database with the `sub` of the Gmail token, to reduce the
damage in case of a database leak.

Technical
=========
We don't even need to store the email anymore (the hash of the key is
all we need).

What's not encrypted is
- user_id, for the foreign key between the log and the users
- create_date, so the CRON can clean the old log

Nor of those information are really important, and we won't be able
to link them to a specific Odoo / Gmail user without the encryption key.

The tricky point is the Odoo authentication process, the user is
redirected to Odoo to accept the plugin, and then is redirected to the
plugin with the Odoo token in the URL. We need to save the Odoo token
in database, and so we need the encryption key. So we derive an
application key from the application secret (for convenience, so there's
no restriction on application secret size), and we encrypt with the
application key, the user's key, user's email, login token, etc.
That way those informations do not appear in the URL (and his browser
history).

Task-6366629
@std-odoo
std-odoo force-pushed the v2-gmail-encrypt-db branch from 7d01326 to c91c3b0 Compare July 15, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant