2990 Commits

Author SHA1 Message Date
Alexandr Stelnykovych 5c82035444 Bump version 2.2.8
+ npm audit fix
v2.2.8
2026-10-27 20:21:05 +02:00
Alexandr Stelnykovych 7dd9e195b5 fix(netquery): remove bandwidth data of deleted connections
main.bandwidth declares ON DELETE CASCADE on conn_id, but foreign keys
are never enabled on the connection, so the cascade never runs. Cleanup
deleted the connections and left their bandwidth rows behind: one row
per connection per second of traffic, kept in memory for the whole
uptime of the process.

Delete the bandwidth rows of the connections that Cleanup is about to
remove, before removing them, and index conn_id, which the bandwidth
chart joins on and the cleanup deletes through. The delete is limited
to the connections being removed, so its cost does not grow with the
rows of live connections, and a bandwidth update that arrives before
its connection is saved is left alone.

Add a test for the cleanup and the index.
2026-10-27 18:11:39 +02:00
Alexandr Stelnykovych 3f22abb1a7 fix(netquery): stop fsyncing the history database on every write
The history database is attached to the in-memory connection database
without any configuration. The OpenWAL flag of the write connection only
applies to the main (in-memory) database, so the attached file ran with
the SQLite defaults: rollback journal and synchronous=FULL, which waits
for an fsync on every commit. Bandwidth updates write to it once per
second for every connection with history enabled, all on one goroutine
and under the connection lock.

Set journal_mode=WAL and synchronous=NORMAL on the history database of
the write connection, the same settings the base sqlite storage already
uses. Set synchronous=NORMAL on every pooled read connection as well:
all connections share the pager of the history database (shared cache),
and attaching it from a reader applies the default FULL to that pager
again, silently undoing the setting of the writer.

Measured per history write (Windows, SSD): 5.3 ms before, 0.02 ms after;
the bandwidth update path 6.3 ms before, 0.03 ms after.

Add a test that checks the settings on the write and the pooled read
connections, and two benchmarks to compare the write cost.
2026-10-27 17:21:47 +02:00
Alexandr Stelnykovych cfffa7f43e fix(core): stop interception when the shutdown times out
When the shutdown did not complete within three minutes, the process
exited without stopping the interception. The kext then kept holding
every new connection for a verdict that never came, and the network
stayed dead until a reboot.

Add a shutdown-timeout hook to cmdbase and let portmaster-core use it
to stop the interception, bounded by ten seconds, before the exit.
2026-10-27 16:11:09 +02:00
Alexandr Stelnykovych 458e708f13 fix(netenv): do not block callers on the interface address refresh
IsMyIP and GetLocalNetwork held myNetworksLock while refreshMyNetworks
called the OS, and that call sometimes takes seconds. Every waiting
caller then made its own slow call once it got the lock, so the queue
of goroutines only grew and DNS stayed blocked.

The networks are now an atomic snapshot, read without a lock, and the
refresh runs through singleflight: callers that arrive during a refresh
share its result. The throttle counts from the end of the call, so slow
calls do not run back to back, and the changed flag is reset before the
call, so a change during it is not lost. Callers that arrive during a
refresh after a network change wait for the new networks.
2026-10-27 14:30:49 +02:00
Alexandr Stelnykovych cc164c7df6 spn/ships: bound HTTP ship handshake and abort it on ctx done
After the TCP connect, launchHTTPShip wrote the upgrade request and read
the response without a deadline, ignoring ctx. With keep-alive disabled,
a peer that accepts the connection but never answers blocked the caller
forever. After a sleep/resume cycle this left the SPN client stuck in
establishHomeHub: the 5 minute timeout in connectToHomeHub had no effect,
and the UI kept showing "Connecting to SPN..." until a restart.

Bound the handshake by a deadline of 30s, or the ctx deadline if that is
earlier, and close the connection when ctx is done. Both are lifted once
the handshake succeeds, so the ship's connection is unaffected.

Also close the connection on all handshake error paths, which previously
leaked it.

