0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-15 22:41:12 +01:00

Merge branch 'rate_limited_resource_handlers' of https://github.com/kamathmanu/construct

This commit is contained in:
Jason Volk 2022-07-20 21:00:17 -07:00
commit a3dadaf869
15 changed files with 53 additions and 23 deletions

View file

@ -64,6 +64,7 @@ post_3pid
{ {
account_3pid, "POST", post__3pid, account_3pid, "POST", post__3pid,
{ {
post_3pid.REQUIRES_AUTH post_3pid.REQUIRES_AUTH |
post_3pid.RATE_LIMITED // revisit this? some of these require rate limiting, some don't
} }
}; };

View file

@ -61,6 +61,7 @@ post_deactivate
{ {
account_deactivate, "POST", post__deactivate, account_deactivate, "POST", post__deactivate,
{ {
post_deactivate.REQUIRES_AUTH post_deactivate.REQUIRES_AUTH |
post_deactivate.RATE_LIMITED
} }
}; };

View file

@ -76,6 +76,7 @@ post_password
{ {
account_password, "POST", post__password, account_password, "POST", post__password,
{ {
post_password.REQUIRES_AUTH post_password.REQUIRES_AUTH |
post_password.RATE_LIMITED
} }
}; };

View file

@ -39,6 +39,7 @@ get_whoami
{ {
account_whoami, "GET", get__whoami, account_whoami, "GET", get__whoami,
{ {
get_whoami.REQUIRES_AUTH get_whoami.REQUIRES_AUTH |
get_whoami.RATE_LIMITED
} }
}; };

View file

@ -92,7 +92,8 @@ method_post
{ {
join_resource, "POST", post__join, join_resource, "POST", post__join,
{ {
method_post.REQUIRES_AUTH method_post.REQUIRES_AUTH |
method_post.RATE_LIMITED
} }
}; };

View file

