HomePhabricator

Prevent Files from requiring infinite policy checks

Description

Prevent Files from requiring infinite policy checks

Summary:
Fixes T6726. Currently, a file may be attached to itself (or to other files, ultimately forming a loop). In this case, we currently run around the loop forever trying to load all the files.

Instead, decline to load objects if we're inside a query which is already loading them. This produces the right policy result and completes in finite time.

Test Plan:

  • Looped two files by writing {F123} and {F124} on the other files, respectively.
  • Loaded F123.
  • Saw long hang; used debug.time-limit to see huge stack trace instead.
  • Wrote patch.
  • F123 now loads correctly.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6726

Differential Revision: https://secure.phabricator.com/D12756