The new test covers a peer that accepts but never responds, for both a
ctx deadline and a ctx cancel.
2026-10-21 14:34:40 +03:00
Alexandr Stelnykovych b543aba6cf fix(resolver): ask failing DNS servers last instead of skipping them
Failing servers were skipped whenever another server in scope was not
marked, even if that server did not answer either. A wrongly marked
server, e.g. after a short stall under load, then stayed unused until the
recovery check.

Ask failing servers after all others, only if none of them answered. An
answer clears the failing state right away. In scopes that continue after
"not found" (.lan, .local, ...), failing servers are skipped once any
server answered, so their timeout does not turn "not found" into a
failure.

https://github.com/safing/portmaster/issues/1891
2026-10-21 13:49:01 +03:00
Alexandr Stelnykovych b56aba0c89 sqlite: write PutMany batches as multi-row upserts
modernc.org/sqlite re-parses the SQL text on every statement execution,
so the prepared statement in PutMany gave no benefit and parsing
accounted for about half of the time spent per record. Writing 50
records per INSERT ... ON CONFLICT DO UPDATE statement amortizes that
cost: the per-record time in BenchmarkPutManyPreparedStmt dropped from
roughly 100 µs to 50 µs on the same machine.

PutMany is used for the intel filter list import and for the resolver's
delayed cache flushes. Importing a filter list base update is now roughly
twice as fast on the database side.

Stored data is unchanged, including NULL format and value for records
without data. Duplicate keys within one statement resolve to the last
write, as before. A failed prepare now rolls the transaction back
instead of leaving it open.

The new test covers full and partial statements and re-writing existing
keys, for both the batched and the single-row PutMany path.
2026-10-19 16:46:04 +03:00
Alexandr Stelnykovych 760cd47b9f filterlists: increase bloom filter capacities and log fill level
The IPv4 filter was sized for 100 entries while the current base list
contains about 18k IPv4 addresses. The filter was fully saturated, so every
lookup of a global IPv4 address fell through to the cache database. The
domain filter was sized for 1M entries with about 843k domains in use, which
left little head room for additional intel sources.

Raise the capacities with head room for growth:
domain 1M -> 2M, ipv4 100 -> 200k, ipv6 100 -> 20k, asn 1k -> 10k,
country 100 -> 300. This adds about 2 MB of memory for the domain filter
and doubles the size of its record in the cache database.

Count the values added per entity type and log them next to the capacity
after a base list has been processed, so a list outgrowing its filter can be
spotted in the logs.

Filters restored from the cache database keep their stored size. Existing
installations pick up the new capacities with the next base list update.
2026-10-19 14:55:32 +03:00
Alexandr Stelnykovych cbab42bca3 Merge pull request #2300 from safing/fix/filterlists-base-update-cleanup
fix(filterlists): clean up obsolete entries and rebuild bloom filters on base list updates
2026-10-19 14:32:25 +03:00
Alexandr Stelnykovych 7476b19061 filterlists: add unit test for update order resolution
Pass the cache database version into resolveUpdateOrder so the ordering
logic can be tested without a database, and cover the base/diff
combinations, including a newer base skipping older diffs.
2026-10-16 18:06:44 +03:00
Alexandr Stelnykovych 84f7499359 filterlists: purge obsolete entries by update start time
The cleanup after a base update deleted entries older than "now - 1h".
If the import took longer than an hour of wall-clock time (system sleep,
slow disk), entries written by the import itself were deleted too, and
stayed unblocked until the next base update. Use the update start time,
minus a small margin for clock corrections, as the cutoff instead.
2026-10-16 17:49:33 +03:00
Alexandr Stelnykovych a47e5b0613 fix(filterlists): clean up obsolete entries on base list updates
The base/intermediate/urgent file variables used to detect the base file
and to compare versions were never assigned after the v2 updater
rewrite. As a result the "is this the base file" check never matched:
processing a new base.dsdl neither rebuilt the bloom filter from scratch
nor triggered the removal of obsolete entries. Entries that were removed
from the lists upstream stayed in the cache database and in the bloom
filter and kept blocking indefinitely, and both grew over time.

