News for hackers. Stuff that matters.
Re:Curl doesn't add libproxy due to its quality issues by ushakov on Sunday October 23, 2022 @08:45AM (#33306521)
He’s concerned about adding 1 dependency, while you add thousands to your node_modules without the slightest doubt

What a class act

Re:Curl doesn't add libproxy due to its quality issues by eCa on Sunday October 23, 2022 @08:52AM (#33306572)
To be fair, most other projects aren’t as far up-river as curl. Any project they depend on becomes at least as important as curl itself.
Re:Curl doesn't add libproxy due to its quality issues by blowski on Sunday October 23, 2022 @09:27AM (#33306820)
Exactly, everything’s a trade-off. And the trade-offs will be different for a very widely used system package like curl compared to, say, a small in-house ERP system or low-traffic website.
Re:Curl doesn't add libproxy due to its quality issues by manfre on Sunday October 23, 2022 @09:05AM (#33306672)
I appreciate when app maintainers set a standard for their dependencies. I wish it wasn't so rare.

Node needs a static dependency checker to prevent using anything that has isodd or similar useless modules in its dependency graph.

Re:Curl doesn't add libproxy due to its quality issues by manuelabeledo on Sunday October 23, 2022 @08:48AM (#33306548)
To be fair, is there any other way around while working with node?

Everything in the ecosystem is a dependency.

Re:Curl doesn't add libproxy due to its quality issues by nickjj on Sunday October 23, 2022 @09:41AM (#33306924)
It depends on what you're doing.

I wrote https://www.npmjs.com/package/esbuild-copy-static-files only using the Node standard library.

It was funny writing the readme file though where "No 3rd party dependencies" ended up being called out as a feature.

Re:Curl doesn't add libproxy due to its quality issues by johnny22 on Sunday October 23, 2022 @05:44PM (#33310581)
i see "no third party dependencies" often as a feature with C++ libs, and I doubt that's the only place.
Re:Curl doesn't add libproxy due to its quality issues by lightswitch05 on Sunday October 23, 2022 @08:57AM (#33306605)
I’ve written a library with zero production dependencies. Of course I have Jest as a development dependency which pulls in all sorts of stuff. It would be difficult to make a zero-dependency library. As for not having production libraries, this was my experience:

1. Using the https module directly was more work than I expected, especially with error handling. This made me really look forward to the new Fetch API coming out.

2. No CLI parser. Its not like parsing args is a LOT of work - but its also something that is already solved and having to write support for that directly was a bummer

3. No logging library. This one was pretty easy. Create a little class with logging levels. Again this is something that is very common that would have been nice to use a package for.

Re:Curl doesn't add libproxy due to its quality issues by laundermaf on Sunday October 23, 2022 @09:07AM (#33306690)
What you describe is exactly why people use dependencies. You just decided to trade your time for the noble act of having “no production dependencies”, while one of the 275 modules installed by Jest (real number) stole your production secrets anyway.

As for point 2, Node 18.1 I think just introduced a native argument parser.

Re:Curl doesn't add libproxy due to its quality issues by 2fast4you on Sunday October 23, 2022 @09:25AM (#33306809)
Why would the test dependencies have access to production secrets? They only get installed while developing
Re:Curl doesn't add libproxy due to its quality issues by hombre_fatal on Sunday October 23, 2022 @10:12AM (#33307165)
They still get run on a developer’s machine most of the time and are at least installed there where they can run arbitrary code on install. And there are juicy secrets beyond just production server secrets sitting on your laptop.
Re:Curl doesn't add libproxy due to its quality issues by adobrawy on Sunday October 23, 2022 @09:25AM (#33306813)
You don't need Jest. You can use buld-in test runner since Node 19.0 (https://nodejs.org/api/test.html)

