[tor-bugs] #31241 [Core Tor/Tor]: Refactor config validation
Tor Bug Tracker & Wiki
blackhole at torproject.org
Mon Aug 26 23:44:28 UTC 2019
#31241: Refactor config validation
-----------------------------------------+---------------------------------
Reporter: nickm | Owner: nickm
Type: task | Status: needs_review
Priority: Medium | Milestone: Tor:
| 0.4.2.x-final
Component: Core Tor/Tor | Version:
Severity: Normal | Resolution:
Keywords: network-team-roadmap-august | Actual Points:
Parent ID: #29211 | Points: 1.5
Reviewer: | Sponsor: Sponsor31-can
-----------------------------------------+---------------------------------
Comment (by nickm):
Summary of design.
Previously, there were "validate" functions for config objects, most
notably options_validate(). There was no generic way to call the
"validate" function for a given config object -- you would just call it
directly.
These functions had a horrible signature, since they were allowed to
modify the configuration object, compare it to an old object, learn
whether it came from setconf (!), and compare it to its defaults (!).
So the old process was:
* Call options_verify.
* Call options_transition_allowed.
Now the configuration verification process follows a more strict multi-
stage process:
* Call config_validate()
* For each config_format_t, call config_validate_single():
* Callback to modifications to the configuration object (early,
pre-validation)
* Callback to validation function (only sees current object, may
not change it).
* legacy validation callback (whatever we have not moved out of
options_validate)
* callback to check transition (can see current and previous
object, may not change them)
* modifications to the configuration object (final, late-
validation)
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/31241#comment:4>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list