hark130 / sketchy-idea

Reusable, stand-alone, Linux code
GNU General Public License v3.0
0 stars 0 forks source link

SKID-6: Enhance `set_ownership()` unit testing with capabilities(7) support #17

Open hark130 opened 4 months ago

hark130 commented 4 months ago

BACKGROUND: The skid_file_metadata_write set_ownership(), defined in code/test/check_sfmw_set_ownership.c, dynamically decide expected results based on the environment (e.g., starting ownership, whoami). This was done because there's no way of know what user will execute these tests so the test cases dynamically respond to formulate the expected result. It currently works for root and the user that owns the cloned repo.

PROBLEM: What it doesn't account for is a user with the CAP_CHOWN capability. Any user with this capability that executes the test cases will get a false negative.

SOLUTION:

  1. Add the necessary capabilities(7) functionality into devops_code
  2. Update determine_exp_return() in check_sfmw_set_ownership.c to use this functionality
  3. Add a test case (or manually test it)