Detect the base file by filename, as the updater returns a new Artifact
instance on every GetFile call, so pointer identity could never match.
Drop the unused variables and the IsNewerThan checks: which files need
processing is already decided by comparing against the persisted cache
database version in resolveUpdateOrder.
2026-10-16 17:30:46 +03:00
Alexandr Stelnykovych e0b7d272be fix(UI; Linux): use WEBKIT_DISABLE_DMABUF_RENDERER for Wayland/NVIDIA crash workaround
Users reported that __NV_DISABLE_EXPLICIT_SYNC=1 does not prevent the
WebKitGTK "Error 71 (Protocol error)" crash on Wayland with the NVIDIA
driver. Switch to WEBKIT_DISABLE_DMABUF_RENDERER=1, which was confirmed
to fix it in #1898 and #1806.

The conditions are unchanged: only applied on a Wayland session with the
NVIDIA kernel module loaded, and an existing value in the environment is
never overridden. With this workaround the webview loses GPU acceleration
on affected systems; the log message now states this.
2026-10-15 17:08:04 +03:00
Alexandr Stelnykovych d82b33dad0 Merge pull request #2294 from safing/fix/1891-dns-failing-resolvers-nxdomain
fix(resolver): ask failing DNS servers instead of answering nothing
2026-10-15 16:43:12 +03:00
Alexandr Stelnykovych 99069f94bb fix(resolver): clear a failing DNS server when it answers the recovery check
A server is marked as failing when it does not answer: timeouts and
connection errors. The recovery check, however, only cleared the mark
when the online check domain resolved to exactly the expected IP. A
server that answers but filters or rewrites that name, for example a
blocklist, DNS rebind protection or a corporate resolver, stayed marked
until Portmaster restarted. With a working fallback configured, that
meant the LAN server and its filter were bypassed for good.

Clear the mark on any answer, whatever the answer is, which is the same
criterion normal queries already use. Timeouts and connection errors
keep the mark.

Issue: https://github.com/safing/portmaster/issues/1891
2026-10-15 16:13:42 +03:00
Alexandr Stelnykovych d268851b99 fix(resolver): ask failing DNS servers when no other server can be asked
A DNS server is marked as failing after a few timeouts and then skipped.
When every server in scope is marked, no server is asked at all and the
query is answered with NXDOMAIN, which clients cache. A server that was
wrongly marked, for example after a short stall, therefore breaks name
resolution until the next recovery check or until Portmaster restarts.

Skip failing servers only while another server can still be asked, that
is, one that is neither failing nor an unavailable link-local server.
Otherwise ask the failing servers in their configured order. A successful
answer clears the failing state right away, as it does for normal queries.

Behaviour is unchanged whenever a healthy server is available. When every
server is marked and really down, the query now fails with SERVFAIL after
the timeout instead of an instant, wrong NXDOMAIN.

Issue: https://github.com/safing/portmaster/issues/1891
2026-10-15 16:13:02 +03:00
Alexandr Stelnykovych f943e1eaf9 fix(api): remove unauthenticated updates/from-url endpoint
Issue:
The updates/from-url endpoint was registered with PermitAnyone, so any
local process could call it without authentication. Its handler passed the
request body as an index URL to UpdateFromURL, which ran the update with
the version checks and the auto-download/auto-apply settings bypassed.
Signatures were still verified, but a caller could point Portmaster at a
copy of any older signed index and have it installed without asking the
user, e.g. to bring back a version with an already fixed vulnerability.

Change:
- Remove the endpoint. It was left over from an unfinished feature and
  nothing (UI, tray app, scripts) calls it.
- Remove Updater.UpdateFromURL, which had no other callers.

ForceUpdate is unchanged: it is only used by the command line tools and
always uses the configured index URLs.

Fixes #2292
2026-10-15 13:04:44 +03:00
Alexandr Stelnykovych aea3aa4a2b linux: pass LOGLEVEL from the unit file, drop the unused PORTMASTER_ARGS
The unit file set LOGLEVEL=info and sourced /etc/default/portmaster, but
never passed the value to portmaster-core. Pass it as --log=${LOGLEVEL}.

