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

Package documentation should detail trust boundary #491

Open
SeanTAllen opened this issue Jan 25, 2022 · 0 comments
Open

Package documentation should detail trust boundary #491

SeanTAllen opened this issue Jan 25, 2022 · 0 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@SeanTAllen
Copy link
Member

Currently the package documentation doesn't discuss how search path resolution is done, nor what that means for a "trust boundary".

Currently ponyc searches for package use "foo" by the following:

  • checks if "foo" is an absolute path on disk. if yes, the package at that absolute path

  • checks for "foo" against base

    "base" here is relative the compilation directory. i.e. where our actor Main is or otherwise the directory/package that we are compiling. So for example, if there is a directory "foo" in base, then we will resolve "foo" to base/foo.

  • checks the search paths for "foo"

    paths are controllable via the PONYPATH environment variable (this is how corral manages deps) or via the --path ponyc option.


It is important to understand the ramifications of search from "base".

  • Anything that you reference via a relative use like "use ../foo" is resolved via base. We do not check search paths for relative package references.
  • Anything you do via "use foo" might be resolved via base. This means from base if you have the following layout:
base/
  main.pony
  assert/
    assert.pony

You have overriden the standard library "assert" package with your own. You can replace the entire standard library this way if you wanted. Odds are folks don't want to do that, but they can.

The important thing here is that everything you put relative to your base is effectively "part of your application" or "part of your library" and it is "trusted" like your other code. Installing 3rd party code relative to base and referencing it as such makes it indistinguishable from your own code to the library. This has interesting ramifications for allowing or denying FFI usage to packages in addition to overriding parts of the standard library that a power user might want to do.

Detailing base resolution means in terms of a "trust boundary" is important and needs to be detailed along with the package resolution rules.

@SeanTAllen SeanTAllen added help wanted Extra attention is needed good first issue Good for newcomers labels Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant