Skip to content

Conversation

@hitesh-erpharbor
Copy link

No description provided.

legalsylvain and others added 25 commits November 26, 2025 18:39
To fix OCA/server-tools#1125 I needed to refactor the addon. To whitelist IPs now you use a config parameter, which renders res.banned.remote model unneeded.

The fix is affected by odoo/odoo#24183 and will not work until it gets fixed upstream due to the technical limitations implied.
- The `whitelisted` field needs to exist in view to be usable.
- The correct class is `decoration-danger` for tree views.
…#1251)

Include HACK for odoo/odoo#24833, which explains the false positive problem we were having here: an addon being importable doesn't mean it is installed.
- Remove Python coding headers.
- Remove v10 migration scripts.
- Standard py2-py3 changes.
- Do not encode POST data in tests, Odoo now uses `requests` for `HttpCase` connections.
…s#1258)

In Odoo v9, every request calls `res.users.check()`, which stores one authentication attempt per request, which is false.

Besides, it easily leads to hitting ip-api.com rate limits, so now that API is only asked when seeing in form view (simply by setting the computed field as not stored).

Also, form view was hidden, so it's now visible.
By implementing nestable savepoints in the TestCursor (courtesy of
Holger Brunn), the failed login attempts are preserved during the test.
Currently translated at 62.5% (15 of 24 strings)

Translation: server-auth-11.0/server-auth-11.0-auth_brute_force
Translate-URL: https://translation.odoo-community.org/projects/server-auth-11-0/server-auth-11-0-auth_brute_force/it/
Currently translated at 62.5% (15 of 24 strings)

Translation: server-auth-11.0/server-auth-11.0-auth_brute_force
Translate-URL: https://translation.odoo-community.org/projects/server-auth-11-0/server-auth-11-0-auth_brute_force/it/
Currently translated at 62.5% (15 of 24 strings)

Translation: server-auth-11.0/server-auth-11.0-auth_brute_force
Translate-URL: https://translation.odoo-community.org/projects/server-auth-11-0/server-auth-11-0-auth_brute_force/it/
@jans23 jans23 force-pushed the 18.0-mig-auth_brute_force branch from cfc5b23 to 290649d Compare November 26, 2025 14:50
Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi. Thanks for porting this module !

Could you create readme fragments in a new folder readme ? (as per other OCA modules ? )

thanks !

Otherwise, LGTM. Code review / no test.

@jans23 jans23 force-pushed the 18.0-mig-auth_brute_force branch from 290649d to 14bdfd0 Compare November 27, 2025 08:32
@jans23
Copy link

jans23 commented Nov 27, 2025

I added "readme" fragments as requested.

@@ -0,0 +1,12 @@
* Remove 🐒 patch for https://github.com/odoo/odoo/issues/24183 in v12.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think if this roadmap section is still valid ?or obsolete ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(you removed the according code in the python file)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 13 to 22
def strtobool(val):
val = str(val).strip().lower()
if val in ("y", "yes", "true", "t", "1", "on"):
return True
elif val in ("n", "no", "false", "f", "0", "off"):
return False
else:
raise ValueError(f"Invalid truth value: {val}")


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

odoo removed this function. I think we can remove it also.
correct value are True or False.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

check_remote = strtobool(
self.env["ir.config_parameter"]
.sudo()
.get_param("auth_brute_force.check_remote", "True")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        .get_param("auth_brute_force.check_remote", "True")

->

        .get_param("auth_brute_force.check_remote", True)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,12 @@
* Remove 🐒 patch for https://github.com/odoo/odoo/issues/24183 in v12.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(you removed the according code in the python file)


@classmethod
def authenticate(cls, db, login, password, user_agent_env):
def authenticate(cls, db, password, user_agent_env):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The V18 signature is

def authenticate(cls, db, credential, user_agent_env):

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

# Override all auth-related core methods
@classmethod
def _login(cls, db, login, password):
def _login(cls, db, password, user_agent_env):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the correct signature is

def _login(cls, db, credential, user_agent_env):

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@hitesh-erpharbor hitesh-erpharbor force-pushed the 18.0-mig-auth_brute_force branch 7 times, most recently from 0899d7e to d1c4800 Compare December 3, 2025 11:25
@hitesh-erpharbor hitesh-erpharbor force-pushed the 18.0-mig-auth_brute_force branch from d1c4800 to d70b89c Compare December 3, 2025 11:27
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.