JSON:API Permission Access provides an additional permission on JSON:API based routes. Without this permission, users (other than administrators) will be unable to retrieve data from these endpoints. This can be useful when pairing with Consumers and Simple OAuth as you need to attach scope(s) to specific role(s), which can have very specific permissions...like this one 🙂

When you enable JSON:API there is no straightforward way to provide access controls on various routes. This can potentially lead to exposing some data that you do not want to expose, i.e. /jsonapi/user/user.

From the JSON:API module security considerations documentation, we can see that:

- Entity Access is respected.
- Field Access is respected.
- When modifying data, validation constraints are respected.
- The internal flag is respected (see documentation about how it can be set on an entity type definition, field definition or property definition).

Adjusting the permissions on entities/fields for specific roles can be cumbersome so this aims to provide a simple layer on top of all that for easy control.

Similar projects

Drupal REST & JSON API Authentication: This module provides Basic authentication (based on Drupal users) out of the box as well as API Key authentication, but places more advanced features such as OAuth behind a paywall. With JSON:API Permission Access + Simple Oauth + Consumers this can be accomplished at no cost.

Jsonapi Role Access: This module does a very similar implementation except it introduces added complexity with separate configuration when this can be achieved through the standard permission handling methods.

Project link

https://www.drupal.org/project/jsonapi_permission_access

Comments

dan612 created an issue. See original summary.

vishal.kadam’s picture

vishal.kadam’s picture

avpaderno’s picture

Thank you for applying!

Before giving links helpful to understand how the review process works, what to expect from a review, and what to do to avoid a review takes more time than needed, I would like to thank all the reviewers for the work they do.
These applications are volunters-driven, which also means it is not possible to predict when an application will be marked fixed and the applicant will get the permission to opt projects into security advisory policy. While we aim to make an application as quick as possible, it is also important for us that more people review the project used for an application. In this way, we make sure applications do not miss some important points that should be instead reported.
Applications are not meant to be complete debugging sessions that eliminate every existing bug, though. I apologize if sometimes applications seem to go into too-detailed reviews.

Please read Review process for security advisory coverage: What to expect for more details and Security advisory coverage application checklist to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.

The important notes are the following.

  • If you have not done it yet, you should enable GitLab CI for the project and fix the PHP_CodeSniffer errors/warnings it reports.
  • For the time this application is open, only your commits are allowed.
  • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status will not be changed by this application; once this application is closed, you will be able to change the project status from Not covered to Opt into security advisory coverage. This is possible only 14 days after the project is created.

    Keep in mind that once the project is opted into security advisory coverage, only Security Team members may change coverage.
  • Only the person who created the application will get the permission to opt projects into security advisory coverage. No other person will get the same permission from the same application; that applies also to co-maintainers/maintainers of the project used for the application.
  • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

To the reviewers

Please read How to review security advisory coverage applications, Application workflow, What to cover in an application review, and Tools to use for reviews.

The important notes are the following.

  • It is preferable to wait for a project moderator before posting the first comment on newly created applications. Project moderators will do some preliminary checks that are necessary before any change on the project files is suggested.
  • Reviewers should show the output of a CLI tool only once per application.
  • It may be best to have the applicant fix things before further review.

For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues.

vishal.kadam’s picture

Status: Needs review » Needs work

1. FILE: README.md

The README file is missing the required sections - Project introduction, Requirements and Configuration.

2. FILE: jsonapi_permission_access.info.yml

core_version_requirement: ^9 || ^10 || ^11

A new project should not declare itself compatible with a Drupal release that is no longer supported. No site should be using Drupal 8 nor Drupal 9, and people should not be encouraged to use those Drupal releases.

cmlara’s picture

A new project should not declare itself compatible with

The last stable release was April 2024, this absolutely is not a new project @vishal.kadam.

I’m aware of no accepted community standard that prohibits retaining backwards compatibility, especially in light of the fact Core released a security patch yesterday for Druapl 8.9.

avpaderno’s picture

especially in light of the fact Core released a security patch yesterday for Drupal 8.9

That is an exceptional case, and it does not change the fact we do not review projects that are compatible with unsupported Drupal releases, which includes also Drupal 8.x. Otherwise, we would still review projects for Drupal 6.x or Drupal 7.x.

The last stable release was April 2024, this absolutely is not a new project

It is not a new project, but what reported in that comment still holds true.
Except in rarely cases, and very simple projects, it is probable that a project cannot be compatible with Drupal 8.x and Drupal 11.x.

avpaderno’s picture

That comment could be rephrased to the following one, but its meaning would not change.

Projects used for these applications should not declare itself compatible with a Drupal release that is no longer supported. No site should be using Drupal 8 nor Drupal 9, and people should not be encouraged to use those Drupal releases.

dan612’s picture

Except in rarely cases, and very simple projects, it is probable that a project cannot be compatible with Drupal 8.x and Drupal 11.x.

I believe this may be the case here. All that is needed for this module to function is alterRoutes(), the permission system, and JSON:API - all of which were present in core for D9+ and the requirement is:

core_version_requirement: ^9 || ^10 || ^11

So I do not believe D8 support is implied here. However, I do not mind dropping D9 support if that is the standard.

For what it's worth I plan on doing a new release of this module but wanted to see if I could opt-in first 🙂