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

[IMP] Allow the administator to forbid passwords that contain the login. #1494

Closed
wants to merge 1 commit into from

Conversation

daramousk
Copy link
Member

@daramousk daramousk force-pushed the 10.0-password_no_login branch 3 times, most recently from 6dd9f34 to 7fcd317 Compare January 31, 2019 15:45
Copy link
Contributor

@NL66278 NL66278 left a comment

Choose a reason for hiding this comment

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

👍 Tested and LGTM

@pedrobaeza
Copy link
Member

Why Travis is red?

@NL66278
Copy link
Contributor

NL66278 commented Feb 4, 2019

It seems there are now some tests that fail that assume login's could be the same. Ais is true of course by default for admin and demo in demo. Probably some additional code is needed that suspends these checks for the relevant users, but of course only when testing (not to re-introduce the security hole, this PR intents to stop).

@yajo
Copy link
Member

yajo commented Feb 5, 2019

You could add a demo data file that disables that check in demo envs.

@NL66278
Copy link
Contributor

NL66278 commented Feb 5, 2019

@daramousk I think the most easy thing to do is either:

  1. Make False the default for the option to check passwords, and enable it for the test
  2. Add demo data (I think that was meant by @yajo) to set the option to False for the main company. (And then enable it in your test method). That seems actually the most "clean" method.

@yajo
Copy link
Member

yajo commented Feb 5, 2019

Yes, I meant that. I think option 2 is better because True seems saner as a default value.

@daramousk daramousk force-pushed the 10.0-password_no_login branch 3 times, most recently from fd1b853 to 9f30584 Compare February 14, 2019 14:30
@daramousk
Copy link
Member Author

@NL66278 Ok I tried figuring out whether this module breaks the tests on auth_brute_force. I installed and run the auth_brute_force in an empty database and that test still fails. Am I missing something here?

@yajo
Copy link
Member

yajo commented Feb 15, 2019

Odoo broke that test, and possibly lots of others, with odoo/odoo#30768. I'm investigating its fix.

@NL66278
Copy link
Contributor

NL66278 commented Feb 15, 2019

@daramousk the module auth_brute_force tests with passwords that contain the login. That should be rectified to be fully compatible with password_security. I had made a fix that I wanted to submit as a PR on your branch, but unfortunately I can not make PR's on your repo anymore. See patch.

diff --git a/auth_brute_force/tests/test_brute_force.py b/auth_brute_force/tests/test_brute_force.py
index 2e21b53..a3deb15 100644
--- a/auth_brute_force/tests/test_brute_force.py
+++ b/auth_brute_force/tests/test_brute_force.py
@@ -66,10 +66,10 @@ class BruteForceCase(HttpCase):
         except AttributeError:
             pass
         # Complex password to avoid conflicts with `password_security`
-        self.good_password = "Admin$%02584"
+        self.good_password = "A_dmin$%02584"
         self.data_demo = {
             "login": "demo",
-            "password": "Demo%&/(908409**",
+            "password": "D_emo%&/(908409**",
         }
         with self.cursor() as cr:
             env = self.env(cr)

@daramousk daramousk force-pushed the 10.0-password_no_login branch 2 times, most recently from 41bac8c to 21b897e Compare March 22, 2019 13:45
@daramousk
Copy link
Member Author

@hbrunn Maybe I could get a review here so that this can be merged as well.

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

def setUp(cls):
super(TestResUsers, cls).setUp()
cls.main_comp = cls.env.ref('base.main_company')
def setUp(self):
Copy link
Member

Choose a reason for hiding this comment

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

I think that the fix is wrong. Instead of changing all cls for self, you should change setUp for setUpClass.

This benefits from SavepointCase and speeds up tests.

Another option would be to switch for a TransactionCase instead.

<odoo>

<record id="base.main_company" model="res.company">
<field name="password_no_login">False</field>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<field name="password_no_login">False</field>
<field name="password_no_login" eval="False"/>

@daramousk
Copy link
Member Author

@NL66278 Yes indeed, I have reverted that

@daramousk
Copy link
Member Author

@hbrunn Ping for this one that has not been merged yet.

@daramousk
Copy link
Member Author

hello @pedrobaeza ,
Perhaps this can be merged?

@pedrobaeza
Copy link
Member

Please check comment from @yajo

@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Oct 22, 2023
@github-actions github-actions bot closed this Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants