mattdm
(Matthew Miller)
11 Enero, 2021 20:57
1
Preferiría no proporcionar una clave de API global al plugin de WordPress. No quiero que una vulnerabilidad en el sitio de WordPress resulte en la eliminación (o edición, o desconexión) de cuentas de usuario. Sin embargo, limitar los ámbitos mediante suposiciones parece dar resultados extraños (como que no pueda cargar subcategorías).
¿Qué ámbitos necesita realmente para funcionar?
4 Me gusta
Falco
(Falco)
11 Enero, 2021 22:24
2
Dado que WordPress es anterior a los alcances de la API de administración por varios años, dudo que pueda funcionar con ella.
Es una solicitud de función interesante.
mattdm
(Matthew Miller)
11 Enero, 2021 22:37
3
Agradecería mucho eso. La clave de API global puede hacer muchas cosas, y estamos utilizando nuestra instancia de Discourse para más que solo los comentarios del blog, así que sería bueno limitarla solo a lo que necesita.
mattdm
(Matthew Miller)
11 Enero, 2021 23:29
4
¿Es mejor que esta solicitud de función esté en esta categoría o en la de funciones?
angus
(Angus McLeod)
12 Enero, 2021 07:36
5
¡He estado pensando lo mismo! (Actualmente mantengo el plugin). Esta es la categoría adecuada para plantearlo.
Lo discutiré con @simon y te responderé.
3 Me gusta
mattdm
(Matthew Miller)
11 Diciembre, 2021 17:47
6
@angus ¿Esto llegó a alguna parte? Nos gustaría usar esto en uno de nuestros sitios de WordPress donde tenemos un conjunto de usuarios con acceso de administrador menos controlado, y no quiero que eso sea una escalada al acceso de administrador completo en nuestro sitio de Discourse.
angus
(Angus McLeod)
14 Diciembre, 2021 05:55
7
Hola Matt, gracias por el seguimiento. Te daré una respuesta completa antes del final de la semana.
1 me gusta
angus
(Angus McLeod)
20 Diciembre, 2021 02:15
8
@mattdm Una actualización sobre esto. Estoy preparando cambios que te permitirán generar una clave de API con ámbitos específicos para el conjunto de características del plugin WP Discourse que estás utilizando.
Esto requerirá cambios en el núcleo de Discourse, por lo que está sujeto a aprobación. Te mantendré al tanto esta semana a medida que haga una PR.
2 Me gusta
angus
(Angus McLeod)
20 Diciembre, 2021 09:50
9
@mattdm Actualización: hay dos PR en borrador que buscan abordar esto. Como se mencionó, el enfoque necesitará ser aprobado primero. Notas más explicativas en el PR de discourse/discourse.
main ← angusmcleod:fix_wordpress_scopes
opened 09:46AM - 20 Dec 21 UTC
I'm looking to add granular API key usage for the WP Discourse plugin. This invo… lves:
- Updating the "wordpress" default mappings to reflect the actions being used by the plugin, grouped by the feature-set they relate to (note that the existing "wordpress" action in the "topic" resource only relates to comment retrieval in the plugin, and is somewhat confusing in its current state).
- Adding a ``session/scopes`` endpoint, which returns the scopes associated with the api key in the request.
This is the companion PR on the plugin, which will provide further context to this: https://github.com/discourse/wp-discourse/pull/431. See in particular [``validate_scopes``](https://github.com/discourse/wp-discourse/pull/431/files#diff-5fd9ce264afeb5f617119db36e34a2e5a33f605527ac6fa9ee761b8123f1a17eR185).
If this approach is acceptable, I'll do some more testing before moving this out of draft. Below are some Q/A explaining my thinking behind this.
### Why does the wordpress plugin need granular scopes?
Currently the plugin requires the use of a global key, but only uses a subset of the actions, creating more risk than necessary. [See for example](https://meta.discourse.org/t/what-scopes-exactly-does-the-wordpress-api-key-need/175812).
### Why group the scopes by feature set?
This is how people use the plugin. Some use only SSO, some only publishing, some without comments etc. If a user is not using SSO they should be able to use a key that doesn't include the ``admin/user`` actions SSO requires.
Currently the "publishing" feature set cannot be totally disabled in the plugin (hence the "(required)" in the action description), however the ability to disable it (and just use SSO) may be added.
### Why add a ``session/scopes`` endpoint?
The WP Discourse plugin currently sends a request to ``/users/:username`` to test its connection to Discourse. This may be successful even if the allowed scopes are insufficient for how the plugin is configured.
A scopes endpoint tells the API consumer both whether the connection is successful and what scopes their key has. There's similar implementations in other APIs, e.g [Sendgrid](https://docs.sendgrid.com/api-reference/api-key-permissions/retrieve-a-list-of-scopes-for-which-this-user-has-access).
### Why add the ``scopes`` endpoint to the session controller?
The endpoint could go in a few different places. I figured it belonged there as essentially you're asking about the scopes in the session created when the api-authenticated request is made.
### Why not use a ``tokeninfo`` endpoint?
``tokeninfo`` endpoints are part of the OAuth 2.0 spec, which is not what we're dealing with here. Using it may be confusing.
main ← angusmcleod:granular_api_key_support
opened 09:16AM - 20 Dec 21 UTC
- Wordpress 6.0 support
- Granular API Key support (backwards compatible)
- Di… scourseConnect copy fix
- Add wpdc_publish_body filter
2 Me gusta
mattdm
(Matthew Miller)
8 Abril, 2022 18:35
10
Parece que esto se ha detenido. Me gustaría usar este plugin para Fedora Magazine, que tiene una política de acceso bastante abierto por diseño, incluso más que el Fedora Community Blog con el que lo estamos usando actualmente. ¿Alguna noticia, por casualidad?
angus
(Angus McLeod)
9 Abril, 2022 10:03
11
Gracias por la respuesta rápida @mattdm , y qué buena coincidencia, ya que lo tengo en mi calendario para retomarlo la semana que viene ahora que ha habido algunos avances en la PR de Discourse. Te daré una actualización la semana que viene.
1 me gusta
angus
(Angus McLeod)
18 Abril, 2022 13:07
12
Solo una nota de que la parte de Discourse de esto ha sido enviada a revisión (es decir, se ha movido de borrador).
main ← angusmcleod:fix_wordpress_scopes
opened 09:46AM - 20 Dec 21 UTC
I'm looking to add granular API key usage for the WP Discourse plugin. This invo… lves:
- Updating the "wordpress" default mappings to reflect the actions being used by the plugin, grouped by the feature-set they relate to (note that the existing "wordpress" action in the "topic" resource only relates to comment retrieval in the plugin, and is somewhat confusing in its current state).
- Adding a ``session/scopes`` endpoint, which returns the scopes associated with the api key in the request.
This is the companion PR on the plugin, which will provide further context to this: https://github.com/discourse/wp-discourse/pull/431. See in particular [``validate_scopes``](https://github.com/discourse/wp-discourse/pull/431/files#diff-5fd9ce264afeb5f617119db36e34a2e5a33f605527ac6fa9ee761b8123f1a17eR185).
If this approach is acceptable, I'll do some more testing before moving this out of draft. Below are some Q/A explaining my thinking behind this.
### Why does the wordpress plugin need granular scopes?
Currently the plugin requires the use of a global key, but only uses a subset of the actions, creating more risk than necessary. [See for example](https://meta.discourse.org/t/what-scopes-exactly-does-the-wordpress-api-key-need/175812).
### Why group the scopes by feature set?
This is how people use the plugin. Some use only SSO, some only publishing, some without comments etc. If a user is not using SSO they should be able to use a key that doesn't include the ``admin/user`` actions SSO requires.
Currently the "publishing" feature set cannot be totally disabled in the plugin (hence the "(required)" in the action description), however the ability to disable it (and just use SSO) may be added.
### Why add a ``session/scopes`` endpoint?
The WP Discourse plugin currently sends a request to ``/users/:username`` to test its connection to Discourse. This may be successful even if the allowed scopes are insufficient for how the plugin is configured.
A scopes endpoint tells the API consumer both whether the connection is successful and what scopes their key has. There's similar implementations in other APIs, e.g [Sendgrid](https://docs.sendgrid.com/api-reference/api-key-permissions/retrieve-a-list-of-scopes-for-which-this-user-has-access).
### Why add the ``scopes`` endpoint to the session controller?
The endpoint could go in a few different places. I figured it belonged there as essentially you're asking about the scopes in the session created when the api-authenticated request is made.
### Why not use a ``tokeninfo`` endpoint?
``tokeninfo`` endpoints are part of the OAuth 2.0 spec, which is not what we're dealing with here. Using it may be confusing.
Una vez que se fusione eso, la parte de WP Discourse se podrá fusionar y lanzar.
2 Me gusta
angus
(Angus McLeod)
24 Mayo, 2022 16:34
13
@mattdm Los ámbitos granulares ahora están disponibles en WP Discourse 2.4.3 . Si estás en la última versión de Discourse y la última versión del plugin, podrás usarlos. Publicaré una guía completa sobre cómo usarlos más adelante esta semana.
edición ¡Aquí está la guía!
6 Me gusta
system
(system)
Cerrado
23 Junio, 2022 16:35
14
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.