Skip to content

[misc] Fix robustness issues in the DeleteServlet - #2451

Open
sdumitriu wants to merge 1 commit into
devfrom
misc-delete-servlet-fixes
Open

[misc] Fix robustness issues in the DeleteServlet#2451
sdumitriu wants to merge 1 commit into
devfrom
misc-delete-servlet-fixes

Conversation

@sdumitriu

Copy link
Copy Markdown
Member
  • Reference cycles, e.g. two resources holding mutual RECURSIVE_DELETE links to each other, made the referrer traversal recurse until the stack overflowed; each node's referrers are now only chased once per phase
  • Deleting a link's own definition consulted that definition's onDelete policy, although the policy describes what to do when the link's target is deleted; a RECURSIVE_DELETE definition would take every linking resource down with it. A link cannot outlive its definition, so the link itself is now removed without consulting the policy
  • A hard link with the (illegal) IGNORE policy, or an unrecognized policy value, passed the conflict check untouched and then blew up at commit time with a ReferentialIntegrityException reported as a generic 500; such links are now removed, with a warning for the illegal policy
  • A link with an unresolvable definition crashed the whole request; the policy now falls back to only removing the link, with a warning
  • One node failing to describe itself made the whole 409 explanation collapse into 'referenced by unknown item(s)'; failures are now counted among the 'other' items instead of discarding the rest of the list
  • After sending the 409 explanation, control still fell through to the removal loop and session.save(), which would persist any unrelated pending changes; refusals now skip the removal phase entirely
  • A versionable ancestor checked out for the removal of one node could be removed by the same operation as a referrer, making the final checkin crash on the missing path; checkins are now path-based and skip deleted nodes
  • A request for a non-JCR resource crashed with a NullPointerException instead of answering 404
  • Also removed the resolver ThreadLocal and the mid-analysis save it existed for, which saved an empty transient state

- Reference cycles, e.g. two resources holding mutual RECURSIVE_DELETE
  links to each other, made the referrer traversal recurse until the stack
  overflowed; each node's referrers are now only chased once per phase
- Deleting a link's own definition consulted that definition's onDelete
  policy, although the policy describes what to do when the link's target
  is deleted; a RECURSIVE_DELETE definition would take every linking
  resource down with it. A link cannot outlive its definition, so the link
  itself is now removed without consulting the policy
- A hard link with the (illegal) IGNORE policy, or an unrecognized policy
  value, passed the conflict check untouched and then blew up at commit
  time with a ReferentialIntegrityException reported as a generic 500;
  such links are now removed, with a warning for the illegal policy
- A link with an unresolvable definition crashed the whole request; the
  policy now falls back to only removing the link, with a warning
- One node failing to describe itself made the whole 409 explanation
  collapse into 'referenced by unknown item(s)'; failures are now counted
  among the 'other' items instead of discarding the rest of the list
- After sending the 409 explanation, control still fell through to the
  removal loop and session.save(), which would persist any unrelated
  pending changes; refusals now skip the removal phase entirely
- A versionable ancestor checked out for the removal of one node could be
  removed by the same operation as a referrer, making the final checkin
  crash on the missing path; checkins are now path-based and skip deleted
  nodes
- A request for a non-JCR resource crashed with a NullPointerException
  instead of answering 404
- Also removed the resolver ThreadLocal and the mid-analysis save it
  existed for, which saved an empty transient state
@sdumitriu
sdumitriu force-pushed the misc-delete-servlet-fixes branch from 83a13b9 to 4b2df24 Compare August 15, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant