-
Notifications
You must be signed in to change notification settings - Fork 1
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
my attempt at allowing storage of password in Sys env #38
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #38 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 4 5 +1
Lines 131 160 +29
=====================================
- Misses 131 160 +29 ☔ View full report in Codecov by Sentry. |
Something like this is best practise: https://blog.r-hub.io/2024/02/28/key-advantages-of-using-keyring/
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind that the password will be exposed to anything that can read the sys env, the unsalted md5 hash is no protection against rainbow tables. Keyring would be a much, much better option. I'm however completely taken up by other projects at the moment, so I can't help implement it for the foreseeable future.
With this in mind, do you think this risk is acceptable? If, so, the code you have written should work. If not, you'll need to look at keyring.
Another, unrelated, risk is that users of this package will store sensitive data in unencrypted outputs, like csv or excel, or in their global environment. We can't really help this except not supplying access to this data at all. But I want to emphasize that storing personal data is not something that should be taken lightly.
For the record, I would it if you could rewrite using keyring. But understand if you, like me, are out of time budget. |
@PietrH in my honest opinion, if a widely used package like rgbif works in a similar way, why should we do more? especially since we will be using this package for a relative short time (at least until june). Also I don't have enough time to properly dive into the specifics of keyring. So if you could just approve this PR so I can continue? |
Because GBIF doesn't handle personal information like iAsset does. |
TRUE, I'll try my best to implement keyring |
I'm attending a hackathon all of next week, but if you set me as reviewer I'll get to it as soon as I can |
@PietrH I've implemented (or at least attempted to implement) keyring. Can you review again ? |
we don't want to store the key in sys.env, to avoid leaking it that way.
I propose the following:
Tell me if this is too much, or if you get stuck, let me know and I'll help. If it's me causing extra work, I might as well do some of it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made some changes directly to this PR while reviewing, I hope you don't mind. This isn't exactly "good reviewer" behaviour to be honest, it's better to work with code suggestions. As compensation I'll finish up with what I've started and you can review my work on Tuesday. I hope that is alright? .
My main thoughts are in the comment above, but it boils down to:
- I think we should store the username as well, and get rid of the
username
argument entirely - I think it's neater and clearer to wrap the setting of the key if it's missing, OR to use a custom error if it's missing with better instructions on how to fix it. I prefer having the function work without the users having to read the documentation (since we use it as a helper quite a bit) and without an error the first time; so wrapping seems best to me.
I'm having second thoughts about depreciating the username argument... I don't want to break existing scripts, or complicate the usage in github actions. So perhaps making it optional is an option, and then adding a helper that can fetch the username from the keyring... |
ok for me |
Even if we only support storing one set of iasset credentials at the moment, if this ever changes in the future this line will ensure we'll be fetching the right one.
@SanderDevisscher I'm done with my changes, can you take a look at this? |
@PietrH I expanded the error you get when you have more than 1 username associated with the "iasset_password" - service just so users (mainly myself) knows what to do to delete the unneeded usernames. For the rest Its ok for me ! So whats next ? I Merge this PR ? Do you redo your review ? |
Nicely done! If it's ok by you, it's ok by me. Go ahead and merge! |
fixes #20
probably not really best practice but since we are not going to use iAsset for much longer I think we just need to make some progress. Can you take a look at this PR and also #31 ? I need both to make progress with inbo/aspbo#8.