An invalid level used to make ServiceConfig.Init fail, which would now turn
a mistyped LOGLEVEL into a service that does not start. Warn and fall back
to the default level instead, as the logger already does on its own.

PORTMASTER_ARGS was appended after "--", where cobra stops parsing flags and
the core ignores the rest, so it has had no effect since the v1 wrapper was
removed. Drop it, and replace the UI README instruction that relied on it
with the equivalent setting (Development Mode).
2026-10-15 12:54:54 +03:00
Alexandr Stelnykovych df9dffe118 Merge pull request #2293 from safing/fix/2233-Linux-process-lookup-overload
Linux: fix memory growth and verdict timeouts under many connections per socket
2026-10-15 12:10:02 +03:00
Alexandr Stelnykovych 42366c0d59 fix(linux): cache socket owners, scan /proc once per socket at a time
Issue:
Finding the process of a socket walks /proc/<pid>/fd of every process of the
user. The result was stored on the socket-table entry, which is replaced on
every table refresh (up to 100 per second), so every new connection of a
long-lived socket - a torrent's DHT socket, a listening socket, a resolver -
triggered a full scan. Under a burst, thousands of scans ran at once and
slowed each other down until packets timed out while their lookup was still
running; the connections with a lookup in flight were the memory growth
reported in #2233.

Change:
- Cache the found owner by socket inode for 1-2 s (two generations, lazy
  rotation, bounded size). A cache hit is only used if the PID is still in
  the user's PID list, so an exited owner is scanned for again.
- Run at most one scan per socket at a time (singleflight). Lookups that
  arrive while a scan runs wait for its result instead of scanning too.
  Without this the first scan under a burst never finished.
2026-10-14 17:51:18 +03:00
Alexandr Stelnykovych df06892918 firewall (Linux): skip packets that already have a verdict, drop packets that cannot be queued
Packets that received a verdict while waiting in a queue (the default-drop
after the 20 s verdict timeout) cannot be influenced anymore. Handling them
only created connections, handler workers and "verdict already set" noise,
which made a backlog grow instead of drain.

- packet.Packet gains VerdictSet(). nfqueue and both Windows kext packet
  types report their verdict flag; the base type reports false.
- The dispatcher and the per-connection handler skip packets whose verdict
  is already set.
- nfqueue: a packet that could not be handed to the handler queue within
  1 s will never get a verdict. Drop it right away instead of starting a
  watchdog and keeping it in the kernel queue for 20 s.

This reduces wasted work and log noise under load.

Refs #2233
2026-10-14 15:25:07 +03:00
Alexandr Stelnykovych bb6c44468a fix(geoip): reload the database when the updater replaced its file
The geoip reader memory-maps geoipv4/v6.mmdb once and only reopened
them on a new artifact version. The intel updater moves every file in
the intel directory on every update, even when unchanged, and the next
update renames the new copy over the moved one.

On Windows a mapped file without open handles cannot be deleted but can
be replaced by such a rename, after which the mapping has no backing
data: evicted pages come back zero-filled, maxminddb fails with
"invalid node in search tree", and geo rules block with "data not
available". Since the switch to Go 1.26 in v2.2.2 os.RemoveAll no
longer unlinks the mapped file on the first update, which is what kept
earlier releases safe.

- Detect a replaced file by its identity (file ID or inode, size and
  mtime), taken from an open handle since os.Stat resolves the Windows
  file ID lazily, and reload.
- Do not close the previous reader on reload; a lookup may still use
  it. The finalizer set by maxminddb.Open unmaps it later.
- Buffer the worker trigger so an update event during a load is not
  dropped, and do not hold the broadcaster lock during file access.

