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

Allow Module::CPANfile in taint mode #41

Merged
merged 2 commits into from Feb 12, 2016
Merged

Conversation

dylanwh
Copy link
Contributor

@dylanwh dylanwh commented Feb 8, 2016

I need to call this code under taint mode, and currently it dies. This fixes it and shouldn't hurt anyone.

@miyagawa
Copy link
Owner

miyagawa commented Feb 8, 2016

$code i get it, but i think you have to untaint $file in the caller, am I right?

@dylanwh
Copy link
Contributor Author

dylanwh commented Feb 8, 2016

I will test without but I think both were required.

@miyagawa
Copy link
Owner

miyagawa commented Feb 8, 2016

If you call load, maybe - but if you pass your own $file to parse(), you should be able to untaint it yourself.

@dylanwh
Copy link
Contributor Author

dylanwh commented Feb 9, 2016

How about this? The taint was coming from Cwd::abs_path().

@miyagawa
Copy link
Owner

miyagawa commented Feb 9, 2016

I actually don't get the point of this whole taint patch because you're using taint mode to distrust such tainted variables. If we add a support for scalar ref in parse i.e. $cpanfile->parse(\$code) you should be able to provide an untainted code snippet to parse - is that good?

@dylanwh
Copy link
Contributor Author

dylanwh commented Feb 9, 2016

I can live with that. Although I don't think either Cwd::abs_path() or the content of the cpanfile should be considered tainted. it's not like I detaint modules when I load them with require(). The cpanfile in question is just another part of the code base.
(And we're running taint mode mostly to prevent foot-gunning ourselves during SQL generation.)

@miyagawa
Copy link
Owner

miyagawa commented Feb 9, 2016

Yeah, it's mostly the same as do() or require() so in the POV it makes sense... let me see.

@dylanwh
Copy link
Contributor Author

dylanwh commented Feb 10, 2016

One this is fixed, I can remove a lot of cruft from Bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1246528 which will make me so happy.

@dylanwh
Copy link
Contributor Author

dylanwh commented Feb 11, 2016

@miyagawa -- what direction would you like me to take with this PR to get it accepted? I hate to bother, but I am eager for Module::CPANfile to work under taint mode.

Thanks!

miyagawa added a commit that referenced this pull request Feb 12, 2016
Allow Module::CPANfile in taint mode
@miyagawa miyagawa merged commit 4a258db into miyagawa:master Feb 12, 2016
@dylanwh
Copy link
Contributor Author

dylanwh commented Feb 12, 2016

Thank you again! :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants