mattdm
(Matthew Miller)
11 Gennaio 2021, 8:57pm
1
Preferirei non fornire una chiave API globale al plugin WordPress. Non voglio che un compromesso del sito WordPress porti alla cancellazione (o modifica, o disconnessione) degli account utente. Tuttavia, limitare gli ambiti per tentativi sembra dare risultati strani (ad esempio, non riesce a caricare le sottocategorie).
Di quali ambiti ha effettivamente bisogno per funzionare?
Falco
(Falco)
11 Gennaio 2021, 10:24pm
2
Considerando che WordPress è stato creato diversi anni prima delle scope dell’API di amministrazione, dubito che possa funzionare con essa.
È una richiesta di funzionalità interessante.
mattdm
(Matthew Miller)
11 Gennaio 2021, 10:37pm
3
Lo apprezzerei molto. La chiave API globale può fare molte cose, e stiamo utilizzando la nostra istanza di Discourse per più che semplici commenti al blog, quindi sarebbe bello mantenerla limitata solo a ciò di cui ha bisogno.
mattdm
(Matthew Miller)
11 Gennaio 2021, 11:29pm
4
È meglio presentare una richiesta di questo tipo in questa categoria o nella sezione delle funzionalità?
angus
(Angus McLeod)
12 Gennaio 2021, 7:36am
5
Anch’io ci ho pensato! (Attualmente mantengo il plugin). Questa è la categoria giusta per sollevare la questione.
Ne discuterò con @simon e ti farò sapere.
mattdm
(Matthew Miller)
11 Dicembre 2021, 5:47pm
6
@angus Questo è andato da qualche parte? Vorremmo usarlo su uno dei nostri siti WordPress dove abbiamo un insieme di utenti con accesso amministrativo meno che strettamente controllato, e non voglio che questo diventi un’escalation verso l’accesso amministrativo completo sul nostro sito Discourse.
angus
(Angus McLeod)
14 Dicembre 2021, 5:55am
7
Ehi Matt, grazie per avermi ricordato. Ti darò una risposta completa entro la fine della settimana.
angus
(Angus McLeod)
20 Dicembre 2021, 2:15am
8
@mattdm Un aggiornamento su questo. Sto preparando modifiche che ti consentiranno di generare una chiave API con ambiti specifici per il set di funzionalità del plugin WP Discourse che stai utilizzando.
Ciò richiederà modifiche al core di Discourse, quindi è soggetto ad approvazione. Ti terrò aggiornato questa settimana mentre creo una PR.
angus
(Angus McLeod)
20 Dicembre 2021, 9:50am
9
@mattdm Aggiornamento: ci sono due PR in bozza che cercano di affrontare questo problema. Come accennato, l’approccio dovrà essere approvato prima. Note più esplicative sul PR di 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
mattdm
(Matthew Miller)
8 Aprile 2022, 6:35pm
10
Sembra che si sia bloccato. Vorrei utilizzare questo plugin per Fedora Magazine, che per sua natura ha una politica di accesso piuttosto aperta, ancora più del Fedora Community Blog con cui lo stiamo utilizzando attualmente. Ci sono novità, per caso?
angus
(Angus McLeod)
9 Aprile 2022, 10:03am
11
Grazie per il sollecito @mattdm , e buon tempismo dato che l’ho segnato sul calendario per riprenderlo la prossima settimana, ora che ci sono stati alcuni sviluppi nel PR di Discourse. Ti darò un aggiornamento la prossima settimana.
angus
(Angus McLeod)
18 Aprile 2022, 1:07pm
12
Solo una nota: la parte di Discourse è stata inviata per la revisione (cioè rimossa dalla bozza).
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 volta che sarà unita, la parte di WP Discourse potrà essere unita e rilasciata.
angus
(Angus McLeod)
24 Maggio 2022, 4:34pm
13
@mattdm Gli scope granulari sono ora rilasciati in WP Discourse 2.4.3 . Se sei sull’ultima versione di Discourse e sull’ultima versione del plugin sarai in grado di usarli. Pubblicherò una guida completa su come usarli più avanti nella settimana.
modifica Ecco la guida!