https://github.com/safing/portmaster/issues/2265
2026-10-12 18:29:31 +03:00
Alexandr Stelnykovych 882d900dad Merge pull request #2285 from safing/fix/2217-2104-windows-kext-fixes
fix(kext): Windows kext 2.1.2: CLOSE handling, shutdown pends, endpoint reuse, panic bug check
2026-10-06 12:48:20 +03:00
Alexandr Stelnykovych 1d96934428 chore(kext): bump version to 2.1.2
Includes:
- handle IRP_MJ_CLOSE in the driver to keep WDF's handle count intact
- do not pend connections after the shutdown command
- do not let a reused local endpoint inherit the previous verdict
- stop with a dedicated bug check on a driver panic
2026-10-05 21:10:22 +03:00
Alexandr Stelnykovych c0a6ba6831 fix(kext): stop with a dedicated bug check on a driver panic
The panic handler logged the panic and entered an endless loop. A panic
inside a callout then pinned that CPU at DISPATCH_LEVEL until the system
crashed minutes later with DPC_WATCHDOG_VIOLATION, attributed to a
generic timeout instead of the driver. The log call also allocated,
which can panic again when the original panic was a failed allocation.

Stop the system immediately with KeBugCheckEx instead, using code
0x504D7273 ("PMrs", the pool tag). The parameters carry the source file
(pointer and length, `da <P1> L<P2>`), the line number, and the panic
message formatted into a NUL-terminated stack buffer (`da <P4>`), so a
crash dump names the panic location and keeps runtime-only details such
as the size of a failed allocation. Nothing on this path allocates, and
a guard skips the formatting when it panics itself or when several CPUs
panic at once, reporting the location alone in that case.

Related ticket: #2284
2026-10-05 18:04:07 +03:00
Alexandr Stelnykovych 381262b9d0 fix(kext): do not let a reused local endpoint inherit the previous verdict
The ALE authorization lookup matched cache entries by 5-tuple only. A new
socket reusing the local port and remote endpoint of a closed connection
(matchable for up to ~90 seconds until the entry is purged), or replying
to a flow first seen by the packet layer (recorded with process id 0),
inherited the previous verdict and was attributed to the previous owner's
process id in all events.

The lookup now drops a matching entry that has ended, or that has no
process id while the requester's is known, and requests a fresh verdict
for the new flow instead. Live entries are still shared regardless of the
owning process: processes can legitimately share a 5-tuple (for example
multicast senders on a port opened with SO_REUSEADDR), and evicting a
live entry would make the owners evict each other on every
re-authorization, each eviction triggering yet another verdict request.

Related ticket: #2271
2026-10-05 16:30:23 +03:00
Alexandr Stelnykovych 41a53f200c fix(kext): do not pend connections after the shutdown command
Related ticket: #2104

After Portmaster sends the shutdown command it stops reading events, but
the callouts stay registered until the driver is unloaded, up to the
10 second service stop timeout. The shutdown command resolves the
operations pended at that moment, but a connection classified
afterwards was pended again with nobody left to answer. A pended
operation cannot be cancelled by the owning process, so the process
could not exit. For Portmaster's own DNS dials this left
portmaster-core as an unkillable zombie and the Windows service in
"Stopping" until reboot.

Set a shutting_down flag in shutdown(). While it is set, new and
undecided connections in the ALE layer are permitted instead of pended,
and the packet layer permits instead of absorbing packets that wait for
a verdict. Permit matches the state after the unload that follows.
Verdicts that need no user space are unchanged.

Device::drop now also runs shutdown() so that an unload without a
preceding shutdown command resolves outstanding pends instead of leaking
them.
2026-10-05 11:33:28 +03:00
Alexandr Stelnykovych a370253026 fix(kext): handle IRP_MJ_CLOSE in the driver to keep WDF's handle count intact
Related ticket: #2271

Since 2.1.0 the driver overrides the IRP_MJ_CREATE and IRP_MJ_CLEANUP
dispatch entries of the WDF control device to record the PID of the
connected user-space process. IRP_MJ_CLOSE stayed with WDF. WDF counts
open handles on CREATE and CLOSE and destroys the control device when
the count drops to zero. With CREATE never reaching WDF, the first CLOSE
underflowed the count, WDF destroyed its device object, and the next
request routed through WDF, in practice the CLOSE of a second handle,
dereferenced the cleared device extension: BugCheck 0x50 in
Wdf01000!FxDevice::DispatchWithLock.

Stock Portmaster opens a single handle per driver lifetime and did not
crash, but any second opener (a second core instance, a diagnostic tool,
a custom client) took the machine down on close.

