ngclient updater: API functions argument validation
See original GitHub issueDescription of issue or feature request:
In the tuf/ngclient/updater.py
module we are providing a couple API functions with arguments: Updater.__init__
, get_one_valid_targetinfo
, updated_targets
and download_targets
.
It seems to me it’s a good idea to decide which arguments in those functions require validation and if there should be any what it should be.
Current behavior: No validation is done for:
repository_dir
inUpdater.__init__()
target_path
inUpdater.get_targetinfo()
- maybe
targetinfo
inUpdater.download_target()
- maybe
target_base_url
inUpdater.download_target()
Expected behavior: Decide if we want to add validation and if there is any what it should be:
-
repository_dir
inUpdater.__init__()
-
target_path
inUpdater.get_targetinfo()
-
targetinfo
inUpdater.download_target()
-
target_base_url
inUpdater.download_target()
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Argument Validation Functions - MATLAB & Simulink
MATLAB defines functions for use in argument validation. These functions support common use patterns for validation and provide descriptive error messages.
Read more >Add argument validation to your GraphQL Nexus API. - GitHub
The validate method can be added to any field with args : const UserMutation = extendType({ type: 'Mutation', definition(t) { t. field('createUser', {...
Read more >Application - Servoy 2020 Documentation
The arguments that are given to the function when called. Supported Clients. SmartClient,WebClient,NGClient. Sample.
Read more >Extension API: Argument Validation - JerryScript
This enables complex validation like handling different JS function signatures, mapping multiple input arguments to a C struct, etc.
Read more >python - Best way to check function arguments? - Stack Overflow
A History of API Violence. Python 3.5 provides no actual support for using PEP 484 types. wat? It's true: no type checking, no...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
WRT validating TargetFile arguments, I guess the potential check would be “is this really a TargetFile instance?” but considering that A) we support static type checking (well almost anyway: #1633) and B) there is never any need to modify the targetfile in application code C) it will fail pretty gracefully anyway, I don’t think that check is needed…
I think this currently ends up complaining that repository_dir/root.json does not exist – which seems like an accurate description of the problem: the updater isn’t interested in just the directory, it needs a directory with a root.json.
So potentially we don’t need to do anything here: I’m fine with that
Yep, I think we agree here, let’s close