Commit bf615ff
restricted_paths: add typed check primitives
Summary:
## This stack
This stack completes the second half of the restricted_paths AclManifest migration after the shadow comparison logging stack. The end result is that restricted_paths no longer relies on legacy construction flags or source-specific call paths: AclManifestMode owns source selection, config and AclManifest fetches are planned explicitly, the fetch results are shared between logging, enforcement, and metadata, and the public callers adapt to the final manifest-aware shape at the API boundary.
Visual flow: https://pxl.cl/9GjpF
Before this stack:
- Behavior was split across the old use_acl_manifest construction state, config-shaped metadata APIs, conditional_enforcement_acls, duplicated source fetches, and unimplemented AclManifest enforcement modes.
- Logging and enforcement could ask for overlapping source data independently, and Mononoke API/HG, SCS, and SLAPI still had to bridge around the incomplete manifest restriction shape.
After this stack:
- Construction and source planning are mode-driven. Disabled, Shadow, Both, and Authoritative modes choose the sources they need;
- Config and AclManifest fetches can be killed switched independently by rollout knobs;
- Shared typed fetch handles feed both comparison logging and enforcement;
- Conditional enforcement uses `enforcement_condition_sets`
- `AclManifestMode::Both` mode denies if either source denies;
- Authoritative-source errors are surfaced when the authoritative source cannot answer;
- Metadata lookup unions config and AclManifest results in Both mode.
This makes the codebase better because
- Source (config vs acl_manifest) choice is centralized,
- Fetch work is not duplicated
- Rollout controls are easier to reason about
- Restriction check results are typed instead of copied into loosely shaped structs, and API-specific adaptation happens at the edge instead of leaking through the restricted_paths internals.
- **The stack also stays reviewable by putting no-op setup and tests before behavior changes**
Remaining follow-ups after this stack are
- Schematized Scuba source/error parity
- The Eden API vector response shape tracked by TODO(T248658346)
- Reviewing the both-sources-disabled fail-open behavior also tracked by TODO(T248658346)
- Deleting rollout-only fallback paths after AclManifest enforcement is proven.
## This diff (new functionality)
Adds typed restriction-check primitives in `restricted_paths` so callers can get restriction info paired with an authorization decision without re-parsing ACLs or running raw permission checks themselves. The new path and manifest check result types compose the existing restriction-info structs with an internal authorization result and expose only the final authorization decision publicly. The legacy result move and authorization getter refactor are handled by the two no-op parent diffs.
Reviewed By: lmvasquezg
Differential Revision: D103696888
fbshipit-source-id: 5b50bcd1d7923ea03c272bd50af43bb0885f24321 parent 2d3fdef commit bf615ff
4 files changed
Lines changed: 330 additions & 34 deletions
File tree
- eden/mononoke/repo_attributes/restricted_paths/src
- restriction_info
Lines changed: 51 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
164 | | - | |
165 | | - | |
166 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
167 | 169 | | |
168 | 170 | | |
169 | 171 | | |
170 | 172 | | |
171 | 173 | | |
172 | | - | |
| 174 | + | |
173 | 175 | | |
174 | 176 | | |
175 | 177 | | |
| |||
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
186 | 227 | | |
187 | 228 | | |
188 | 229 | | |
| |||
647 | 688 | | |
648 | 689 | | |
649 | 690 | | |
650 | | - | |
| 691 | + | |
651 | 692 | | |
652 | 693 | | |
653 | 694 | | |
| |||
715 | 756 | | |
716 | 757 | | |
717 | 758 | | |
718 | | - | |
| 759 | + | |
719 | 760 | | |
720 | 761 | | |
721 | 762 | | |
| |||
724 | 765 | | |
725 | 766 | | |
726 | 767 | | |
727 | | - | |
| 768 | + | |
728 | 769 | | |
729 | 770 | | |
730 | 771 | | |
| |||
733 | 774 | | |
734 | 775 | | |
735 | 776 | | |
736 | | - | |
| 777 | + | |
737 | 778 | | |
738 | 779 | | |
739 | 780 | | |
| |||
742 | 783 | | |
743 | 784 | | |
744 | 785 | | |
745 | | - | |
| 786 | + | |
746 | 787 | | |
747 | 788 | | |
748 | 789 | | |
| |||
751 | 792 | | |
752 | 793 | | |
753 | 794 | | |
754 | | - | |
| 795 | + | |
755 | 796 | | |
756 | 797 | | |
757 | 798 | | |
| |||
0 commit comments