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

Support adding rules for specific folders #20

Open
repi opened this issue Aug 29, 2019 · 4 comments
Open

Support adding rules for specific folders #20

repi opened this issue Aug 29, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@repi
Copy link
Contributor

repi commented Aug 29, 2019

Intro

For our larger Rust monorepo at Embark we have a base deny.toml to disallow certain crates and whitelist licenses for the entire workspace. This works well but we do also have certain more specific projects in subfolders that have additional constraints and that we want to limit more or differently so we want to add support for having specific rules, such as the ban/deny crate list that acts on a specific sub-folder but not the entire workspace.

For example: not allowing rayon crate to be used in our modules/ folder because our crates there are dynamic libraries and either do not support internal parallelism or we don't want them to spawn up their own threadpools.

Potential implementation

Right now I think we are primarily interested in just adding additional bans/deny rules for these folders. Could see a couple of different ways of defining it:

Option 1 - in the main deny.toml

Directly in the current file by specifying paths:

[bans]
multiple_versions = "deny"
deny = [
    { name = "openssl" },
    
    # do not allow rayon to be used in our modules
    { name = "rayon", path = "modules/" }
]

Option 2 - in its own subfolder deny.toml

Could add additional deny.toml files in the subfolders in question that just add the additional rules:

modules/deny.toml

[bans]
deny = [
    # do not allow rayon to be used in our modules
    { name = "rayon", path = "modules/" }
]

Do think I prefer Option 1 for the simplicity of having everything in the same place, but either would work and is related to how we want to evolve the format going forward (#17).

Would be some work to figure out a way to handle and find which dependencies are used by which crates in which folders also for this, that information, that information is not in Cargo.lock

@repi repi added the enhancement New feature or request label Aug 29, 2019
@repi
Copy link
Contributor Author

repi commented Aug 29, 2019

Thought of another use case for this, for specific folders in the workspace we may also want to allow to have a different "skip" list, e.g. do not allow duplicate crate versions for the dependencies in the crates in the folder. Less important one though but would be useful.

@TriplEight
Copy link

It would be very nice if it were possible to ban licenses for some worspace members, which can also reside in certain subfolders.

@dsully
Copy link
Contributor

dsully commented Jun 21, 2023

+1 - I need to have a centrally managed deny.toml file (outside of any repository), but also allow individual repos to override directives as needed for exceptions. It doesn't sound like there's any way to do this today?

A concrete example:

Enterprise wide deny of LGPL-3 crates, as that is considered a "restricted" license for us.

However, you can apply for an exception to use that specific crate (or package in other ecosystems) and it will be allowed. That exception should be added to the repositories that have approval (via code review/PR), and would override the Enterprise-wide deny for that specific crate.

@workingjubilee
Copy link
Contributor

Agreed. This especially affects compilers for programming languages or DSLs, because the compilers usually have runtime libraries. In my primary case, the runtime gets linked into Rust code, and the compiler gets used to build some additional code that actually controls running the Rust code. These have very different implications for most common software licenses, and that means I created some hacks involving two deny.tomls and shell scripts instead of just using a single deny.toml and GHA, even though one is essentially going to be a superset of the other.

It would be nice if, in a single workspace, I could easily define this subset/superset license relationship without having to duplicate the data.

The alternative is unnecessary amounts of grunt work. Not awful, mind! It's fairly tolerable as hacked-together-with-shell-scripts stuff goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants