Mercurial > prosody-modules
view mod_test_data/mod_test_data.lua @ 5404:1087f697c3f3
mod_http_oauth2: Strip unknown extra fields from client registration
We shouldn't sign things we don't understand!
RFC 7591 section-2 states:
> The authorization server MUST ignore any client metadata sent by the
> client that it does not understand (for instance, by silently removing
> unknown metadata from the client's registration record during
> processing).
Prevents grandfathering in of unvalidated data that might become used
later, especially since the 'additionalProperties' schema keyword was
removed in 698fef74ce53
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 02 May 2023 16:23:40 +0200 |
parents | af824168729a |
children |
line wrap: on
line source
local users = { "fezziwig", "badger", "nupkins", "pumblechook", "rouncewell" }; local host = "localhost"; local id = require "util.id"; local st = require "util.stanza"; local sm = require "core.storagemanager"; -- Return a random number from 1..max excluding n function random_other(n, max) return ((math.random(1, max-1)+(n-1))%max)+1; end local new_time; do local _current_time = os.time(); function new_time() _current_time = _current_time + math.random(1, 3600); return _current_time; end end function module.command(arg) --luacheck: ignore arg sm.initialize_host(host); local archive = sm.open(host, "archive", "archive"); for _ = 1, 100000 do local random = math.random(1, #users); local user, contact = users[random], users[random_other(random, #users)]; local user_jid, contact_jid = user.."@"..host, contact.."@"..host; local stanza = st.message({ to = contact_jid, from = user_jid, type="chat" }) :tag("body"):text(id.long()); archive:append(user, nil, stanza, new_time(), contact_jid) local stanza2 = st.clone(stanza); stanza2.attr.from, stanza2.attr.to = stanza.attr.to, stanza.attr.from; archive:append(contact, nil, stanza2, new_time(), user_jid) end end