Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests should test all legal server name formats #1000

Open
Twi1ightSparkle opened this issue Dec 11, 2024 · 1 comment
Open

Tests should test all legal server name formats #1000

Twi1ightSparkle opened this issue Dec 11, 2024 · 1 comment

Comments

@Twi1ightSparkle
Copy link
Contributor

I ran into an issue with generic hooks when running Hookshot on localhost with the server name set to localhost:8448.

INFO 12:16:27:794 [GenericHookConnection] onGenericHook !QrmxBsBKPajykCohPz:localhost:8448 7e789bf2-7b87-4b10-9438-a22a6f1090d2
ERROR 12:16:27:800 [Appservice] Error registering user: User ID is in use
ERROR 12:16:27:804 [MatrixHttpClient] (REQ-15) {
  errcode: 'M_FORBIDDEN',
  error: 'Application service cannot masquerade as this user (@_webhooks_hookname:localhost).'
}
WARN 12:16:27:804 [Bridge] Failed to handle generic webhook MatrixError: M_FORBIDDEN: Application service cannot masquerade as this user (@_webhooks_hookname:localhost).
    at Object.defaultErrorHandler [as errorHandler] (/usr/bin/matrix-hookshot/node_modules/matrix-bot-sdk/lib/http.js:10:9)
    at doHttpRequest (/usr/bin/matrix-hookshot/node_modules/matrix-bot-sdk/lib/http.js:98:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async descriptor.value (/usr/bin/matrix-hookshot/node_modules/matrix-bot-sdk/lib/metrics/decorators.js:19:32)
    at async descriptor.value (/usr/bin/matrix-hookshot/node_modules/matrix-bot-sdk/lib/metrics/decorators.js:19:32)
    at async GenericHookConnection.ensureDisplayname (/usr/bin/matrix-hookshot/Connections/GenericHook.js:271:13)
    at async GenericHookConnection.onGenericHook (/usr/bin/matrix-hookshot/Connections/GenericHook.js:478:13)
    at async /usr/bin/matrix-hookshot/Bridge.js:435:25
    at async Promise.all (index 0)
    at async LocalMQ.<anonymous> (/usr/bin/matrix-hookshot/Bridge.js:410:13) {
  body: {
    errcode: 'M_FORBIDDEN',
    error: 'Application service cannot masquerade as this user (@_webhooks_hookname:localhost).'
  },
  statusCode: 403,
  errcode: 'M_FORBIDDEN',
  error: 'Application service cannot masquerade as this user (@_webhooks_hookname:localhost).',
  retryAfterMs: undefined
}

I proposed a fix to this specific bug in #999, but would be nice if tests checked this for all Hookshot features.

Having the port in the server name is legal according to the Spec: https://spec.matrix.org/v1.12/appendices/#server-name

@Twi1ightSparkle
Copy link
Contributor Author

And where the server name is an IP v4 and v6

@Twi1ightSparkle Twi1ightSparkle changed the title Tests should test server names with the port in it Tests should test all legal server name formats Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant