|
if hws_settings.P4PORT + if hws_settings.P4PORT.start_with?('rsh:') + fail P4Error.new(0, 3, 'Do not use rsh: P4PORT values') + end
gnicol (on p4_util.rb, line 32) commented
10 years ago
Did you consider special characters? |
Reply ·0 | |
|
|
|
if hws_settings.P4PORT + if hws_settings.P4PORT.start_with?('rsh:') + fail P4Error.new(0, 3, 'Do not use rsh: P4PORT values') + end |
Reply ·0 | |
|
|
|
if hws_settings.P4PORT + if hws_settings.P4PORT.start_with?('rsh:') + fail P4Error.new(0, 3, 'Do not use rsh: P4PORT values') + end
tjuricek (on p4_util.rb, line 32) commented
10 years ago
What special characters are interpreted by the underlying system? I'm not looking to block anything but keep the p4api from exec-ing random shit. I'll make it case insensitive though, that'd be good |
Reply ·0 | |
|
|
|
if hws_settings.P4PORT + if hws_settings.P4PORT.start_with?('rsh:') + fail P4Error.new(0, 3, 'Do not use rsh: P4PORT values') + end
gnicol (on p4_util.rb, line 32) commented
10 years ago
No idea. I wouldn't be shocked if whitespace was ignored by p4d (haven't tested don't know) though. Perhaps there is a more secure way to just inform p4-api you don't want to permit rsh ports? |
Reply ·0 | |
|
|
|
if hws_settings.P4PORT + if hws_settings.P4PORT.start_with?('rsh:') + fail P4Error.new(0, 3, 'Do not use rsh: P4PORT values') + end
gnicol (on p4_util.rb, line 32) commented
10 years ago
Quick glance it looks like 'jsh:' is also a thing and will allow arbitrary command execution. Blocking rsh: and jsh: when it lands just anywhere isn't a good idea. It would block blundersh:1666 for example which is a perfectly viable port. Given your architecture, I'd strongly suggest looking into having p4-api parse the port then asking it to tell you if its this sorta style. |
Reply ·0 | |
|
|
|
if hws_settings.P4PORT + if hws_settings.P4PORT.start_with?('rsh:') + fail P4Error.new(0, 3, 'Do not use rsh: P4PORT values') + end
tjuricek (on p4_util.rb, line 32) commented
10 years ago
Hm, appears I have more work to do. I made another commit related to this topic. Disregard that. I'm gonna have to sift through the P4API for a bit to figure out what to do. |
Reply ·0 | |
|
|
|
if hws_settings.P4PORT + if hws_settings.P4PORT.start_with?('rsh:') + fail P4Error.new(0, 3, 'Do not use rsh: P4PORT values') + end |
Reply ·0 | |
|