Software /
code /
prosody-modules
Annotate
mod_ogp/README.markdown @ 5193:2bb29ece216b
mod_http_oauth2: Implement stateless dynamic client registration
Replaces previous explicit registration that required either the
additional module mod_adhoc_oauth2_client or manually editing the
database. That method was enough to have something to test with, but
would not probably not scale easily.
Dynamic client registration allows creating clients on the fly, which
may be even easier in theory.
In order to not allow basically unauthenticated writes to the database,
we implement a stateless model here.
per_host_key := HMAC(config -> oauth2_registration_key, hostname)
client_id := JWT { client metadata } signed with per_host_key
client_secret := HMAC(per_host_key, client_id)
This should ensure everything we need to know is part of the client_id,
allowing redirects etc to be validated, and the client_secret can be
validated with only the client_id and the per_host_key.
A nonce injected into the client_id JWT should ensure nobody can submit
the same client metadata and retrieve the same client_secret
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 03 Mar 2023 21:14:19 +0100 |
parent | 4598:09f0911c735d |
rev | line source |
---|---|
4460 | 1 # mod_ogp |
2 | |
3 This module adds [Open Graph Protocol](https://ogp.me) metadata to URLs sent inside a MUC. | |
4 | |
5 With mod_ogp enabled, when a user sends a URL in a MUC (where the message has its `id` equal to its `origin-id`), the module calls the URL and parses the result for `<meta>` html tags that have any `og:...` properties. | |
6 If it finds any, it sends a [XEP-0422 fastening](https://xmpp.org/extensions/xep-0422.html) applied to the original message that looks like: | |
7 | |
4484
6813a00878ea
mod_ogp/README: Annotate example as XML to enable syntax highlighting
Kim Alvefur <zash@zash.se>
parents:
4483
diff
changeset
|
8 ```xml |
4597
c858c76d0845
mod_tweet_data: New module that fetches and sends tweet data
JC Brand <jc@opkode.com>
parents:
4485
diff
changeset
|
9 <message id="example" from="chatroom@muc.example.org" to="user@chat.example.org/resource"> |
4483
c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents:
4460
diff
changeset
|
10 <apply-to xmlns="urn:xmpp:fasten:0" id="origin-id-X"> |
c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents:
4460
diff
changeset
|
11 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:title" content="The Rock"/> |
c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents:
4460
diff
changeset
|
12 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:url" content="https://www.imdb.com/title/tt0117500/"/> |
c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents:
4460
diff
changeset
|
13 <meta xmlns="http://www.w3.org/1999/xhtml" property="og:image" content="https://ia.media-imdb.com/images/rock.jpg"/> |
c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents:
4460
diff
changeset
|
14 </apply-to> |
c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents:
4460
diff
changeset
|
15 </message> |
4460 | 16 ``` |
17 | |
18 The module is intentionally simple in the sense that it is basically a transport for https://ogp.me/ | |
4483
c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents:
4460
diff
changeset
|
19 |
c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents:
4460
diff
changeset
|
20 Configuration |
c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents:
4460
diff
changeset
|
21 ------------- |
c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents:
4460
diff
changeset
|
22 |
4598
09f0911c735d
mod_ogp: Add the ability to block OGP fetching for certain domains
JC Brand <jc@opkode.com>
parents:
4597
diff
changeset
|
23 You can present an allowlist or denylist of domains for which OGP metadata will be fetched |
09f0911c735d
mod_ogp: Add the ability to block OGP fetching for certain domains
JC Brand <jc@opkode.com>
parents:
4597
diff
changeset
|
24 via the `ogp_domain_allowlist` and `ogp_domain_denylist` settings repectively. |
4483
c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents:
4460
diff
changeset
|
25 |
c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents:
4460
diff
changeset
|
26 For example: |
c4f11a4b5ac7
mod_ogp: Add the ability to whitelist domains
JC Brand <jc@opkode.com>
parents:
4460
diff
changeset
|
27 |
4485
2c4b65bfac62
mod_ogp/README: Add Lua language annotation to prosody config snippet
Kim Alvefur <zash@zash.se>
parents:
4484
diff
changeset
|
28 ```lua |
2c4b65bfac62
mod_ogp/README: Add Lua language annotation to prosody config snippet
Kim Alvefur <zash@zash.se>
parents:
4484
diff
changeset
|
29 Component "muc.example.org" "muc" |
2c4b65bfac62
mod_ogp/README: Add Lua language annotation to prosody config snippet
Kim Alvefur <zash@zash.se>
parents:
4484
diff
changeset
|
30 modules_enabled = { "ogp" } |
4598
09f0911c735d
mod_ogp: Add the ability to block OGP fetching for certain domains
JC Brand <jc@opkode.com>
parents:
4597
diff
changeset
|
31 ogp_domain_allowlist = { "prosody.im" } |
4485
2c4b65bfac62
mod_ogp/README: Add Lua language annotation to prosody config snippet
Kim Alvefur <zash@zash.se>
parents:
4484
diff
changeset
|
32 ``` |