mattdm
(Matthew Miller)
11. Januar 2021 um 20:57
1
Ich würde es vorziehen, dem WordPress-Plugin keinen globalen API-Schlüssel zu übergeben. Ich möchte nicht, dass ein Kompromiss der WordPress-Site dazu führt, dass Benutzerkonten gelöscht (oder bearbeitet oder abgemeldet) werden. Das Einschränken der Scopes durch Raten scheint jedoch zu seltsamen Ergebnissen zu führen (z. B. kann es Unterseiten nicht laden).
Welche Scopes werden dafür tatsächlich benötigt?
4 „Gefällt mir“
Falco
(Falco)
11. Januar 2021 um 22:24
2
Da WordPress die Admin-API-Berechtigungen um mehrere Jahre vorausgeht, bezweifle ich, dass es damit funktionieren kann.
Es ist eine interessante Funktionsanfrage.
mattdm
(Matthew Miller)
11. Januar 2021 um 22:37
3
Ich wäre Ihnen wirklich dankbar. Der globale API-Schlüssel kann viele Dinge tun, und wir nutzen unsere Discourse-Instanz für mehr als nur Blog-Kommentare. Es wäre daher schön, ihn auf das Notwendige zu beschränken.
mattdm
(Matthew Miller)
11. Januar 2021 um 23:29
4
Ist eine solche Funktionsanfrage in dieser Kategorie besser aufgehoben oder im Bereich Funktionen?
angus
(Angus McLeod)
12. Januar 2021 um 07:36
5
Ich habe genau dasselbe gedacht! (Ich pflege derzeit das Plugin.) Das ist die richtige Kategorie, um das anzusprechen.
Ich werde das mit @simon besprechen und mich dann bei dir melden.
3 „Gefällt mir“
mattdm
(Matthew Miller)
11. Dezember 2021 um 17:47
6
@angus Hat das etwas ergeben? Wir möchten dies auf einer unserer WordPress-Seiten verwenden, auf denen wir eine nicht sehr streng kontrollierte Gruppe von Benutzern mit Administratorzugriff haben, und ich möchte nicht, dass dies zu einem vollständigen Administratorzugriff auf unserer Discourse-Seite eskaliert.
angus
(Angus McLeod)
14. Dezember 2021 um 05:55
7
Hallo Matt, danke für den Hinweis. Ich werde dir bis Ende der Woche eine vollständige Antwort geben.
1 „Gefällt mir“
angus
(Angus McLeod)
20. Dezember 2021 um 02:15
8
@mattdm Ein Update hierzu. Ich bereite Änderungen vor, die es Ihnen ermöglichen, einen API-Schlüssel mit spezifischen Bereichen für den Funktionsumfang des WP Discourse -Plugins, das Sie verwenden, zu generieren.
Dies erfordert Änderungen am Discourse-Kern, daher unterliegt es der Genehmigung. Ich werde Sie diese Woche auf dem Laufenden halten, während ich einen PR erstelle.
2 „Gefällt mir“
angus
(Angus McLeod)
20. Dezember 2021 um 09:50
9
@mattdm Update: Es gibt zwei PRs in Draft, die darauf abzielen, dies zu beheben. Wie erwähnt, muss der Ansatz zuerst genehmigt werden. Weitere erklärende Hinweise zum PR 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 „Gefällt mir“
mattdm
(Matthew Miller)
8. April 2022 um 18:35
10
Das sieht so aus, als wäre es ins Stocken geraten. Ich möchte dieses Plugin für das Fedora Magazine verwenden, das von Natur aus eine ziemlich offene Zugriffspolitik hat – sogar mehr als das Fedora Community Blog, mit dem wir es derzeit verwenden. Gibt es zufällig Neuigkeiten?
angus
(Angus McLeod)
9. April 2022 um 10:03
11
Vielen Dank für die schnelle Antwort @mattdm , und das passt gut, da ich es nächste Woche wieder aufgreifen wollte, da es bei dem Discourse PR einige Fortschritte gab. Ich werde Sie nächste Woche darüber informieren.
1 „Gefällt mir“
angus
(Angus McLeod)
18. April 2022 um 13:07
12
Nur eine kurze Notiz, dass der Discourse-Teil davon zur Überprüfung eingereicht wurde (d. h. aus dem Entwurf verschoben wurde).
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.
Sobald dieser zusammengeführt wurde, kann der WP Discourse -Teil zusammengeführt und veröffentlicht werden.
2 „Gefällt mir“
angus
(Angus McLeod)
24. Mai 2022 um 16:34
13
@mattdm Granulare Scopes sind jetzt in WP Discourse 2.4.3 veröffentlicht worden. Wenn Sie die neueste Version von Discourse und die neueste Version des Plugins verwenden, können Sie diese nutzen. Ich werde im Laufe der Woche eine vollständige Anleitung zur Verwendung veröffentlichen.
Bearbeitung Hier ist die Anleitung!
6 „Gefällt mir“
system
(system)
Geschlossen,
23. Juni 2022 um 16:35
14
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.