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

Empty admin rooms should be discarded or unused #579

Open
AndrewFerr opened this issue Nov 25, 2022 · 3 comments
Open

Empty admin rooms should be discarded or unused #579

AndrewFerr opened this issue Nov 25, 2022 · 3 comments
Assignees
Labels
Admin Room Involves the admin room subsystem S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems.

Comments

@AndrewFerr
Copy link
Member

If a user leaves their admin room, Hookshot continues to use it for posting URLs generated by !hookshot webhook. Since admin rooms are typically invite-only DMs, the user will never be able rejoin the room after leaving it, and will never be able to see those messages.

To prevent posting messages in inaccessible admin rooms, Hookshot should either leave empty admin rooms (on startup or in response to the user leaving), or should invite the user back to an admin room when posting a new message in it. My preference is the former, because it prevents Hookshot's room list from slowly growing larger and larger.

@AndrewFerr AndrewFerr added T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems. Admin Room Involves the admin room subsystem S-Minor Impairs non-critical functionality or suitable workarounds exist javascript Pull requests that update Javascript code labels Nov 25, 2022
@AndrewFerr AndrewFerr self-assigned this Nov 25, 2022
@michielappelman
Copy link

Oh no. I didn't realize this was a thing, so I have indeed left the initial room created by Hookshot and now cannot set up additional webhooks.

Is there a workaround available? I took a look at the info coming back from the Provisioning API but that also doesn't include the Webhook URL, nor do I seem to be able to set up a new Admin Room.

@AndrewFerr
Copy link
Member Author

If you're running your own Hookshot instance, you can do this:

  • Invite the Hookshot bot to a new DM.
  • Get the room ID of the old admin room.
    • The easiest way to find it is to look through your browser history.
    • Otherwise, you can use this Bash script to find it, using Hookshot's appservice registration token as AS_TOKEN:
AS_TOKEN=$(awk '/as_token/ {print $2}' registration.yml)
HOMESERVER_URL='http://<your_host_and_port_here>'
for ROOM in $(curl -s -H "Authorization: Bearer $AS_TOKEN" "${HOMESERVER_URL}/_matrix/client/v3/joined_rooms" | jq -r '.joined_rooms[]'); do
    if [[ $(curl -s -H "Authorization: Bearer $AS_TOKEN" "${HOMESERVER_URL}/_matrix/client/v3/user/@hookshot:synapse-hookshot.testlocal/rooms/${ROOM}/account_data/uk.half-shot.matrix-hookshot.github.room" | jq '.admin_user') != null ]]; then
        echo $ROOM
    fi
done

This worked for me in a local test instance.

@michielappelman
Copy link

Thanks a million, that worked perfectly. I used Synapse Admin to combine step 2 and 3, where I found the room with the lone Hookshot in there and deleted it from the list. After a restart of hookshot (actually the whole Matrix environment), the Hookshot bot is now indeed sharing its secrets with me once again. 🙏

@Half-Shot Half-Shot removed the javascript Pull requests that update Javascript code label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin Room Involves the admin room subsystem S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems.
Projects
None yet
Development

No branches or pull requests

3 participants