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

user realm does not work with action auditlog #663

Closed
cornelinux opened this issue Mar 22, 2017 · 2 comments
Closed

user realm does not work with action auditlog #663

cornelinux opened this issue Mar 22, 2017 · 2 comments
Labels
Topic: Audit Issues concerning the Audit-log Topic: Policy in regards to event handler modules and events (can be function, DB or UI) Type: Enhancement Not a complete new functional component/feature but an enhancement of an already existing feature. Type: Known issue Something that does not work like *some* people would expect
Milestone

Comments

@cornelinux
Copy link
Member

Please think about and cover the following questions:

Versions

privacyIDEA: 2.18

What did you try to do?

Restrict the auditlog for helpdesk users.
A helpdesk user (admin_realm) was supposed to only see audit entries for certain user realms.
Thus defining a policy

scope=admin
action=auditlog
admin_realm=helpdesk
realm=user_realm

What outcome did you expect?

Helpdesk user should only see audit entries with realm=user_realm.

What outcome did you experience?

Helpdesk user can not see auditlog at all.

Conclusion

Obviously the decorator at this place:
https://github.com/privacyidea/privacyidea/blob/master/privacyidea/api/lib/prepolicy.py#L763
does not work for action auditlog this way.

Workaround

Do not use user_realm with action auditlog.
Define a second policy if needed.

@cornelinux cornelinux added Type: Bug Confirmed bug Topic: Audit Issues concerning the Audit-log Topic: Policy in regards to event handler modules and events (can be function, DB or UI) Type: Known issue Something that does not work like *some* people would expect and removed Type: Bug Confirmed bug labels Mar 22, 2017
@cornelinux cornelinux added this to the 2.19 milestone Apr 19, 2017
@cornelinux
Copy link
Member Author

In fact it works as designed.
The decorator baseaction uses the user realm to check the user realm in the request parameter.

The help desk user should only see audit logs from realms, which he is allowed to manage. I.e. the help desk user has token rights. And realms which occur in the token policies should be visible I the audit log.

@cornelinux
Copy link
Member Author

We need to create an overlay filter on the search in the search_dict.

An administrator might be allowed to view entries from realmA and realmB and Users. Thus we should show him entries containing realmA or realmB or Users.

But the admin may also filter on the realm like "filter for: realm*". Then we need to show hin realmA and realmB, not "Users".

Thus the search_dict needs to be extended with some kind of "allowed_realm" and "allowed_resolver".
The parameter "realm" would still be the realm, which he entered as filter.

Thus the search condition will be constructed as

 ("realmA" or "realmB" or "Users") AND (<realm>)

A decorator should add the necessary parameters in the search_dict, in Audit.search.

Here
https://github.com/privacyidea/privacyidea/blob/master/privacyidea/lib/auditmodules/sqlaudit.py#L377
and here:
https://github.com/privacyidea/privacyidea/blob/master/privacyidea/lib/auditmodules/sqlaudit.py#L377
or here:
https://github.com/privacyidea/privacyidea/blob/master/privacyidea/lib/auditmodules/sqlaudit.py#L410

@cornelinux cornelinux added the Type: Enhancement Not a complete new functional component/feature but an enhancement of an already existing feature. label Apr 24, 2017
cornelinux added a commit that referenced this issue Apr 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Topic: Audit Issues concerning the Audit-log Topic: Policy in regards to event handler modules and events (can be function, DB or UI) Type: Enhancement Not a complete new functional component/feature but an enhancement of an already existing feature. Type: Known issue Something that does not work like *some* people would expect
Projects
None yet
Development

No branches or pull requests

1 participant