Tuf: Make confined_target_dirs optional field in the MIRROR_SCHEMA

Created on 29 Sep 2020  路  5Comments  路  Source: theupdateframework/tuf

Description of issue or feature request:
I was thinking about why confined_target_dirs is not an optional field in the MIRROR_SCHEMA.
https://github.com/theupdateframework/tuf/blob/fdccb8dc0bf34e2b016ce20f1570e582dcd459e7/tuf/formats.py#L408

Given that [''] matches everything and [] matches nothing this API can be confusing and lead to a mistake.
For me, it sounds more logical to not provide confined_target_dirs list at all if I want to accept queries for all targets for that mirror and provide a list of confined_target_dirs if it's otherwise.

Current behavior:
confined_target_dirs is a mandatory field in the MIRROR_SCHEMA.

Expected behavior:

confined_target_dirs to be an optional field in the MIRROR_SCHEMA.

Most helpful comment

We should just remove it. Nobody uses it AFAIK.

For backwards compatibility, we can make it optional for now, then remove it in a future major version release.

All 5 comments

We should just remove it. Nobody uses it AFAIK.

We should just remove it. Nobody uses it AFAIK.

For backwards compatibility, we can make it optional for now, then remove it in a future major version release.

I agree with @mnm678. I will make it optional for now and submit a patch.

Do you @mnm678 and @trishankatdatadog think we can change the API for confined_target_dirs key in the MIRROR_SCHEMA?
Instead of using [''] to allow all targets that we can change the documentation and check that if confined_target_dirs does exist for MIRROR_SCHEMA and if it doesn't it means that all targets are allowed.

Of course, it's good if we don't remove the checks if confined_target_dirs is [] because of possible clients using it the older way.

@MVrachev yes, sounds fine to me, thanks!

Was this page helpful?
0 / 5 - 0 ratings