Take over IRP_MJ_CLOSE as well, with a handler that only completes the
request. CREATE, CLEANUP and CLOSE are now all handled by the driver, so
WDF's count stays untouched until unload, as it was before 2.1.0.
2026-10-02 18:20:16 +03:00
Alexandr Stelnykovych 13a86a43cc fix(nameserver; resolver): bound the wait for in-flight DNS requests on shutdown
Related ticket: #2104

On shutdown the NameServer module stopped its listeners with
dns.Server.Shutdown, which waits without limit for all in-flight request
handlers to return. A handler can be stuck in an upstream connect that the
kernel never completes: a connection pended by a firewall driver cannot be
cancelled. In #2104 the pending driver was our own kext, because the
Interception module stops before Resolver and NameServer, so DoT dials
issued in that window had nobody left to answer their verdict. The module
Stop() has no time bound, so the whole shutdown stalled and the Windows
service stayed in "Stopping" until reboot.

- nameserver: stop listeners with ShutdownContext and a 10 second
  timeout. Reading from the listener socket stops immediately; only the
  wait for running handlers is bounded. Handlers still running
  afterwards are cancelled and waited for by the module manager as
  before.
- resolver: do not dial a new upstream connection once the instance
  has started shutting down. The instance context is cancelled before
  any module stops, so this closes the window in which a dial could be
  pended after interception is gone. Existing pooled connections are
  still used. The resolver instance interface gains ShuttingDown() for
  this.