@ -204,7 +204,10 @@ post__login(client &client,
m::resource::method m::resource::method
method_post method_post
{ {
login_resource, "POST", post__login login_resource, "POST", post__login,
{
method_post.RATE_LIMITED
}
}; };
m::resource::response m::resource::response
@ -233,5 +236,8 @@ get__login(client &client,
m::resource::method m::resource::method
method_get method_get
{ {
login_resource, "GET", get__login login_resource, "GET", get__login,
{
method_get.RATE_LIMITED
}
}; };

View file

@ -153,7 +153,8 @@ method_put
{ {
presence_resource, "PUT", put__presence, presence_resource, "PUT", put__presence,
{ {
method_put.REQUIRES_AUTH method_put.REQUIRES_AUTH |
method_put.RATE_LIMITED
} }
}; };

View file

@ -48,7 +48,8 @@ method_put
{ {
profile_resource, "PUT", put__profile, profile_resource, "PUT", put__profile,
{ {
method_put.REQUIRES_AUTH method_put.REQUIRES_AUTH |
method_put.RATE_LIMITED
} }
}; };

View file

@ -43,7 +43,8 @@ ircd::m::push::pushers_set_post
{ {
pushers_set_resource, "POST", handle_pushers_set, pushers_set_resource, "POST", handle_pushers_set,
{ {
pushers_set_post.REQUIRES_AUTH pushers_set_post.REQUIRES_AUTH |
pushers_set_post.RATE_LIMITED
} }
}; };

View file

@ -43,7 +43,10 @@ register_resource
m::resource::method m::resource::method
method_post method_post
{ {
register_resource, "POST", post__register register_resource, "POST", post__register,
{
method_post.RATE_LIMITED
}
}; };
ircd::conf::item<bool> ircd::conf::item<bool>

View file

@ -31,7 +31,10 @@ register_available_resource
m::resource::method m::resource::method
method_get method_get
{ {
register_available_resource, "GET", get__register_available register_available_resource, "GET", get__register_available,
{
method_get.RATE_LIMITED
}
}; };
mods::import<void (const m::id::user &)> mods::import<void (const m::id::user &)>

View file

@ -48,7 +48,8 @@ ircd::m::room_keys_keys_delete
{ {
room_keys_keys, "DELETE", delete_room_keys_keys, room_keys_keys, "DELETE", delete_room_keys_keys,
{ {
room_keys_keys_delete.REQUIRES_AUTH room_keys_keys_delete.REQUIRES_AUTH |
room_keys_keys_delete.RATE_LIMITED
} }
}; };
@ -73,7 +74,8 @@ ircd::m::room_keys_keys_put
room_keys_keys, "PUT", put_room_keys_keys, room_keys_keys, "PUT", put_room_keys_keys,
{ {
// Flags // Flags
room_keys_keys_put.REQUIRES_AUTH, room_keys_keys_put.REQUIRES_AUTH |
room_keys_keys_put.RATE_LIMITED,
// timeout //TODO: XXX designated // timeout //TODO: XXX designated
30s, 30s,
@ -198,7 +200,8 @@ ircd::m::room_keys_keys_get
{ {
room_keys_keys, "GET", get_room_keys_keys, room_keys_keys, "GET", get_room_keys_keys,
{ {
room_keys_keys_get.REQUIRES_AUTH room_keys_keys_get.REQUIRES_AUTH |
room_keys_keys_get.RATE_LIMITED
} }
}; };

View file

@ -50,7 +50,8 @@ ircd::m::room_keys_version_post
{ {
room_keys_version, "POST", post_room_keys_version, room_keys_version, "POST", post_room_keys_version,
{ {
room_keys_version_post.REQUIRES_AUTH room_keys_version_post.REQUIRES_AUTH |
room_keys_version_post.RATE_LIMITED
} }
}; };
@ -119,7 +120,8 @@ ircd::m::room_keys_version_delete
{ {
room_keys_version, "DELETE", delete_room_keys_version, room_keys_version, "DELETE", delete_room_keys_version,
{ {
room_keys_version_delete.REQUIRES_AUTH room_keys_version_delete.REQUIRES_AUTH |
room_keys_version_delete.RATE_LIMITED
} }
}; };
@ -175,7 +177,8 @@ ircd::m::room_keys_version_put
{ {
room_keys_version, "PUT", put_room_keys_version, room_keys_version, "PUT", put_room_keys_version,
{ {
room_keys_version_put.REQUIRES_AUTH room_keys_version_put.REQUIRES_AUTH |
room_keys_version_put.RATE_LIMITED
} }
}; };
@ -199,7 +202,8 @@ ircd::m::room_keys_version_get
{ {
room_keys_version, "GET", get_room_keys_version, room_keys_version, "GET", get_room_keys_version,
{ {
room_keys_version_get.REQUIRES_AUTH room_keys_version_get.REQUIRES_AUTH |
room_keys_version_get.RATE_LIMITED
} }
}; };

View file

@ -133,7 +133,8 @@ method_put
{ {
rooms_resource, "PUT", put_rooms, rooms_resource, "PUT", put_rooms,
{ {
method_put.REQUIRES_AUTH method_put.REQUIRES_AUTH |
method_put.RATE_LIMITED
} }
}; };
@ -204,6 +205,7 @@ method_post
{ {
rooms_resource, "POST", post_rooms, rooms_resource, "POST", post_rooms,
{ {
method_post.REQUIRES_AUTH method_post.REQUIRES_AUTH |
method_post.RATE_LIMITED
} }
}; };

View file

@ -55,7 +55,8 @@ ircd::m::search::search_post
{ {
search_resource, "POST", search_post_handle, search_resource, "POST", search_post_handle,
{ {
search_post.REQUIRES_AUTH, search_post.REQUIRES_AUTH |
search_post.RATE_LIMITED,
// Some queries can take a really long time, especially under // Some queries can take a really long time, especially under
// development. We don't need the default request timer getting // development. We don't need the default request timer getting