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

[17.0] odoo_readonly_user: Unintended privilege escalation for users with read-only permissions #330

Open
mahdiBerranem opened this issue Sep 20, 2024 · 1 comment

Comments

@mahdiBerranem
Copy link

The current implementation defaults to the "read" mode when checking access permissions, which inadvertently grants users access to write, create, and unlink operations if they already have read access.

https://github.com/CybroOdoo/CybroAddons/blame/29df15e9050eeeb889bc234884eb8a11a3e7a23a/odoo_readonly_user/models/ir_model_access.py#L30-L42

Suggested code:

@api.model
    def check(self, model, mode='read', raise_exception=True):
        """Overrides the default check method to allow
         only read access to the user."""
        model_name = ['res.users.log', 'mail.channel', 'mail.alias',
                 'bus.presence', 'res.lang',
                 'mail.channel.member']
        res = super().check(model, mode, raise_exception=raise_exception)
        if self.env.user.has_group('odoo_readonly_user.group_users_readonly') \
                and model not in model_name and mode in (
                'write', 'create', 'unlink'):
            return False
        return res
@digizilla-tohamy
Copy link

Facing same issue here

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

No branches or pull requests

2 participants