The kext-side part (do not pend new connections after the Shutdown
command) is a separate change that needs a signed driver release.
2026-10-02 17:43:59 +03:00
Alexandr Stelnykovych b6a78eeaae Merge pull request #2281 from safing/fix/2255-2185-(Windows)-Tauri-UI-crash
fix(UI; Windows): patched tao with atomic refcount fixes random UI crash (0xc000001d)
2026-10-02 15:14:35 +03:00
Alexandr Stelnykovych 8b8167c1cf Merge pull request #2278 from safing/fix/1834-open-data-dir
feat(UI): implement "Open Data Directory" in the Tauri app
2026-10-02 15:13:22 +03:00
Alexandr Stelnykovych b61887ba77 Merge pull request #2272 from safing/fix/2066-dns-local-bind
fix(resolver): bind local port before pre-authenticating it (#2066)
2026-10-02 15:11:29 +03:00
Alexandr Stelnykovych 702ef660fa Merge pull request #2279 from safing/fix/2233-1870-LINUX-high-mem-usage-on-conns-burst
fix(network; Linux): fix high memory usage on connection bursts
2026-10-02 15:10:03 +03:00
Alexandr Stelnykovych 6a167b33d5 fix(network; Linux): drop both hint generations when taking a pid hint
SavePIDHint() always writes into the current generation and never checks
the previous one. When the same connection reports an info-only packet
before and after a rotation, both generations hold an entry for its ID.

takePIDHint() removed only the entry it returned. A later take for the
same connection ID then found the older entry in the previous generation
and returned a stale pid instead of a miss.

Delete the connection ID from the previous generation as well when the
current one is consumed. Add a regression test that saves a hint, rotates,
saves a newer hint for the same connection and checks that the second take
is a miss.
2026-10-02 15:07:43 +03:00
Alexandr Stelnykovych ccd6c1982c fix(UI): set the webview marker env var on Windows only
PORTMASTER_UI_WEBVIEW_PROCESS lets portmaster-core tell the WebView child
processes apart from other children of the UI process. The core evaluates
it only on Windows, and Windows is the only platform where changing the
process environment at runtime is thread-safe; other threads are already
running when windows are created. Make the set/remove calls no-ops on
other platforms and document it.
2026-10-02 14:46:54 +03:00
Alexandr Stelnykovych d158aabdda fix(UI; Windows): use patched tao with atomic event-loop refcount to stop random UI crashes
Tauri clones its runtime context from background threads. On Windows the
context holds tao's event-loop runner behind a non-atomic Rc, so concurrent
clones lose updates, the runner is freed while in use and the process aborts
with 0xc000001d or 0xc0000374. Pin tao 0.32.8 from
safing/portmaster-tauri-tao-patch (Rc -> Arc for that count), add a
compile-time guard so the patch cannot be dropped silently by a dependency
bump, and a debug-only stress test (--verify-tao-patch) that reproduces the
crash on an unpatched tao.

Fixes #2185, #2255
2026-10-02 14:03:36 +03:00
Alexandr Stelnykovych 21a2b0647f fix(packaging; Linux): use project-local Angular CLI in build_tauri.sh
The dev helper ran whichever `ng` came first on PATH. On Debian/Ubuntu
systems with the `ng-common` package installed, that is a text editor,
so answering "Y" to the Angular build prompt opened an editor instead
of building tauri-builtin.

Use desktop/angular/node_modules/.bin/ng instead, so the CLI version
always matches package.json, and fail with a clear hint to run
`npm install` when it is missing.

The Earthfile build does not use this script and is unaffected.
2026-10-01 13:11:34 +03:00
Alexandr Stelnykovych 989175aab4 feat(UI): implement "Open Data Directory" in the Tauri app
Related ticket: #1834

The Tauri integration never implemented the action: the install dir
lookup rejected with "not yet supported", the rejection was unhandled,
and the shell plugin would not open local paths from JS anyway. The app
also cannot know the data directory from its arguments, as --data is not
passed on Windows and points to the v1 location on Linux.

Add a read-only core/paths endpoint to the core API (bin, data and log
directories) and an open_dir command in the Tauri app that takes a
directory kind (bin, data, logs), queries the endpoint and opens the
directory natively: ShellExecuteW with the default verb on Windows,
which honors a third-party file manager registered for folders, and
the open crate elsewhere. No path is accepted from the webview, and
further "open directory" actions only need UI changes.
2026-10-01 13:06:55 +03:00
Alexandr Stelnykovych 3356bb94b6 fix(profile): do not block on geo rules that cannot be evaluated
When the geoip lookup for an IP fails, ASN, country and continent rules
returned MatchError, which the firewall treats as a deny. This blocked
connections even for allow rules and for rules whose protocol or port
did not apply to the connection, for example a global
"+ AS32590 UDP/27015-27250" rule blocking TCP/443 connections of an app
with default action "allow". The reported reason
"allowed by rule: ASN data not available to match" was contradictory.

Rules that cannot be evaluated because of missing data now behave as
follows:
- if the rule's protocol or port do not match the connection, the rule
  is skipped, as it could never apply
- an allow rule is skipped, so the following rules and the default
  action decide
- a deny rule still returns MatchError and fails safe

Related ticket: #2138
2026-09-30 18:31:51 +03:00
Alexandr Stelnykovych 04addb839d chore(tauri): fix clippy lints 2026-09-30 16:18:32 +03:00
Alexandr Stelnykovych 9ebd6c73cc fix(UI): keep rule list selection in sync with the rendered checkboxes
Related ticket: #2164

The rule list kept the selection as indexes while each item kept its own
checkbox state. Editing a selected rule recreated its row unchecked (the
rows are tracked by value), but the "N rules selected" counter still
included it, and the indexes were never adjusted after a delete or
reorder, so "Remove Rules" could delete the wrong entries.

Bind the checkbox state to the list's selection, clear the selection
whenever rows are removed, moved or replaced, and keep it when a rule is
edited in place. The settings view writes the same rules back as a new
array after every save, so writeValue only clears the selection when the
rules actually changed.
2026-09-30 15:50:57 +03:00
Alexandr Stelnykovych 9abe32790d fix(UI): use the OS theme for the tray icon when icon theme is "System"
Tickets: #2222, #2151

The tray icon code returned the stored "System" value (Unspecified)
without ever detecting the actual OS theme, so it always used the
dark-theme icon variant. Detect the OS theme in that case, as the
window icon already did, and reuse the helper for the window icon
instead of duplicating the logic.
2026-09-30 14:56:47 +03:00
Alexandr Stelnykovych 74b16e2bab fix(UI): leave the app page reliably after a profile re-key
When fingerprints change, the backend re-keys the profile: it saves it
under a new ID and deletes the old record. The previous check ran after
the dialog's close animation and only worked if the deletion had already
arrived by then.

Leave the page when the profile watch stream completes (the record was
deleted), and show the "Profile ID Changed" hint when the last update
before the deletion changed the fingerprints.
2026-09-30 14:13:58 +03:00
Alexandr Stelnykovych 01b566a708 fix(UI): edit a copy of the profile in the app profile dialog
Related tickets: #2165, #2264

The "Edit App Profile" dialog worked on the profile object shared with
the app page (the cached watch stream replays the same instance), so
adding or removing a process-matching rule took effect immediately.
"Cancel" did not revert it, and the app page persisted the modified
object on the next settings change.

Clone the profile when the dialog loads it, so edits stay local until
"Save" is pressed.
2026-09-30 13:19:05 +03:00
Alexandr Stelnykovych b46db6e793 fix(profile): handle failed profile lookups without leaving connections unverdicted
Related ticket: #2275 (and potentially #2253)

A failed profile lookup (e.g. a database query timeout) could leave a
process without a usable profile. Depending on the path, this either
crashed the connection handler with a nil pointer dereference or left
the connection waiting for a profile that was never looked up again.
In both cases the connection never received a verdict. On Windows the
kext then holds the pended connection and the process cannot exit.

- profile: on a failed layer update, keep the previous local profile
  instead of setting it to nil. The layer stays outdated and the update
  is retried on the next connection.
- profile: wrap the iterator error instead of the stale outer variable,
  so the real cause is logged instead of "%!w(<nil>)".
- database/iterator: store the error before closing the channels, so a
  consumer calling Err() right after the range loop always sees it.
  Otherwise a failed profile query could be mistaken for "no match" and
  create a duplicate profile.
- network: do not wait for a profile when gathering connection info.
  The lookup runs once per connection and is not retried, so a
  connection without profile is now denied ("unknown process or
  profile"), same as DNS requests already were.
- network: guard the local profile dereference in the domain lookup.
- process: return the profile lookup error from GetProcessWithProfile
  alongside the process, so API handlers fail with an error instead of
  panicking on a nil profile.
- network: skip connections without profile in the debug data export.
2026-09-29 18:19:33 +03:00
Alexandr Stelnykovych 0751f0bbd2 fix(UI; Linux): workaround for UI crash on Wayland with NVIDIA driver
On a Wayland session with the NVIDIA driver the Tauri UI exits right after
the main window is created with "Error 71 (Protocol error) dispatching to
Wayland display". WebKitGTK and NVIDIA's Wayland explicit-sync
implementation do not work together; the issue is upstream and unfixed.

Set __NV_DISABLE_EXPLICIT_SYNC=1 at the start of main(), before any
GTK/WebKit initialisation, so the NVIDIA driver falls back to implicit
sync for the UI process. Hardware acceleration is kept, so there is no
performance cost. The variable is applied only when the session is
Wayland, the NVIDIA kernel module is loaded and the variable is not
already present in the environment, so users can override it without a
rebuild.

The workaround lives in its own module (linux_graphics_workarounds.rs)
with the alternatives documented, so it can be switched or removed once
the upstream fix lands.

Refs: #1898, #2021
https://bugs.webkit.org/show_bug.cgi?id=280210
https://v2.tauri.app/develop/debug/linux-graphics/
2026-09-29 14:39:28 +03:00
Alexandr Stelnykovych ea22ae8bf7 Comment 2026-09-28 15:52:18 +03:00
Alexandr Stelnykovych 9bf9d2fa75 Merge pull request #2266 from JacksonBarker/development
Bind UDP splittun proxy to correct loopback address on Linux
2026-09-28 15:38:56 +03:00
Alexandr Stelnykovych 48875f0afa fix(netenv): release unused pre-authenticated port of portal check (#2066)
The online status check dials its HTTP request from a pre-authenticated
local port. When the request failed before a packet was sent, the
pre-authentication stayed in place and would permit the next outbound
connection from that port, whichever process made it.

Release the port when the request fails, and mark it unusable for port
selection when it could not be bound.
2026-09-25 17:21:43 +03:00