The discussion revolves around accessing a password-protected Discourse feed on an external WordPress site using Single Sign-On (SSO). strategeek initially asked for help, and eviltrout suggested generating an API key for a user account and appending it to the URL. However, this approach raises security concerns, as the API key can be used to perform actions as the underlying user account.
eviltrout also warned against generating an “All Users” API key, which could compromise the entire site. dansingerman reported an issue where RSS feeds with read restrictions do not work with API keys, even when the key is valid for the user. This was confirmed to be a bug by eviltrout and later fixed by techAPJ.
However, scombs reported that the fix only resolves the issue for restricted categories, not the “Latest” feed. codinghorror noted that API keys now need to be passed in headers, not URLs. sam and blake discussed the challenges of implementing private RSS feeds with API keys, as most RSS readers do not support custom headers.
sam proposed a solution involving tightly scoped user API keys, but this would require significant development work. xadium expressed interest in maintaining the URL auth mechanism for private RSS feeds, citing a use case where they integrate WordPress and Discourse. Jack_Ukleja reported mixed results when using API keys for private RSS feeds, with some feeds working but others not. sptrf suggested that specifying an accepting header is necessary to fetch the correct RSS data with an API key.
I should note there are security issues with making that api key visible to users. If someone has it, they can do anything that the underlying user account can do. It would be much better to fetch the RSS server side using the key then only exposing the resulting feed.
Also, be especially careful not to generate an “All Users” key for this. If someone gets that key they can do anything as any user on your site. So just be extra careful
We are having the issue that the RSS feeds do not work with an api_key if the categories have read restrictions, even if the api_key is valid for a user that should be able to access the category.
@david さんのスコープ設定に関する作業に関連するアイデアとして、単一の RSS フィードに厳密にスコープされたユーザー API キーを作成する方法があります。これにより攻撃対象領域を最小限に抑えられます。また、そのような超狭いスコープのユーザー API キーの場合は、ヘッダーなしでも認証を許可できます(user_api_key に「このキーは GET による認証に使用可能」というフラグを追加するカラムを設けるなど)。
ここで課題となる点は以下の通りです:
ユーザーがユーザー API キーを生成する仕組みが存在しません。RSS のユースケース向けに何らかの仕組みを構築する必要があり、新しい UX が伴います。どこに追加すべきか(ユーザープロフィールなど)も現時点では不明です。
特定の RSS フィードにのみスコープを限定する仕組みが存在せず、これを追加する必要があります。
URL の GET パラメータ経由で「許可されたユーザー API キー」を示すフラグが存在せず、これが必要となります。