Skip to main content

FUSE + Slack?

Some time ago I read a bit about FUSE (Filesystem in Userspace) and I wanted to do some small project to test it out. Since I’m using an IRC gateway for chatting on Slack I thought I could craete a simple FUSE driver to let me access our cat images channel with the usual tools just as if they were on my local disk.

FUSE is an interface for unprivileged programs running in userpace to implement virtual filesystems. Examples of popular and maintained filesystems built on top of FUSE include: sshfs (for mounting remote filesystems over SSH), ntfs-3g (for mounting NTFS partitions), s3fs (for mounting Amazon AWS S3 buckets).

After an evening of prototyping I had a first “working” version of SlackFS, a virtual filesystem that allowed opening and uploading files from a Slack workspace. The code is available on my GitHub. It uses Python FUSE bindings to implement the minimum required set of operations for the whole thing to at least not crash programs that try to access the files.

There are many limitations I’m aware of listed in the README. For example, files from channels are fetched only once, on mount. Files, however, are fetched lazily when they are accessed for the first time and cached for later use. Uploading new works but it’s not intuitive because I need to change the names of the uploaded files because Slack allows mutliple files with the same name to be sent to a channel. There are couple problems related to the APIs that I didn’t bother resolving because the current version is “good enough” for a demo and my use case.

To sum up, it was a fun couple evenings. I ended up with a “polished prototype”. Later I gave a short talk at work about FUSE where we live-coded a driver for accessing employees’ leaves database. It served two purposes, first one – to show FUSE, second – to show a problem with authorization in the corpo’s in-house solution for managing leaves. Yep, it was possible to access ALL the details (like reasons and types of leaves) for ALL employees in Poland1.


  1. Note from editing in 2022 before publishing: I left the company later that year. I believe they started to migrate to an outsourced service around that time. ↩︎