Problem/Motivation

Currently the access callback key requires the procedural function in a .module file to work. We can convert to CallableResolver, however as @berdir points out: https://git.drupalcode.org/project/drupal/-/merge_requests/12795#note_56...

I'm wondering if we want to deprecate this completely.
There are no usages of this in core. The very widely used EntityField field plugin doesn't call the parent, so 90% of fields would actually not support it.
There are several handler subclasses for it, which makes much more sense than a stray callback.
I found one case of such an access callback in a views.inc file, and that's on a custom handler that could easily override the access() method instead: https://git.drupalcode.org/project/opigno_calendar/-/blob/3.x/opigno_cal...
Seems like a such a weird concept, likely a leftover of D7 hook_menu() where it passed this through to that.

Steps to reproduce

N/A

Proposed resolution

Deprecate the code path

Remaining tasks

Review

User interface changes

N/A

Introduced terminology

N/A

API changes

You can no longer pass 'access callback' in definition.

Data model changes

N/A

Release notes snippet

N/A

Issue fork drupal-3539917

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

nicxvan created an issue. See original summary.

nicxvan’s picture

Issue summary: View changes
Issue tags: +Needs subsystem maintainer review
nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Status: Active » Needs review
lendude’s picture

Yeah deprecating this makes sense. And that seems like a good spot to do it.

That said, how do we want to proceed when removing this? If this is actually used in the wild (however unlikely), when we remove this functionality, it will go from an access callback to returning TRUE. Since we are dealing with access here, this could expose something somebody wanted hidden. Again, very unlikely, but something to consider, maybe ask somebody from the security team if we would be comfortable with this.

nicxvan’s picture

We could return FALSE in that branch once it's removed and set a message.

larowlan’s picture

Issue tags: +Security

Triggering an error now, and then returning FALSE without calling the access callback in D12 seems like the safest approach.

+1

nicxvan’s picture

Status: Needs review » Needs work

Thanks! I'll add a comment with a todo and a follow up

nicxvan’s picture

Status: Needs work » Needs review

I added a todo with a link to a postponed issue for the secure deprecation removal.

I think this is RTBC, but will leave it for a bit for other's to chime in.

dcam’s picture

Status: Needs review » Needs work

I left a suggestion on the MR for attribute conversion.

I see in the IS there's a pending task to update the CR. It looks like it was written a month and a half ago. Maybe the need to update was forgotten. It still needs to be taken care of.

nicxvan changed the visibility of the branch 11.x to hidden.

nicxvan’s picture

Issue summary: View changes
Status: Needs work » Needs review

I converted the deprecation thanks for catching that!

I also rebased and did it manually to add the use statement.

I also updated the CR, it's pretty niche and straightforward. I'm on the fence on whether we want a CR at all for this anyway.

It's ready for review again.

dcam’s picture

Status: Needs review » Reviewed & tested by the community

I also rebased and did it manually to add the use statement.

Ha ha, that's good. I was just working in GitLab and obviously forgot about the use statement in the suggestion.

It all looks good to me now.

nicxvan’s picture

No worries, thanks for catching the annotations!

needs-review-queue-bot’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

oily made their first commit to this issue’s fork.

Fixed merge conflict and PHPSTAN.

nicxvan’s picture

Status: Needs work » Reviewed & tested by the community

Looks correct to me!

@oily if you are able to rebase rather than merge in these situations it makes future changes easier and cleaner.

Thanks!

oily’s picture

@nicxvan Ah got it! Thanks, will do. BTW I was going to paste the test-only output but it explodes as expected, i think.

nicxvan’s picture

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x, thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

  • catch committed d582962a on 11.x
    Issue #3539917 by nicxvan, lendude, larowlan, dcam, oily: Deprecate...

quietone’s picture

Published the CR.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.