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

Using Vakt with Pandas #35

Open
Peter99-ya opened this issue Jul 1, 2020 · 4 comments
Open

Using Vakt with Pandas #35

Peter99-ya opened this issue Jul 1, 2020 · 4 comments
Labels

Comments

@Peter99-ya
Copy link

Hi, I would like to implement access control to a panda dataframe. I set up the whole policies...

I have a data frame called df, to which I have attached some attributes...

I would like to restrict query functions. I would like to restrict a user from using the following command for example:

df.info or df.loc[1:10] (those are basic examples).

I do not see how I can apply vakt for this use case.

Thank you so much for your answer.

@kolotaev
Copy link
Owner

kolotaev commented Jul 1, 2020

Hi, I'm not sure it's possible to do it on the object's method invocation level. Vakt works on a higher level (like, in fact, any other access-control library).
You'll need to use wrappers where you:

  1. call vakt to check the access rights
  2. call the underlying method of pandas objects (like df.info. etc.)

@Peter99-ya
Copy link
Author

Thank you so much for you answer. Please pardon me if I am asking some obvious questions. For the object's methods you say it is not feasible but what if I have a csv file somewhere on my PC, a set of user attributes stored somewhere. The user is working, let's say on Jupyter and I would like to restrict his access to this csv file. Would this be possible?

@kolotaev
Copy link
Owner

kolotaev commented Jul 1, 2020

In case you definitely need some other library methods calls to be restricted without any wrapper code from your side, you need an escape hatch in the form of monkey patching. Just google, how it's done in python.

@Peter99-ya
Copy link
Author

Ok thank you so much. I will check that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants