Add device agent enrollment and ITAM backend#1197
Conversation
54badd9 to
0361fab
Compare
There was a problem hiding this comment.
All reported issues were addressed across 89 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 32 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 13 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 30 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
3779416 to
3254a56
Compare
There was a problem hiding this comment.
All reported issues were addressed across 15 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
d967f91 to
d9da46c
Compare
|
@cubic-dev-ai review the PR again |
@lukkor I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 133 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="pkg/deviceagent/client.go">
<violation number="1" location="pkg/deviceagent/client.go:148">
P1: Enrollment tokens can be sent to loopback/private or attacker-controlled `--server` targets because this new exchange request uses a client without SSRF protection. Construct this client with `httpclient.WithSSRFProtection()` (and inject a loopback-allowed client only in tests) before sending the token.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 15 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
33f919c to
1d9db97
Compare
|
@cubic-dev-ai review the PR again |
@lukkor I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
6 issues found across 151 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="pkg/deviceagent/tray/tray_supported.go">
<violation number="1" location="pkg/deviceagent/tray/tray_supported.go:35">
P3: `ServerURL` defaulting has no effect because the supported tray implementation never consumes it. Remove this dead assignment, or use the value in the intended enrollment flow.</violation>
</file>
<file name="pkg/itam/gc.go">
<violation number="1" location="pkg/itam/gc.go:75">
P2: A custom `worker.WithInterval` does not control this collector's cadence: after its first run, `Claim` still suppresses work for five minutes. Store and use the configured GC interval here, or remove this second interval gate and let `worker.Worker` schedule polling.</violation>
</file>
<file name="pkg/server/api/agent/v1/types/models.go">
<violation number="1" location="pkg/server/api/agent/v1/types/models.go:45">
P2: `uptime_seconds` is accepted but discarded before `RecordHeartbeat`, so agents cannot persist or expose the uptime they send. Add it through the ITAM request/persistence flow, or remove it from this public payload until supported.</violation>
</file>
<file name="pkg/deviceagent/tray/autostart_darwin.go">
<violation number="1" location="pkg/deviceagent/tray/autostart_darwin.go:40">
P2: A later login by any local account starts this tray helper, while uninstall stops only the current GUI account. Store this per interactive user (or deliberately unload every affected GUI domain) so enrollment and removal have matching scope.</violation>
</file>
<file name="cmd/probo-agent/main.go">
<violation number="1" location="cmd/probo-agent/main.go:129">
P2: Concurrent enrollment-link launches can race past this check and corrupt shared enrollment state; one installer may overwrite `agent.key` after the other has configured the device. Serialize enrollment with an atomic lock/reservation held by the elevated install path.</violation>
</file>
<file name="pkg/deviceagent/tray/console_user_windows_test.go">
<violation number="1" location="pkg/deviceagent/tray/console_user_windows_test.go:131">
P2: `TestInteractiveSessionCandidates_OrderAndDedup` depends on real Windows session state and will flake on headless systems where no interactive, active, or connected sessions exist. Consider mocking `interactiveSessionCandidates` or restructuring the test to accept an empty result gracefully, for example asserting on ordering/dedup only when candidates are non-empty rather than requiring non-empty.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| func Run(opts Options) error { | ||
| if opts.ServerURL == "" { | ||
| opts.ServerURL = deviceagent.DefaultServerURL |
There was a problem hiding this comment.
P3: ServerURL defaulting has no effect because the supported tray implementation never consumes it. Remove this dead assignment, or use the value in the intended enrollment flow.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At pkg/deviceagent/tray/tray_supported.go, line 35:
<comment>`ServerURL` defaulting has no effect because the supported tray implementation never consumes it. Remove this dead assignment, or use the value in the intended enrollment flow.</comment>
<file context>
@@ -0,0 +1,129 @@
+
+func Run(opts Options) error {
+ if opts.ServerURL == "" {
+ opts.ServerURL = deviceagent.DefaultServerURL
+ }
+
</file context>
Introduce device, posture, and enrollment-token entities with ITAM service policies for agent-managed fleet inventory. Signed-off-by: Ludovic Vielle <ludovic@probo.com>
Expose ITAM REST endpoints for agents, console GraphQL for device management, and wire probod bootstrap with enrollment e2e coverage. Signed-off-by: Ludovic Vielle <ludovic@probo.com>
Provide enrollment, elevated install, posture checks, keystore, and system-tray helpers shared by the probo-agent binary. Signed-off-by: Ludovic Vielle <ludovic@probo.com>
Ship the desktop agent with curl-to-sh and macOS PKG installers, probo:// URL handler bundling, tray autostart, and release workflows. Signed-off-by: Ludovic Vielle <ludovic@probo.com>
Add org admin device management, employee self-service enrollment, posture views, and owner assignment across console routes. Signed-off-by: Ludovic Vielle <ludovic@probo.com>
Populate varied device posture states in seed data and link the probo-agent release guide from AGENTS.md. Signed-off-by: Ludovic Vielle <ludovic@probo.com>
Summary by cubic
Adds device agent enrollment with one‑time tokens, full device inventory and posture in the console, and native macOS/Windows tray helpers. Includes a curl‑to‑sh installer, probo:// deep‑link enrollment, a secure owner model, and safer server URL and secret handling.
Tests
+1447-0Coredata
+1802-0Service
+596-86enroll-urlhandler./var/run(0600), robust IsEnrolled checks; tray uses--run-dir.*.probo.com, reject fragments/port‑only); elevated install forwards--dir.hash.HashBearerCredential; race fixes map zero‑row updates to 401; expanded Windows command paths.App: console
+3063-3/enrollwizard with org picker and deep‑link; derives--serverfrom runtime config or current origin.itam:device:list.Package: ui
+17-2Select.Optionsupports custom classes and data‑highlight styles.DialogaddsonOpenChangehooks.Agents
+252-7Other
+1469-44cmd/probo-agentinstaller (install.sh) for Darwin/Linux/FreeBSD; CI lints with shellcheck and injects release checksums.GNUmakefilefor local agent install.PROBOD_ITAM_DEVICE_ENROLLMENT_TOKEN_VALIDITY; bootstrap reads it.go.modaddsfyne.io/systrayand promotesgolang.org/x/sys.Written for commit 8922608. Summary will update on new commits.