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

Example using private auditors as a library #88

Closed
jplock opened this issue Feb 26, 2020 · 7 comments
Closed

Example using private auditors as a library #88

jplock opened this issue Feb 26, 2020 · 7 comments

Comments

@jplock
Copy link

jplock commented Feb 26, 2020

Is there a way to have a directory of private auditors that lives outside of the parliament folder (I’m using parliament as a library)?

The parliament module name seems hard coded in the import path in policy.py line 267

Thanks for a great library!

@0xdabbad00
Copy link
Collaborator

I believe it should be possible to import the private auditors directory as a path referenced from your current working directory. You can see the parliament binary is simply this: https://github.com/duo-labs/parliament/blob/master/bin/parliament

The importing of the private auditoring directory, as you pointed out, is done around here:

sys.path.append(".")

You can try adding some print statements to see what your sys.path is.

@jplock
Copy link
Author

jplock commented Feb 26, 2020

Isn't this line forcing the private auditor modules to be underneath the parliament namespace?

https://github.com/duo-labs/parliament/blob/0.4.8/parliament/policy.py#L265

@0xdabbad00
Copy link
Collaborator

No, because a few lines down, if a custom path is specified for the private auditors, then it sets full_package_name with that path.

https://github.com/duo-labs/parliament/blob/0.4.8/parliament/policy.py#L274

@jplock
Copy link
Author

jplock commented Feb 26, 2020

Oh duh, you're right, sorry about that. I'll keep messing around with the path to see if I can get it to work. Thanks for the help.

@jplock jplock closed this as completed Feb 26, 2020
@0xdabbad00
Copy link
Collaborator

I also just tested by referencing a private auditors directory that is not within my parliament directory, and it worked. Note though that you cannot reference parent directories (ie ../mypath), because of the . in that path. That can probably be fixed somehow, but it currently won't work.

@jplock
Copy link
Author

jplock commented Feb 27, 2020

@0xdabbad00 should I be able to pass a relative subdirectory into private_auditors_custom_path without a leading . or /?

@0xdabbad00
Copy link
Collaborator

Yes, that should work.

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