Skip to content

package.json --build-from-source for all dependencies #58

Closed

Description

@kapouer

Is there a way, in a package.json, to tell all dependencies (using node-pre-gyp) to build from source ? That could happen when one doesn't want prebuilt binaries of the dependencies at all.

Activity

  1. springmeyer commented on Apr 1, 2014

    @springmeyer
    Contributor

    Can you explain your usecase a bit more? If you have an application called foo then:

    cd foo
    npm install --build-from-source
    

    Should trigger all dependences in package.json that might be packaged with node-pre-gyp (and might provide binaries) to be source compiled.

    Does that cover your need?

  2. kapouer commented on Apr 1, 2014

    @kapouer
    Author

    It's not really only about my need, which is already covered, thank you.

    The use case is simple: don't download, install, and execute binaries from an untrusted source.

    While it is possible to put a relatively high level of trust into a given version of a npm module (because code can be reviewed and module@version cannot change, provided i trust npmjs.org repository, or if i don't i can trust a git commit hash, or my own npmjs mirror), the question i ask is:

    Do you have a way to ensure the binaries downloaded by node-pre-gyp have not been tampered ?
    Put differently: how are you certain a given binary was built exactly from the source code that can be reviewed in the git repository ?

    While i respect and understand how practical a solution it is, there should be a (global) way to decide how one wants to install (the untrusted, fast, solution, or the trusted, less practical solution) by default. Something like a npm config value.

    If i package module B using sqlite3, and that's it, i can put a warning in the README explaining how to install from source.
    Now if someone wants to package module A using module B, and so on, there's a good chance users will download and execute untrusted binaries without ever knowing it.

  3. springmeyer commented on Apr 1, 2014

    @springmeyer
    Contributor

    The use case is simple: don't download, install, and execute binaries from an untrusted source.

    I like your idea of a npm config like option to make it possible for --build-from-source to be the global default. Or alternatively we could consider implementing a one-time acceptance/approval per host like how ssh works and is described at npm/npm#1891 (comment).

    Do you have a way to ensure the binaries downloaded by node-pre-gyp have not been tampered ?
    Put differently: how are you certain a given binary was built exactly from the source code that can be reviewed in the git repository ?

    This is a very important issue.

    I think the first step is to support shasum checking. This is tracked at #6. But this is not at all a complete solution of course.

    I think the next step is package signing support. This is something that npm itself appears to still be working on as seen in npm/npm#4233 and npm/npm#1891 (comment). Ideally node-pre-gyp could start helping test any future modules that would implement this in npm core.

  4. springmeyer commented on Oct 17, 2014

    @springmeyer
    Contributor

    I just closed #6 because I've not seen a strong need for it. As far as package signing, I've not seen movement on it in npm? As far as respecting an npm config "always build from source no matter way setting" this seems like an easy addition and I would accept a pull request for it. I don't see other actionable issues here, but if I'm missing anything please create a new issue to discuss.

  5. moll commented on Dec 23, 2014

    @moll

    Just stumbled upon this as well. Not too happy with getting 3rd party binaries.
    So, how exactly does one ensure node-pre-gyp never installs stuff from the "remote"? The --build-from-source above source isn't something one can put in ~/.npmrc, is it, like they can with ignore-scripts?

  6. springmeyer commented on Dec 23, 2014

    @springmeyer
    Contributor

    Adding --build-from-source is currently the only way, and I'm not aware of a way to trigger than via ~/.npmrc so what is needed is a patch to have node-pre-gyp respect some specific ~/.npmrc setting. Want to create a new issue for that?

  7. moll commented on Dec 23, 2014

    @moll

    Hey. Well, this particular issue already exists, came up on the search results and has pretty much the same goal. Why not open it?

  8. moll commented on Oct 15, 2018

    @moll

    Stumbled upon the same issue 4 years later and was surprised I've already commented here. :P Why is this issue still closed? After all, it is still the default search engine result as it perfectly describes what we, security conscious people, all want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions