-
Notifications
You must be signed in to change notification settings - Fork 242
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
environment table needs to be whitelisted/blacklisted #233
Comments
You can remove them using the
Also, make sure you're using the latest version of EDIT: Come to think of it, I wonder why those aren't I'm happy to review a PR (to |
Maybe I was too quick to close this. I wonder why some of those are shown, since they were removed in |
I see why now, that PR was merged after the release of The question still stands tho: Why aren't they masked for you? Maybe because they're passed to a docker container and GitLab can't pick that up and mask them. 🤔 Anyway, I'll get started on a release that will solve some of them for you. For the others, you'll have to use the hook. |
@BeyondEvil GitLab passes those variables to jobs as they are, the masked thing is applied when GitLab shows job output only (
( Keep in mind that there are useful variables, like |
As I was saying then:
Agreed. I won't remove more than already removed in the linked PR. Unless a very compelling argument is put forth. Especially since, imo, it's very easy customizing what is shown and not using the aforementioned hook.
Yes. Not sure what your point is? 🤔 |
Sounds good!
The initial report from @fenchu shows some variables masked that in my opinion should not be masked or removed. My intention with this line was that usefulness of the report should not be sacrificed in the name of it being publicly shareable. |
Yeah, I'm even contemplating reverting that PR and going about this is in a different way. I see a couple of different approaches we can take, my favorite is to implement something similar to pytests What are your thoughts @davehunt ? |
Thanks for clarification :-) Filtering manually is fine. My initial question was more about doing this from the conftest.py file. if I use request or metadata fixtures they seem to run at the beginning before all my tests. Is there a hook so it can run after the testloop stage before reportgathering? |
@fenchu I would say that the fixture is used more to read metadata and the hook is used to modify. So the hook should give you what you want - filtering out the sensitive data. Are you saying that is not working? 🤔 |
This sounds like a reasonable approach to me. Perhaps we need two filters, one for variables to mark and another for variables to exclude completely. We could default to masking anything matching 'token' or 'password' in an effort to protect potentially vulnerable data, but we should be careful not to suggest that we're protecting these values. In fact, we should probably call out in the documentation that there is a risk of exposing secrets when using the plugin. |
Hey @BeyondEvil this sounds like an interesting thing we should implement, I'm going to get started on it. The approach I'll take is:
Am I missing any information to start working on this? |
Wow, that'd be great!
Excellent!
I don't think so. I'm going back and forth in my head thinking about where this belongs. But I think I've landed in this:
If this makes sense to you @gnikonorov I will make a release of pytest-metadata where I deprecate the default masking. pytest-html should make no assumptions of values being masked, I think. |
That makes sense @BeyondEvil. I'll implement this in two PRs then. One for redacting and one for masking. |
Turns out I don't have to do anything with |
Starting work on the first part now, @BeyondEvil. I'll allow for users to specify a list of environment variables to remove from the table completely ( not mask ). |
You're the best @gnikonorov 💪 |
Question though, @BeyondEvil. Why not just have users delete items from the environment table ( e.g.: |
I actually don't know @gnikonorov It's over a year old and not a request that is coming in very often. Perhaps your time is better spent on other things? 🤔 I mean, there's already two ways of removing items from metadata, maybe that's enough? Up to you really. |
How about we implement redacting and close this issue once it's in master? I was thinking we could let the user pass a list of strings/regexes and any metadata key that matches has its value redacted. We could make it an INI file setting. Thoughts @BeyondEvil ? |
when I use pytest-html in docker (with gitlab-ci) it needs a lot of environment variables set, some holds token and passwords. I do not want to show in my jenkins report to a wider audience.
It seems they are collected in the very first test, so adding this to a test is working using the request autofixture:
But I like to do it in conftest.py
The text was updated successfully, but these errors were encountered: