mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-17 13:39:44 +02:00
fix: Use configured OAuth server rate limits (#40542)
Co-authored-by: n8n-cat-bot[bot] <n8n-cat-bot[bot]@users.noreply.github.com>
This commit is contained in:
parent
00849c4dea
commit
4c8b76b6f0
|
|
@ -938,6 +938,32 @@ describe('IP rate limit configuration', () => {
|
|||
}
|
||||
});
|
||||
|
||||
test.each([
|
||||
['GET', '/mcp-oauth/authorize'],
|
||||
['POST', '/mcp-oauth/token'],
|
||||
['POST', '/mcp-oauth/revoke'],
|
||||
['POST', '/mcp-oauth/register'],
|
||||
['GET', '/oauth/authorize'],
|
||||
['POST', '/oauth/token'],
|
||||
['POST', '/oauth/revoke'],
|
||||
['POST', '/oauth/register'],
|
||||
])('does not apply an SDK rate limit to %s %s', async (method, path) => {
|
||||
const response =
|
||||
method === 'GET'
|
||||
? await testServer.restlessAgent.get(path)
|
||||
: await testServer.restlessAgent.post(path).send({});
|
||||
|
||||
expect(response.statusCode).not.toBe(404);
|
||||
expect(response.headers).not.toHaveProperty('ratelimit-policy');
|
||||
});
|
||||
|
||||
test('does not cap authorization requests at the SDK default of 100', async () => {
|
||||
for (let attempt = 0; attempt <= 100; attempt++) {
|
||||
const response = await testServer.restlessAgent.get('/mcp-oauth/authorize');
|
||||
expect(response.statusCode).toBe(400);
|
||||
}
|
||||
});
|
||||
|
||||
test.each([
|
||||
'metadata',
|
||||
'metadataOptions',
|
||||
|
|
|
|||
|
|
@ -81,10 +81,17 @@ const rfc9207IssuerParam: RequestHandler = (_req, res, next) => {
|
|||
// `/oauth/*` paths that future, non-MCP protected resources will advertise.
|
||||
const registerRouter = clientRegistrationHandler({
|
||||
clientsStore: oauthServerService.clientsStore,
|
||||
rateLimit: false,
|
||||
}) as Router;
|
||||
const authorizeRouter = authorizationHandler({
|
||||
provider: oauthServerService,
|
||||
rateLimit: false,
|
||||
}) as Router;
|
||||
const tokenRouter = tokenHandler({ provider: oauthServerService, rateLimit: false }) as Router;
|
||||
const revokeRouter = revocationHandler({
|
||||
provider: oauthServerService,
|
||||
rateLimit: false,
|
||||
}) as Router;
|
||||
const authorizeRouter = authorizationHandler({ provider: oauthServerService }) as Router;
|
||||
const tokenRouter = tokenHandler({ provider: oauthServerService }) as Router;
|
||||
const revokeRouter = revocationHandler({ provider: oauthServerService }) as Router;
|
||||
|
||||
const sharedEndpointRouters = (basePath: '/mcp-oauth' | '/oauth'): StaticRouterMetadata[] => [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user