?
avatar C-Lodder
C-Lodder
22 May 2020

Steps to reproduce the issue

Use the following in your terminal:

curl -H "Authorization: Bearer YOUR_TOKEN" {{URL}}/api/index.php/v1/config/application

Or via JS:

fetch('{{URL}}/api/index.php/v1/config/application', {
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
})
  .then(response => response.json())
  .then(data => console.log(data))

Expected result

DB credentials should not be returned in the API response

Actual result

Database credentials are exposed

Additional comments

It has been raised that that application API should be removed as site level configs should not be exposed at all.

@wilsonge @zero-24 @SniperSister

avatar C-Lodder C-Lodder - open - 22 May 2020
avatar joomla-cms-bot joomla-cms-bot - change - 22 May 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 22 May 2020
avatar C-Lodder C-Lodder - change - 22 May 2020
The description was changed
avatar C-Lodder C-Lodder - edited - 22 May 2020
avatar zero-24
zero-24 - comment - 22 May 2020

Thanks will take a look into that issue over the weekend.

avatar brianteeman
brianteeman - comment - 22 May 2020

It has been raised that that application API should be removed as site level configs should not be exposed at all.

Why not?

avatar C-Lodder
C-Lodder - comment - 22 May 2020

Quote from @mbabker

maybe certain aspects of it are "fine" as far as how sensitive the info might be, but the fact of the matter is the global application configuration is being exposed through a API based interface which is generally a red flag to me.

either way i'd advocate for just dumping that endpoint, to me it's too high risk to have that data available through an API but that's just me... if someone really thinks that application and component parameters should be configurable through an API instead of using the Joomla backend then they can add a plugin for that part of the system, but in general it seems like making that type of configuration readable (if not writable already, no idea what the API spec is) in that way is just asking for potential problems down the line

avatar alikon
alikon - comment - 22 May 2020

my usual dirt hack ?
#29198

avatar zero-24
zero-24 - comment - 23 May 2020

Thanks for the PR @alikon.

Will let that one here open for @wilsonge to take a final decision on the point raised by @mbabker and @C-Lodder about removing that endpoint all together or keep it with the limits implemented by #29198

avatar zero-24 zero-24 - change - 23 May 2020
Labels Added: ?
avatar zero-24 zero-24 - labeled - 23 May 2020
avatar zero-24
zero-24 - comment - 23 May 2020

I'm assigning the release blocker label for now. So this Issue is included and taken an decision on at least before the final version is out. As IIRC removing that endpoint later would be a B/C break right?

avatar mbabker
mbabker - comment - 24 May 2020

As IIRC removing that endpoint later would be a B/C break right?

I'm fairly certain the Joomla development strategy does not reflect a policy regarding features of this type of API, but things that should be considered a B/C break include:

  • The removal of data from an existing endpoint (i.e. removing database credentials from the application configuration endpoint after the release of 4.0)
  • Changing an existing key in the response payload (i.e. renaming "created" to "created_at")
  • The removal of an existing endpoint (i.e. GET support for the /api/index.php/v1/config/application endpoint is removed)

Therefore, any plans for removal of data and/or endpoints must be finalized prior to release as those types of changes should be considered breaking changes by any sane definition.

Additionally, even if after release it were decided to publish a /api/index.php/v2/config/application endpoint (where the API version is properly incremented) where data was removed from the response, the v1 endpoint would still be required to remain accessible until the application issues a major release which allows B/C breaking changes.

avatar zero-24
zero-24 - comment - 24 May 2020

When i get you right it is correct to mark this as release blocker so the decision is taken before stable is out right?

avatar wilsonge
wilsonge - comment - 24 May 2020

I deliberately made these accessible - it's ultimately super admin only anyhow (if it's not it should be). But I want to have every endpoint in Joomla having a corresponding API action.

avatar zero-24
zero-24 - comment - 24 May 2020

Ok so this can be closed as expected behavior now, right?

avatar mbabker
mbabker - comment - 24 May 2020

I want to have every endpoint in Joomla having a corresponding API action

For content that makes sense. How many API providers routinely ship endpoints where application level configuration can be manipulated (even with ACL rules)? I think API endpoints allowing manipulation of com_config, and to a lesser extent com_installer and com_plugins (because those ultimately make changes at the application level) are a major red flag and need to be seriously scrutinized to decide if they actually provide a more tangible benefit than "if you can do it in the UI then there is an API endpoint for it".

avatar wilsonge
wilsonge - comment - 24 May 2020

Sure in drupal this is called the configuration API https://www.drupal.org/docs/8/api/configuration-api

I think com_installer installing extensions by file upload is more arguable than com_config tbh. I honestly don't see why APIs for taking your site offline etc wouldn't be something you would want (also turning on debug mode etc).

I'm also assuming we're talking about the application view in com_config - for component configuration I could give a much longer list of examples.

avatar mbabker
mbabker - comment - 25 May 2020

That’s an internal application API (what Joomla would put in libraries), nothing there indicates that is exposed to a RESTful interface.

avatar wilsonge
wilsonge - comment - 25 May 2020

I think https://www.drupal.org/node/2724823 is the get requests.

I'm unclear as to whether they support updates. But that's largely based on the fact the many of the config entities don't support validation (obviously Joomla does) REF: https://www.drupal.org/project/drupal/issues/2300677

avatar C-Lodder
C-Lodder - comment - 3 Jun 2020

Closing as it's intended

avatar C-Lodder C-Lodder - close - 3 Jun 2020
avatar C-Lodder C-Lodder - change - 3 Jun 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-06-03 11:52:04
Closed_By C-Lodder
Labels Added: ?
Removed: ?
avatar wilsonge wilsonge - change - 16 Sep 2020
Labels Removed: ?
avatar wilsonge wilsonge - unlabeled - 16 Sep 2020

Add a Comment

Login with GitHub to post a comment