1/ You do not need to use https / https module directly. You can use Fetch API since Node 17.5 ( https://nodejs.org/api/globals.html#fetch ).

2/ You do not need an external CLI parser. You can use build-in CLI parser since Node v18.3 ( https://nodejs.org/api/util.html#utilparseargsconfig )

Re:Curl doesn't add libproxy due to its quality issues by folkrav on Sunday October 23, 2022 @10:22AM (#33307237)
> You don't need Jest. You can use buld-in test runner since Node 19.0 (https://nodejs.org/api/test.html)

v19 was released 5 days ago. Barely had time to register this was a thing, let alone migrating our 3500+ unit test+ 300 integration test suite lol

> 1/ You do not need to use https / https module directly. You can use Fetch API since Node 17.5 ( https://nodejs.org/api/globals.html#fetch ). > 2/ You do not need an external CLI parser. You can use build-in CLI parser since Node v18.3 ( https://nodejs.org/api/util.html#utilparseargsconfig )

Lots of production environments tend to sit on latest LTS. v18 _just_ hit LTS, up to last month it was v16. Those weren't really an option for all these projects until then.

Re:Curl doesn't add libproxy due to its quality issues by lightswitch05 on Sunday October 23, 2022 @10:33AM (#33307321)
Yes, my library absolutely has to support the LTS version of Node, and I run the tests against all supported versions to ensure compatibility. So, one day I can use the nice things people are mentioning, but it will be years from now.
Re:Curl doesn't add libproxy due to its quality issues by jcpst on Sunday October 23, 2022 @09:43AM (#33306951)
I tried making a tiny test runner that printed nicely to the console. It’s very basic, but I was surprised at how little code it took: https://github.com/jcpst/neon-johnston/blob/master/test/inde...
Re:Curl doesn't add libproxy due to its quality issues by simplotek on Sunday October 23, 2022 @09:46AM (#33306972)
> I've written a library with zero production dependencies. Of course I have Jest as a development dependency which pulls in all sorts of stuff. It would be difficult to make a zero-dependency library.

That really depends on what your expectations and goals are. You mention Jest but as it's a test dependency then security is not a major concern, and thus it's ok to just vend the source code into your project trees.

Re:Curl doesn't add libproxy due to its quality issues by bombolo on Sunday October 23, 2022 @12:05PM (#33307961)
> No logging library. This one was pretty easy. Create a little class with logging levels.

Do you print to /dev/stdlog using the correct syslog format or use journald and its format?

Because if it's not one of those, the "levels" are useless.

Re:Curl doesn't add libproxy due to its quality issues by bornfreddy on Sunday October 23, 2022 @01:08PM (#33308459)
No, the levels are not useless, far from it. Even if you just print to stdout, prefixing each line with a (maybe colored?) level info is very useful. Also, if later you decide to use xyz format, it is trivial to implement this. Changing all logging calls? Not so much.
Re:Curl doesn't add libproxy due to its quality issues by bombolo on Sunday October 23, 2022 @05:32PM (#33310479)
Just use a real logging daemon and it will be the colours by itself.

It will also let you query for which level you want.

> Changing all logging calls? Not so much.

Uh? Make a good library using the same interface.

Re:Curl doesn't add libproxy due to its quality issues by lightswitch05 on Monday October 24, 2022 @12:26AM (#33312930)
To answer your question, the levels are important for both regular usage and debugging when something goes wrong. I create a number of debug/info/warning/error log messages throughout the tool and allow the desired level of logging to be set as a CLI argument - or even run in silent mode if desired.
Re:Curl doesn't add libproxy due to its quality issues by rockwotj on Sunday October 23, 2022 @08:52AM (#33306571)
For the most part, it's also really easy to add node dependencies compared to C/C++. Is it surprising folks take the past of least resistance?
Re:Curl doesn't add libproxy due to its quality issues by ushakov on Sunday October 23, 2022 @08:50AM (#33306562)
> To be fair, is there any other way around while working with node?

breaking robot noises

Re:Curl doesn't add libproxy due to its quality issues by pixl97 on Sunday October 23, 2022 @02:27PM (#33309033)
In reverse I've seen a banking apps pull in a gigabyte of node dependencies and am thinking there's no possible way they'll ever be able to validate the security of everything.
Re:Curl doesn't add libproxy due to its quality issues by fweimer on Sunday October 23, 2022 @09:42AM (#33306939)
For a generally usable implementation, libproxy needs to be able to process proxy auto-config (PAC) files, which are small (or not so small) Javascript programs. These programs are expected the parse the URL and decide which proxy server to use (or a direct connection). It's not declarative at all.

Therefore, libproxy is not a trivial dependency.

Re:Curl doesn't add libproxy due to its quality issues by vokspon on Sunday October 23, 2022 @12:00PM (#33307924)
True but curl wouldn't need to implement a particularly optimised JavaScript runtime to handle PAC programs, there would be no point in e.g. bundling V8 or ChakraCore with it.
Re:Curl doesn't add libproxy due to its quality issues by mmis1000 on Sunday October 23, 2022 @03:39PM (#33309597)
I think quickjs is invented for exact this type of usage. A properly implemented, speed-irrelevant, small runtime for embedded usage.

Most pac files are just a few lines and you don't really need a speedy runtime to run it.

Re:Curl doesn't add libproxy due to its quality issues by wkdneidbwf on Sunday October 23, 2022 @10:10AM (#33307152)
this is an inane comparison.
Re:Curl doesn't add libproxy due to its quality issues by ldoughty on Sunday October 23, 2022 @10:30AM (#33307303)
Well, yes....

In my general experience, "System Admins" have a security-first mindset along with years of focusing on how to maintain a secure system AND blessing from management to be slower for end-product reliability and security of business assets/data.

Developers, *who can certainly have this mindset and skill set as well*, are typically forced to be more business-oriented with management-dictated objectives/deadlines that more strictly limits their ability to invest the time, so you get "the best I can do in the allotted sprint/deadline time minus the other committed work I need to do".

So inevitably the application will let something through, and it becomes to System Admins' responsibility to protect the company... And that seems to be okay with most businesses.... Developers can move quick fast and dirty, and the operations/admins will try to limit the scope of the blast.

It adds several hours or days of work for a developer to add secret storing/retrieval/rotation compared to just hard-coding a key in the environment, so if they have 2 days to implement a feature, they are not going to spend 2 days implementing extra safeguards unless someone speaks up and pushes back (and the other side relents)

Re:Curl doesn't add libproxy due to its quality issues by pjmlp on Sunday October 23, 2022 @02:21PM (#33308999)
Which is why DevOps, sorry system admins, then have automated tooling for detecting those kind of workarounds, and then we get a sad developer that has to fix a broken pipeline deployment.

In case of places that take security seriously that is.

Re:Curl doesn't add libproxy due to its quality issues by shp0ngle on Sunday October 23, 2022 @10:57AM (#33307476)
Well, my application has no tests, badly designed API and no documentation too. So its fiiine
Re:Curl doesn't add libproxy due to its quality issues by pjmlp on Sunday October 23, 2022 @02:19PM (#33308986)
On most of the projects I am involved with, if the modules haven't been cleared for use, the CI/CD pipeline will fail, regardless of working on dev's machine.

If only all projects were as conscious.

Re:Curl doesn't add libproxy due to its quality issues by password4321 on Sunday October 23, 2022 @08:45AM (#33306522)
What libraries does curl use?
Re:Curl doesn't add libproxy due to its quality issues by tyingq on Sunday October 23, 2022 @08:47AM (#33306539)
There's a list here: https://curl.se/docs/libs.html

Edit: Summary:

  SSL/TLS: OpenSSL, mbed, GnuTLS, NSS TLS, wolfSSL
  decompression: zlib
  ldap: OpenLDAP LDAP support
  kerberos/spnego: heimdal, MIT Kerberos
  http2: nghttp2
  async dns: c-ares
  idn domains: libidn
  scp/sftp: libssh2
Re:Curl doesn't add libproxy due to its quality issues by Macha on Sunday October 23, 2022 @09:01AM (#33306644)
Note this isn't complete, it lists only 5 out of the 14 TLS libraries that cURL can be built for: https://daniel.haxx.se/blog/wp-content/uploads/2021/02/Scree... (source: https://daniel.haxx.se/blog/2021/02/09/curl-supports-rustls/ )

Of course, it does include the two that cover 95+% of uses in OpenSSL and GnuTLS.

Re:Curl doesn't add libproxy due to its quality issues by ape4 on Sunday October 23, 2022 @08:53AM (#33306576)
At least libproxy itself doesn't have any dependencies

https://libproxy.github.io/libproxy/ says "no external dependencies within libproxy core (libproxy plugins may have dependencies)"

Re:Curl doesn't add libproxy due to its quality issues by markphip on Sunday October 23, 2022 @08:59AM (#33306621)
Interesting choice to have a set of FAQ in your docs without also providing answers to them. I suppose the term FAQ does sort of imply it is just the "questions".
Re:Curl doesn't add libproxy due to its quality issues by ape4 on Sunday October 23, 2022 @10:09AM (#33307139)
haha, good point
Re:Curl doesn't add libproxy due to its quality issues by Beltalowda on Sunday October 23, 2022 @10:24AM (#33307262)
The core doesn't have any dependencies, but it can support a bunch of different modules. Most notably is JavaScript to execute PAC files (WebKit, mozjs, etc.)

For macOS it calls "JSEvaluateScript(this->jsctx, str, NULL, NULL, 1, NULL)".

Obviously this kind of stuff is useful for some people, but yeah ... I'd be hesitant too; not because whether libproxy might be good or bad, but rather the nature of what it does (execute code).

Re:Curl doesn't add libproxy due to its quality issues by mistrial9 on Sunday October 23, 2022 @10:52AM (#33307453)
open-source curl, or corporate curl?

Apple and MSFT build their own replacements for TLS and use those, others? part of a trend to replace and extend GPL software, and control critical network functions on their platforms ?

but then, others seem to want to make TLS, too ?

    [ Windows native SSL/TLS, schannel ]
    [ Apple OS native SSL/TLS, secure-transport ]
    [ GNU TLS ]
    [ mbedtls, wolfssl, mesalink, bearssl, rust-tls, nss]
Re:Curl doesn't add libproxy due to its quality issues by fulafel on Sunday October 23, 2022 @08:59AM (#33306620)
I would be very miffed if my application suddenly autodetected a proxy (whether it-dept or adversary installed) and decided to break the end-to-end security property of TLS that my app relied on. But maybe in the best case this would have been limited to tunneling (HTTP CONNECT) proxies that pass TLS traffic as-is?

But I guess this is just speculation now that it wasn't implemented.

Re:Curl doesn't add libproxy due to its quality issues by tyingq on Sunday October 23, 2022 @09:07AM (#33306689)
I would guess curl would add a --autoproxy switch or similar.
Re:Curl doesn't add libproxy due to its quality issues by stjohnswarts on Sunday October 23, 2022 @09:40AM (#33306922)
Yeah I think the curl programmers are far too knowledgable to have proxy discovery set as a default.
Re:Curl doesn't add libproxy due to its quality issues by benmmurphy on Sunday October 23, 2022 @11:10AM (#33307591)
I don’t think curl supports proxies that terminate TLS so it shouldn’t interfere with TLS end to end security.
Re:Curl doesn't add libproxy due to its quality issues by rwmj on Sunday October 23, 2022 @10:11AM (#33307156)
Sort of related to this (it wouldn't solve this issue, but I think it would improve overall ecosystem security & quality):

I do wish curl would split the curl backend protocols (http, ftp etc) into separate loadable modules so that we (downstream distro packagers) can reduce the total attack surface through packaging changes.

For example, we could have:

  /usr/lib/libcurl/curl-http.so
  /usr/lib/libcurl/curl-ftp.so
packaged separately as "libcurl-http" and "libcurl-ftp". Curl clients which only want HTTP would be set to depend on "libcurl-http" only, so the FTP support wouldn't even be on the system unless a package needs it.

There is a way to whitelist protocols already in curl (CURLOPT_PROTOCOLS(3)), but that requires modifying existing programs, and I think this could be used in addition.

There are lots of weird modules in curl (telnet, gopher, pop3 -- which don't get me wrong I think is great!) but they should not be a part of the default install of most Linux distros.

Re:Curl doesn't add libproxy due to its quality issues by jackblemming on Sunday October 23, 2022 @12:59PM (#33308389)
Do you have any evidence that this would provide security improvements besides the heuristic of reducing surface area? Have there been past exploits?
Re:Curl doesn't add libproxy due to its quality issues by rwmj on Sunday October 23, 2022 @01:31PM (#33308617)
CVE-2013-0249 (in the qemu curl driver) was an exploit where the entire qemu process could be exploited because of a bug in curl's SASL driver, which could be invoked remotely by redirecting an http[s]:// URL initiated by qemu. This was fixed by changing qemu to use CURLOPT_PROTOCOLS(3) (as I detailed in my initial posting above) so that curl wouldn't try to make SASL connections starting from an initial HTTP request.

IMHO it would be a lot better instead of having to change every possible curl client, to have some kind of distro-level limit on what code might be run by curl.

Of course I would still say if you're using curl, you really must use CURLOPT_PROTOCOLS or have a good excuse why not. The above change is just a backstop.

Re:Curl doesn't add libproxy due to its quality issues by dwwoelfel on Sunday October 23, 2022 @01:41PM (#33308702)
You can build curl without support for ftp.
Re:Curl doesn't add libproxy due to its quality issues by rwmj on Sunday October 23, 2022 @03:05PM (#33309324)
Yes you're quite right that you can do this when building curl:

  ./configure --disable-ftp
But then you end up with a libcurl that can never support FTP clients. However FTP is still a useful protocol in some circumstances, perhaps very limited these days, but still used. I think that it's better to expose this through a module system reflected into the distribution packages. It makes things much more visible.
Re:Curl doesn't add libproxy due to its quality issues by lucideer on Sunday October 23, 2022 @03:31PM (#33309539)
> It makes things much more visible.

In what way? Recompiling a few different binaries for various levels of usage (with/without whichever protocols needed) doesn't seem like an arduous task, especially for a distro. And the docs on how to do it from the curl project are very clear and "visible". I'm not sure how any module system would improve on this.

In fact, it seems like it would disimprove purely by virtue of not being idiomatic - compile flags are a familiar and straightforward, well-known approach.

Re:Curl doesn't add libproxy due to its quality issues by mro_name on Sunday October 23, 2022 @03:49PM (#33309676)
> compile flags

they don't play nicely with os package managers like apt.

Re:Curl doesn't add libproxy due to its quality issues by duped on Sunday October 23, 2022 @08:51PM (#33311819)
Which is another reason why dependencies shouldn't be shared
Re:Curl doesn't add libproxy due to its quality issues by rwmj on Monday October 24, 2022 @05:21AM (#33314454)
Your solution is multiple copies of libcurl all over the place, all compiled in different ways, probably different versions, and that's supposed to be more secure and maintainable?
Re:Curl doesn't add libproxy due to its quality issues by duped on Monday October 24, 2022 @12:12PM (#33318600)
More secure: not more, but equally. More maintainable: infinitely. This is how software is being built today in secure environments anyway, since you need to own the supply chain.

Dependencies are not actually shared that often. Here's a good post about it: https://drewdevault.com/dynlib

Re:Curl doesn't add libproxy due to its quality issues by gary_0 on Sunday October 23, 2022 @02:50PM (#33309195)
Would there still be a batteries-included curl package that some software/packages could depend on, if they don't want to worry about which protocol is supported? I'd hate for users throwing an FTP/whatever link at a tool that used to "just work" suddenly getting a "protocol not found" error.
Re:Curl doesn't add libproxy due to its quality issues by rwmj on Sunday October 23, 2022 @03:03PM (#33309303)
I imagine yes you'd want a backwards compatible package that pulls in everything. Packages that require that might(?) be a red flag.

Again it's about hardening the default, not making it secure in every imaginable configuration.

Re:Curl doesn't add libproxy due to its quality issues by jonhohle on Sunday October 23, 2022 @03:53PM (#33309710)
It would have the added advantage of only needing load modules required for that particular command in action as well. If a module were vulnerable, it couldn’t be used as a jump point for some gadget in another module.