Commit Graph
3394 Commits
Author SHA1 Message Date
Theodor S. Midtlien 9637cb37e5 Recover from dup active profiles that cannot be resolved with username. 2026-09-16 16:00:25 +02:00
Theodor Midtlienandcubic-dev-ai[bot] 9d991e9e43 Update client/internal/profilemanager/service.go
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-09-16 16:00:25 +02:00
Theodor S. Midtlien bc8f50dbda Move known check to inside stamp owner 2026-09-16 16:00:25 +02:00
Theodor S. Midtlien 9854108c86 Fix config concurrent reload during OwnsProfile check 2026-09-16 16:00:25 +02:00
Theodor S. Midtlien f851942ab4 Fix OwnsProfile fallback to active profile 2026-09-16 16:00:25 +02:00
Theodor S. Midtlien baa4f0537c Fix stale server config after stamp 2026-09-16 16:00:25 +02:00
Theodor S. Midtlien 716cb79f8f Use restricted write for config json 2026-09-16 16:00:25 +02:00
Theodor S. Midtlien 2748291525 Only default profile fail open 2026-09-16 16:00:25 +02:00
Theodor S. Midtlien db459b38ec Add one-shot migration 2026-09-16 16:00:25 +02:00
Theodor S. Midtlien fe97bd5b4e Add profile stamping as active migration 2026-09-16 16:00:25 +02:00
Theodor S. Midtlien 1ac303c77e Fix status and list profiles 2026-09-16 16:00:25 +02:00
Theodor S. Midtlien c7451e39ad (WIP) Migrate active_profile 2026-09-16 16:00:25 +02:00
Theodor S. Midtlien a56d40be3c (WIP) List profiles based on ownership by Identity 2026-09-16 16:00:25 +02:00
Theodor S. Midtlien 80b919e854 Implement OwnsProfile on Server 2026-09-16 16:00:25 +02:00
Viktor Liu 15ed6f8f15 Add an optional --allow-group flag restricting the daemon sockets (#7478) 2026-09-16 13:30:10 +02:00
Theodor Midtlienandcubic-dev-ai[bot] abb94ad2d2 Update client/internal/debug/debug.go
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 258a20c433 Fix empty active state read 2026-09-16 10:37:59 +02:00
Theodor Midtlienandcubic-dev-ai[bot] fa3689c079 Update client/internal/debug/debug.go
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 331c490326 Fix typo 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 2d5ee900d0 Replace RequireFlowInitiator with AuthzLevel and clear flow on switch profile 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 7705645492 Remove double error log 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 1538d5f11c Add profile owners to debug bundle 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 5f7d869426 Fix status and list profiles 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 45e8bd8af4 Let unimplemented RequireFlowInitiator pass 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien b620173f51 Clarify the Rule comment 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien a585626950 Remove Authorization context and fix bugs in rule and targetProfile 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien fc93bfc561 Add method interceptor tests to ensure that authz is configured for every RPC 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien bbf28a40ed Add authorization framework for gRPC methods 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien cacdb50c0e Add known mark to identity, fix credentials comparison bugs 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 15003fc495 Add owners to list profile ipc 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien a9fb48d80b Let active profile owner be the source of truth for the session holder 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 3a2f6df038 Fix debug test 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 04c00a9a19 Improve owner config parsing 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien abc77e6d92 Use list of owners 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 3ee80d99bf Fix wasm build 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 723deda478 Add nolint for unused functions 2026-09-16 10:37:59 +02:00
Theodor S. Midtlien 45b30ef83d Fix ServiceManager.AddProfile signature 2026-09-16 10:37:58 +02:00
Theodor S. Midtlien 77cfc4ac4c Refactor gatePolicy to gateRule 2026-09-16 10:37:32 +02:00
Theodor S. Midtlien 126f3a640b Use sessionholder pointer 2026-09-16 10:37:32 +02:00
Theodor S. Midtlien 6a983eee34 Add WIP profile ownership 2026-09-16 10:37:31 +02:00
Theodor S. Midtlien f4f47db14c WIP: add session ownership 2026-09-16 10:36:43 +02:00
Maycon Santos eab510178a [misc] Load AGENTS.md every session and refuse attribution trailers (#7544)
AGENTS.md forbids attribution trailers, but a rule an agent has to go and read loses to the instruction it is handed every turn. CLAUDE.md now imports AGENTS.md so it is always in context; a commit-msg hook (via make setup-hooks) refuses the trailers at commit time; a CodeRabbit pre-merge check flags a PR whose description or commits carry them. The check reports rather than blocks, since the repository keeps CodeRabbit's request-changes workflow off; turning that on is a separate, repository-wide decision.
2026-09-15 22:48:49 +02:00
Riccardo Manfrin 08699a9e29 [client] Enforce HTTPS on install script downloads (#7545)
Every curl invocation in the install script that follows redirects now passes
`--proto` and `--proto-redir` set to https only, so neither the initial request
nor any hop in the redirect chain can drop to plaintext. This matters most for
the macOS .pkg download, whose URL is itself the result of a redirect
resolution, and for the release tarballs that get moved into the install dir as
root.

The protocol set lives in a single `PROTO_HTTPS` variable rather than being
repeated at each call site, and every expansion is quoted — the variable holds
one option value, not a list of flags.

The two call sites without `-L` (the release metadata lookups) are left alone:
they do not follow redirects and their URLs are https literals.

Verified against every URL the script fetches on curl 7.29.0 (CentOS 7),
7.68.0, 7.76.1, 7.88.1 and 8.14.1; both options have existed since curl 7.20.0.
Plaintext http:// is refused on all of them.
2026-09-15 14:20:15 +02:00
Zoltan Papp e70ec07320 Read the session deadline under the status read lock (#7550)
GetSessionExpiresAt took the exclusive lock for a plain field read, so
every caller queued behind writers and behind each other. The Android
SessionMonitor polls it from the main thread, and in the captured ANR
that is exactly where the main thread was blocked while hundreds of
peer-list callbacks held or waited on the same mutex.

d.mux is already an RWMutex and the other getters use RLock; this brings
the deadline read in line with them.
2026-09-15 12:05:57 +02:00
Riccardo Manfrin 58b5263c1a [client] Stage install script downloads in a private temp directory (#7534)
The install script downloaded both the macOS .pkg and the release tarballs
into /tmp under fixed, predictable names, then passed those same paths to the
privileged install steps (`installer -pkg`, `mv` into the install dir).

/tmp is shared, so those fixed names can collide with entries created there
beforehand, and the privileged steps consume whatever the path resolves to.

Stage every download in a directory from `mktemp -d` instead: unpredictable
name, mode 0700, owned by the caller, created atomically. Extraction now
targets that directory (`tar -C`, `unzip -d`) rather than relying on `cd /tmp`,
and an EXIT trap removes it, so a failed run no longer leaves the archive and
the unpacked LICENSE/README behind in /tmp either.
2026-09-15 10:30:33 +02:00
Maycon Santos f29249e7ef [management] Point the agent-config e2e providers at the mock upstream (#7542)
TestAgentConfigAllowlistOfDeclaredModels still pointed its providers at api.openai.com and bedrock-runtime with a dummy key, so every save has been refused with "the provider rejected the credential" and the Agent Network E2E has been red on main since — both subtests, every scheduled run.

Every other suite already uses the mock vLLM upstream (harness.StartVLLM), which answers both the OpenAI (/v1/models) and the Bedrock (/inference-profiles) listing; this test does the same. What it checks — the allowlist advertising the provider's declared ids on GET /api/agent-network/agent-config — never depended on the vendor.
2026-09-15 09:40:52 +02:00
Maycon Santos 7ce6a63dcb [management] Validate the proxy cluster an agent network bootstraps onto (#7402)
The agent network gateway service is private: agents reach it over the WireGuard tunnel, authorised by peer identity, with the cluster as its only target. Only a reverse proxy cluster with private capabilities can serve that, reported per cluster as the `private` capability — the same `supports_private` flag the dashboard gates NetBird-only services on.

A bootstrap could pin an account to a cluster without private capabilities, leaving an immutable dead gateway. Both bootstrap paths now validate the picked cluster: one the account can see must have a connected proxy reporting the capability. Shared and account-owned clusters qualify alike. Known-ness comes from proxy rows, not heartbeat freshness, so a cluster without the capability stays refused while merely offline. A hostname no proxy has declared stays pinnable (address-first). Identity is compared case-insensitively over the account's cluster list.
2026-09-15 08:42:21 +02:00
Maycon Santos ea294e1d46 [management] Refuse to pin an agent network gateway onto another account's host (#7519)
An agent network bootstrap stores its cluster as proxy_address, which selects the proxy that serves the endpoint. An account-scoped proxy only receives its own account's mappings, so a pin onto a host another account's proxy declares can never be served, and the endpoint is immutable — a dead gateway until the account deletes its settings. Nothing refused that pin; the domain unique index only arbitrates between endpoints.

Both bootstrap paths now refuse, before the insert, a host that another account's proxy declares, a host another account has labeled pins beneath (self-addressed path), or a hostname that is another account's endpoint (labeled path).

Shared clusters are unaffected: shared proxies are never foreign, and labeled pins under one cluster are never asked about, so any number of accounts still pin beneath eu.proxy.netbird.io. Registration is deliberately unchanged — refusing a proxy for another account's pin would let a pin lock a tenant out after the reaper drops its rows.
2026-09-14 22:20:25 +02:00
Maycon Santos ea216f8e73 [management] Speed up test store setup and summarize the unit test run (#7518)
Management / Unit (amd64, mysql) hit the 20 minute go test budget on #7516. The package was not hung: each of the 133 test store creations in management/server paid about 1.6s on MySQL for CREATE DATABASE, the pre-migrations, a 40-table AutoMigrate and the post-migrations, which puts the package at 10 minutes on a healthy runner and over the budget on a slow one.

The migration now runs once per test binary into a template database and each test database is cloned from it, with CREATE DATABASE ... TEMPLATE on Postgres and a replay of SHOW CREATE TABLE on MySQL. The MySQL test container also drops the binary log, doublewrite buffer and per-commit redo fsync. Two goroutine leaks in the test helpers are fixed.

tools/gotestsummary turns the go test -json stream into a readable log, and the Management unit and integration jobs now pipe through it, so a timeout names the tests still running. On MySQL, management/server went from 10m16s to 6m36s.
2026-09-14 19:42:02 +02:00
Viktor Liu a54d96cd72 [proxy] Make the upstream HTTP version configurable (#7410) v0.79.0-rc.1 2026-09-14 17:28:01 +02:00