ctc-oss / fapolicy-analyzer

Tools to assist with the configuration and management of fapolicyd.
https://ctc-oss.github.io/fapolicy-analyzer
GNU General Public License v3.0
12 stars 5 forks source link

Rust rules_difference function not handling edits and additions correctly #847

Closed egbicker closed 1 year ago

egbicker commented 1 year ago

The rust method rules_difference in pyo3/src/system.rs does not properly calculate differences when a line is edited and a line is added in the same deployment.

To recreate:

  1. Edit a rule (allow perm=any all : all-> allow perm=execute all : all)
  2. Add a new different rule to the end of the same file ('allow perm=any all : all`)
  3. Click Save Rules
  4. Click Deploy Changesets
  5. Observe only 1 addition present in the Deploy Changeset Dialog
jw3 commented 1 year ago

You started with

allow perm=any all : all

and ended with

allow perm=execute all : all
allow perm=any all : all

Observe only 1 addition present in the Deploy Changeset Dialog

Ok, I see that...

does not properly calculate differences when a line is edited and a line is added in the same deployment

It says you added a rule, which you did. Maybe another test case could illustrate it better.

egbicker commented 1 year ago

Yeah, I missed the forest for the trees on this one and tunneled too hard. Gonna close this one out.