In addition to possible sandbox-immutable options ,we need immutability depending on other things too. I'm hoping that those can wait a little till we have more of the refactoring done, and we can define the right interface for them.
Right now I'm torn between a few not-so-good designs:
Have filenames be sandbox-immutable, and nothing else?
Have a new flag for every kind of immutability we need?
Have a list of options for every kind of immutability we need?
Do you have any thoughts on the right design here?
Flags work well if we have a small number of simple kinds of immutability. But they still centralise some code.
We could let modules define an immutability function that gets run on every option?
For example, a sandbox_config module would define an immutability function that prevents filenames, IP addresses, and other options changing.
And if we have relay or dirauth immutability, then those modules could define those functions.
So to summarize the situation: I think that all files need to be sandbox-immutable.
I think that we'll come up with the right solution there when we do a refactoring for the sandbox code; this could be well handled with something based on #32339 (moved), which already looks at nearly all of the files, and which needs to start looking at all of the rest too. Currently my best guess is that constraints like this would want support for scanning all filename options, along with some way for reaching inside Log and so on.
If it's all right with you, could we take some version of this branch without covering other mutability invariants? I'd like to keep the scope small-ish here, to avoid delaying the key refactoring of #30866 (moved).
(Rationale for proceeding: I believe that this branch is a strict improvement over Tor's current behavior, doesn't introduce technical debt, and unblocks #30866 (moved). If you don't agree, we shouldn't proceed.)