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

First set of API improvements #14

Merged
merged 4 commits into from
Aug 9, 2022

Conversation

l0kod
Copy link
Member

@l0kod l0kod commented Aug 8, 2022

These commits help write tests and don't impact the compatibility features (see #12).

It would be better to set the handled accesses with
Ruleset::new(accesses) to avoid a runtime error, but it doesn't fit with
the Compatible::set_best_effort() usage.

Signed-off-by: Mickaël Salaün <mic@digikod.net>
Require user to explicitely set the allowed accesses instead of using
default ones.

Because PathBeneath::allow_access() doesn't return error (but
RulesetCreated::add_rule() does), it is not useful to have a dedicated
setter nor a dedicated error like MissingHandledAccess.

Signed-off-by: Mickaël Salaün <mic@digikod.net>
Simplifies tests with explicit ruleset creation from static ABI versions.

Never use Ruleset::new() for tests to avoid inconsistent behaviors,
except in lib.rs because of real-life tests.

Signed-off-by: Mickaël Salaün <mic@digikod.net>
Making consecutive calls to Ruleset::handle_access() accumulate accesses
instead of replacing should avoid pitfalls, and may be convenient to
gradually build a ruleset with different levels of compatibility (see
Ruleset::set_compatibility).

Signed-off-by: Mickaël Salaün <mic@digikod.net>
@l0kod l0kod merged commit 0120ab3 into landlock-lsm:main Aug 9, 2022
@l0kod l0kod deleted the api-improvements-simple branch August 9, 2022 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant