News for hackers. Stuff that matters.
Re:Using Gooey as a Universal Front End for Any Language or ... by tomc1985 on Sunday September 22, 2019 @11:19PM (#21045679)
> wrapping CLI commands to turn them into APIs/make them programmable

CLI apps are already very programmable. How would you API-ify them even more?

  system('yourapp --option1 --option2=something')
Re:Using Gooey as a Universal Front End for Any Language or ... by tlrobinson on Monday September 23, 2019 @12:13AM (#21045865)
Avoiding entire classes of escaping/parsing vulnerabilities.
Re:Using Gooey as a Universal Front End for Any Language or ... by tomc1985 on Monday September 23, 2019 @12:16AM (#21045875)
By burying them in the framework....
Re:Using Gooey as a Universal Front End for Any Language or ... by HelloNurse on Monday September 23, 2019 @07:28AM (#21047826)
Yes, exactly, just like database query processing in ORM systems and the like "buries" SQL injection countermeasures in a single place. It's a good thing.
Re:Using Gooey as a Universal Front End for Any Language or ... by TeMPOraL on Monday September 23, 2019 @07:43AM (#21047912)
There's abstraction confusion here, though. All SQL injection countermeasures and all it would take to protect the above CLI call is respecting the actual language you're using. That is, not gluing a query/command from strings.

Starting a subprocess via shell is could in particular be solved by a simple API of the form of:

  system('yourapp', ['option1', {'option2' : 'something'}]);
in your favourite language. Handling pipes and redirects gets more complex, but I see no prima facie reason why it couldn't look like this:

  pipe(system('yourapp', ['option1', {'option2' : 'something'}]),
       system('grep', ['n', 'i', 'foobar']),
       system('somethingelse', [], null, file("/dev/null")));
Re:Using Gooey as a Universal Front End for Any Language or ... by account42 on Tuesday September 24, 2019 @07:30AM (#21058769)
This assumes the --option=value syntax which while a de-facto standard on Unix-like systems is unfortunately not supported by all programs.

I agree that system() (in C and other langues that simply copied it) is a bad API. For shell escaping a command to start a process with a list of arguments would be enough, and even POSIX C has you covered there with vararg and array variants. [1]

[1] http://man7.org/linux/man-pages/man3/posix_spawn.3.html (or fork() + exec())

Re:Using Gooey as a Universal Front End for Any Language or ... by spullara on Sunday September 22, 2019 @11:30PM (#21045725)
Input and output types would be a good start.
Re:Using Gooey as a Universal Front End for Any Language or ... by nicolapcweek94 on Monday September 23, 2019 @04:00AM (#21046826)
Powershell kinda does this, but people are still debating if it's a good thing or not.

(personally, I think it is, and helps give structure to the sometimes too "dynamic" world that is shell scripting)

Re:Using Gooey as a Universal Front End for Any Language or ... by NullPrefix on Monday September 23, 2019 @12:08AM (#21045845)
--output=json
Re:Using Gooey as a Universal Front End for Any Language or ... by spullara on Monday September 23, 2019 @03:10AM (#21046600)
That isn't a type, but I like the direction you're going.