Repository navigation
filex v0.63.0
Self-hosted file manager - Go single binary + multi-framework frontend.
Download a binary below, or pull a Docker image:
docker pull ghcr.io/brf-tech/filex:slim-v0.63.0
docker pull ghcr.io/brf-tech/filex:full-v0.63.0What changed
Security
- ffmpeg reads a user's file as a media container and nothing else. Exposure: another media file's picture or waveform, shown to whoever sees the upload's thumbnail. Affected: video thumbnails 0.1.0 through 0.62.1 and audio waveforms 0.1.7 through 0.62.1, with an ffmpeg that has the DASH reader (built with libxml2, as the Docker image's and the usual distribution builds are).
- ImageMagick runs under a restrictive policy and sees only the file it was handed. Exposure: files read and written outside the run directory by an app granted
engines:imagemagick; a disguised upload's thumbnail drawn by the SVG renderer, which reads pictures under the server's temporary folder, or by Ghostscript. Affected: apps 0.43.0 through 0.62.1, thumbnails 0.50.0 through 0.62.1. engine_runkeeps every engine inside its run directory. Exposure: a program run, files read or written and network addresses reached outside the run directory, by an app granted an engine. Affected: 0.43.0 through 0.62.1.- An app is not told the server's paths in a host function's error. Exposure: where the server keeps a storage, the spool or a temporary file (no file content), told to an installed app. Affected: 0.43.0 through 0.62.1.
Added
- Streaming media for apps, and a Video player app that plays what the
browser cannot: as it is, or converted by the server's ffmpeg while it
plays (#145).
A new permission,media:stream, lets an app's screen open a stream
session on a file it was opened with (media_stream_open):directserves
the file as it is with byte ranges,transcoderuns ffmpeg with the
output options the app names and hands its fragmented MP4 to the browser
as it comes, from any second (?start=, a seek is a new request, a
browser that leaves stops ffmpeg's whole process group). Nothing is copied
first and nothing is written: ffmpeg reads the file from filex over a
listener on127.0.0.1with a random port, through the storage's ranged
read, so a 40 GB film streams the way a small one does. The address
/_appui/_media/<app>/<token>carries its own unguessable token (bound to
the person, the app and the file; never a cookie; kept out of the access
log) and an interface with"ui": {"media_stream": true}gets that one
path in itsmedia-src, nothing else; its frame alone may go full screen
(allow="fullscreen; autoplay"on the frame,fullscreen=(self)on the
page, and the page'sETagnow covers itsPermissions-Policytoo).
A person's stream is bound to the sign-in session or API token it was
opened with, the request's root, the tenant and the encrypted-folder
rule, all asked again while it plays, and to the file as it was: signed
out, revoked, or the file rewritten or replaced, the stream ends. The
address answers noAccess-Control-Allow-Origin: *, so a page that
learns one cannot read the file withfetch(); it is still the
credential, and a proxy or CDN that logs paths writes it down
(CONFIGURATION.md → Streaming media).
media_capabilitiessays what the
server can do: ffmpeg or not (the slim image has none), the encoders, and
which of VA-API, Intel QSV and NVENC really work - filex finds the render
node, adds the flags and runs a half-second trial encode of each once.
media_probeanswers ffprobe's view of a file as JSON (codecs, profile,
pixel format, chroma, bit depth, rotation, field order, HDR transfer,
sound and subtitle tracks), andfile_read_atreads one range of an
input without a handle. An app names output options and filters only,
each from a fixed list (mediacmd.CheckArgs): no input, output, path or
protocol, and no filter off the list; ffmpeg's error output reaches it
with the source address scrubbed. Limits, safe on a four-core NAS: two
conversions at once, one per person, eight sessions per person, five
minutes idle, four hours at most, and a conversion restarted too often
(8 times in a row, then once every 4 seconds) is answered429
(FILEX_MEDIA_*,media:in the config
file, Admin → Settings → Plugins → Apps,0conversions = off); a
change there applies at once, with no restart, to the sessions opened
after it, and an open session keeps the idle time and the end it was told
at open. Both
permissions are read out in plain words at the install review, and an
update that adds one waits for approval. Hardware transcoding needs the
driver in an image of your own built on ours, and/dev/drimapped in:
INSTALLATION.md → GPU installation (for videos).
The player is an app's: the Video player
(BRF-Tech/filex-video 0.1.0,
released with this version) plays camera HEVC and H.264 in 4:2:2 10-bit,
ProRes, MXF, AVCHD, AVI, WMV and MPEG-2 as H.264 and AAC at 1080p, 720p
or 480p, tone-maps HDR to SDR, uses the graphics card when there is one,
and needs filex 0.63.0. Writing a player of your own:
APP-PLUGINS-API.md → Streaming media. - Uploads and transfers say how fast they go and how long is left
(#144). A row that moves
bytes - an upload, a copy or a move between two storages - reads
12.4 GB / 40 GB · 85 MB/s · ~6 min left, with the average speed and the
time it has run on hover; the operations badge and the panel's head say the
time left for everything running, the files of the same pick that have not
started included (File 3 of 5). The speed is measured over a sliding
window and smoothed, so an upload that goes 8 MB at a time does not saw up
and down; its first seconds say calculating time left…, and a transfer
that stops says stalled - never "0 B/s" or an endless time. The server's
own write of an upload into its storage, which was a bare Saving for
minutes, now counts its bytes:GET /api/files/ops/{id}carries
bytes_done/bytes_totalon a runningupload-commit(an S3 part read
twice to sign it is counted once), and the row says Saving · 40% ·
120 MB/s · ~2 min left, measured apart from the upload's own speed. The
admin panel's tray measures with the same rule
(packages/core/src/lib/transferRate.ts). App jobs, whose byte fields are
their own units, get no speed. One upload is one row: the server's commit
op no longer shows up a second time beside it (as App in the operations
center, as Copying in the admin panel's tray); a commit no row on the
page follows (another tab's upload, the desktop app's) is drawn as an
upload being saved, named by its destination (the ops listing's new
target_path), in the same words in both trays
(packages/core/src/lib/uploadOps.ts). A dropped folder tree counts as
one batch: File 7 of 40 across all its folders, and its time left counts
the folders still to come.
UPLOADS.md → commit. - A video the browser cannot play says so
(#145). A phone's HEVC
.movor a ProRes file opened in the preview as the browser's own player
with no picture, or a play button that did nothing. The preview now measures
it by playing: a decode or format error, metadata with no picture, or a play
that brings no frame within four seconds. Then it says This browser cannot
play this video and why (the codec, never the size), and offers the
download and Open with <app> for each installed app that opens the file -
the file menu's own Open with list; with no such app, the download alone.
The standalone viewer tab, the Space peek (Quick Look) and an app surface's
preview do the same. A file with sound and no video track (an.mp4of
music) is not called unplayable: it plays as sound, read from the file's
own header (packages/core/src/lib/mediaTracks.ts). A video that could not
be loaded (a 404, a server error, no connection) says This video could
not be loaded with Try again, instead of blaming its format.
Converting the video is an app's job, not the preview's.
FEATURES.md → Viewers & editors. - A shared file opens in an app's viewer right on its link page, where the
administrator allows it (task #385). Each app with a viewer has a Share
links section with one switch, Run on share links, off by default
and out of the manifest's reach (GET/PUT /api/admin/app-plugins/{id}/share-links,
a signed-in administrator, auditedapp_plugin.share_links). With it on,
/s/<token>opens a file that viewer opens - a video in a player - in the
same app frame the explorer uses, for whoever holds the link; a folder
link shows Open beside each such file, and the Download button stays.
On a link the app reads the shared file and plays it, nothing else: its
interface getssession.get,file.read,engine.callandui.title
(session.linkis true), its module runs in a share scope that reaches
reading, its settings andmedia_*only (CallContext.link), the file is
read-only and told by its place in the link. Every rule of the link holds
and is asked again while it plays: nothing before the PIN, the expiry,
the creator's own access, a folder link's members, and a revoke or a new
PIN ends what is playing at once. A link with a download limit opens the
file, each read spending one download, but does not stream it
(link_capped; the player offers the download instead), since a stream
serves the file any number of times over; setting a limit ends what is
playing, and so does replacing or rewriting the shared file. A link's
stream sessions belong to the link and the page visit, in a pool of
their own: one conversion and two module calls at once per link, at most
4 sessions per link and 32 for every link together, and links together
never more than half the server's conversions (none on a server that
runs one). The switch approves what the app's viewers open: an update
whose viewers open more is off on links until an administrator turns it
on again, removing the app clears the switch first (and removes nothing
when it cannot), and an app installed again under the same name starts
off. APP-PLUGINS.md → A viewer on share links,
SHARING.md → A file opened in an app on the link. - A graphics card for the video apps, on every install path (task #392).
One guide, GPU installation (for videos), says what a GPU is for (a
4K HEVC 10-bit file converts 4.5 times faster than real time on an Intel
UHD 770, at real time on four of its cores), which driver a GPU needs and
how to add it to an install that runs and to a new one: the image built on
ours (intel-media-driver onevpl-intel-gpu,mesa-va-gallium) with
--device /dev/dri, Compose (build:anddevices:in a file of its
own), Helm, the Linux binary (Debian, Ubuntu, Fedora and Arch packages,
the render group orSupplementaryGroups=render), the app stores, NVIDIA
(the binary with an ffmpeg that has NVENC; not the image), Windows (NVENC
measured on an RTX 4080) and macOS (not yet), and a table of what each
failure says. The Helm chart has agpublock, off by default:
gpu.enabledasks for Intel's device plugin resource
(gpu.intel.com/i915: 1, orgpu.resourcesfor another),
gpu.devicePath, the last resort after the device plugins that need no
privilege and DRA, mounts/dev/drifrom the node and runs the pod
privileged - unless yoursecurityContextsaysprivileged: false,
which is kept (the install notes then say the node cannot be opened);
gpu.renderDevicesetsFILEX_MEDIA_RENDER_DEVICE, and it and
gpu.devicePathtake only/dev/drior a path under it, without..
(anything else fails athelm template);gpu.supplementalGroupsadds
the node's render group. The install notes say whether the GPU is on,
warn when the image is still the official one, and warn when the pod is
privileged and runs as root: a code execution flaw in a media engine
would then be root on the node, and Pod Security Admission'sbaseline
andrestrictedlevels refuse the pod. filex now says in its log, once,
what its hardware test found (app-plugins: media: hardware for streams,
preferred=vaapi device=/dev/dri/renderD128 vaapi=available ...), with the reason for each
kind that is not available (on Windows and macOS: VA-API and Quick Sync
work on Linux only). The recipe that was in the configuration guide ended
withUSER filex, which turns an image that starts as root into one that
starts asfilex, so an install whose/databelongs to root could no
longer write it; it is gone.
INSTALLATION.md → GPU installation (for videos). - ffmpeg's threads are sized by the processors filex may use, and a
stream's state says when ffmpeg was killed (task #385). ffmpeg counts
the machine's cores, not the container's share: given 4 CPUs on a
20-core machine, a software decode of a 4K HEVC 4:2:2 10-bit file opened
20 frame threads, reached 1.19 GB and was killed by a 1280 MiB memory
limit, which the player read as a dropped connection. A stream's
transcode and anengine_runffmpeg now get-threads <n>before every
input whose options do not say-threads, and-filter_threads <n>and
-filter_complex_threads <n>unless the app gives them;<n>is Go's
GOMAXPROCS(which follows the container's CPU limit), 1 to 16, and an
operator lowers it with theGOMAXPROCSenvironment variable; an input
decoded on the graphics card gets at most 4, since each thread is another
surface in the card's frame pool (4K 4:2:2 HLG on VA-API: 1166 MB with 16,
535 MB with 4), and not 1, since a file the card cannot decode falls back
to the processor. Thumbnails too: a video or audio thumbnail's ffmpeg
decodes with at most 2 threads (a 4K 4:2:2 10-bit HEVC thumbnail took
535-588 MB with 16 and was killed next to a stream; about 300-450 MB with
2), and one video thumbnail runs at a time, a render that waits past its
time being left to draw later rather than marked failed.
media_stream_stategainsexit_reason(MediaStreamState.ExitReason):
killedwhen a signal filex did not send ended ffmpeg,out_of_memory
when the memory cgroup counted an out-of-memory kill meanwhile, absent
for an exit of ffmpeg's own and for filex's own stop
(APP-PLUGINS-API.md → What a transcode may say). - Single sign-on that comes back to another app (task #372).
GET /api/auth/oidc/start?return_to=<address>[&silent=1]ends the sign-in at an
address outside filex once filex's session is open - at once, without the
identity provider, when the browser is signed in already - so a portal can
pass its people through filex on the way to an app that shows filex in a
frame, and the frame opens signed in. Only origins on the new trusted
return addresses are honoured, compared parsed (scheme, host, port):
FILEX_AUTH_RETURN_ORIGINS,auth.return_origins, the Trusted return
addresses card on Admin → Identity providers (a save applies at once),
auth.returnOriginsin the Helm chart and the compose files. The address is
kept on the server with the round'sstate(the callback's query cannot
move it);silent=1asks the provider for no form (prompt=none); a round
that opens no session goes back withfilex_sso=failed, so a chain never
stops in filex. A refused address is ignored and audited
(auth.return_refused). SSO.md → Coming back to another app after SSO. - SSO inside a frame (task #371). A sign-in page shown in another app's
frame (a webmail's sidebar app, a dashboard tile) signs in with SSO in a
window of its own, since the identity provider's page cannot be framed; the
window ends on filex's "Signed in" page (/api/auth/oidc/done), tells the
frame and closes, and the frame carries on as after a password sign-in. A
blocked window is offered as a link to a new tab, and a frame on another
site that still sees no session (third-party cookies) offers filex in a tab
of its own. SSO.md → Signing in inside a frame. - Connecting an app with Allow (task #370). An app on another server - a
webmail plugin, a dashboard - sends the person to filex's sign-in page with
connect_state,connect_challenge(PKCE, S256),redirect_uri,nameand
scope; after their sign-in the same page asks Connect <app> to
filex?, Allow sends a one-time code to the app's address, and the
app's server exchanges it atPOST /api/auth/connect/exchangefor
{token, email}. The key is the person's (kinduser, sourceconnect,
theaccess.apipermission), with what the app asked trimmed to what the
person may hold, labelled with the app's name and host, and revoked on the
API keys page. Secure by default: an app connects only back to a trusted
return address (Admin → Identity providers → Trusted return addresses),
and while that list is empty no app connects at all - the page says so
(connect_not_enabled) and asks nothing. The desktop app's deep link needs
no list. INTEGRATION.md → Connecting an app with Allow. - External services: an internal address for every service, on every
surface (#143). The
draw.io and ONLYOFFICE cards have an Internal address (filex → service)
box right under the URL: the address filex's own requests go to when the
browser's is another - behind a reverse proxy that ends TLS, the
container'shttp://address. The URL stays the browser's (the frame,
api.js, the CSP, the capabilities); the health check and Test now, and
for ONLYOFFICE conversions, office thumbnails, the Test's route back and
saved-document downloads, go to the internal one. The card's server line
names the address it measured, and Test now tests the box's value without
saving it. The same setting isinternal_urlonPATCHandPOST …/test
of/api/admin/external/{name}(withinternal_urlandserver_urlon
every row ofGET) and on the admin MCP tools,external_services.<service>.internal_url
in the config file,onlyoffice.internalUrlanddrawio.internalUrlin the
Helm chart, and the two variables in the compose files.
CONFIGURATION.md → External services.
This release has more to it than fits on one page. Not shown here: Changed and Fixed. It is in CHANGELOG.md, with each security fix in full and every earlier release.
Verify: sha256sum -c checksums.txt
- Documentation - https://docs.filex.sh
- Report a bug - https://github.com/BRF-Tech/filex/issues
- Full changelog - https://github.com/BRF-Tech/filex/blob/main/CHANGELOG.md
- Every release - https://github.com/BRF-Tech/filex/releases