mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
feat: Add cloud sync event emit (#212)
* feat: Add cloud sync event emit * fix: Linter fixes * fix: Include malysis metadata in confirmed event * fix: Code review fixes * fix: Emit session complet event * fix: Code review fixes * chore: Add comment * chore: Add cloud info in setup info command * fix: Proxy flow must call install started * fix: Code review fixes * fix: Code review fixes * Update internal/audit/cloud_sink.go Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> Signed-off-by: Abhisek Datta <abhisek.datta@gmail.com> * fix: Code review fixes --------- Signed-off-by: Abhisek Datta <abhisek.datta@gmail.com> Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
0355a5d4fd
commit
e67735c1c3
@@ -78,6 +78,14 @@ type Config struct {
|
||||
Sandbox SandboxConfig `mapstructure:"sandbox"`
|
||||
|
||||
DependencyCooldown DependencyCooldownConfig `mapstructure:"dependency_cooldown"`
|
||||
|
||||
Cloud CloudConfig `mapstructure:"cloud"`
|
||||
}
|
||||
|
||||
// CloudConfig configures audit event sync to SafeDep Cloud.
|
||||
type CloudConfig struct {
|
||||
Enabled bool `mapstructure:"enabled"`
|
||||
EndpointID string `mapstructure:"endpoint_id"`
|
||||
}
|
||||
|
||||
// SandboxConfig configures the sandbox system for isolating package manager processes.
|
||||
@@ -163,6 +171,11 @@ type RuntimeConfig struct {
|
||||
eventLogDir string
|
||||
}
|
||||
|
||||
// CloudSyncDBPath returns the path to the cloud sync WAL database.
|
||||
func (r *RuntimeConfig) CloudSyncDBPath() string {
|
||||
return filepath.Join(r.configDir, "cloud-sync.db")
|
||||
}
|
||||
|
||||
// ConfigFilePath returns the path to the config file.
|
||||
func (r *RuntimeConfig) ConfigFilePath() string {
|
||||
return r.configFilePath
|
||||
@@ -238,6 +251,9 @@ func DefaultConfig() RuntimeConfig {
|
||||
Enabled: true,
|
||||
Days: 5,
|
||||
},
|
||||
Cloud: CloudConfig{
|
||||
Enabled: false,
|
||||
},
|
||||
},
|
||||
DryRun: false,
|
||||
InsecureInstallation: insecureInstallation,
|
||||
|
||||
@@ -143,3 +143,12 @@ sandbox:
|
||||
dependency_cooldown:
|
||||
enabled: true
|
||||
days: 5
|
||||
|
||||
# Cloud sync configuration.
|
||||
# When enabled, PMG audit events are synced to SafeDep Cloud for centralized visibility.
|
||||
# Requires SAFEDEP_API_KEY and SAFEDEP_TENANT_ID environment variables for authentication.
|
||||
cloud:
|
||||
enabled: false
|
||||
# Endpoint ID is not required. By default, it falls back to the machine's hostname.
|
||||
# Set it only if you want to explicitly override the identifier for this endpoint.
|
||||
# endpoint_id: "my-machine"
|
||||
|
||||
@@ -64,4 +64,6 @@ func TestTemplateMatchesDefaults(t *testing.T) {
|
||||
|
||||
assert.Equal(t, def.DependencyCooldown.Enabled, parsed.DependencyCooldown.Enabled, "dependency_cooldown.enabled mismatch")
|
||||
assert.Equal(t, def.DependencyCooldown.Days, parsed.DependencyCooldown.Days, "dependency_cooldown.days mismatch")
|
||||
|
||||
assert.Equal(t, def.Cloud.Enabled, parsed.Cloud.Enabled, "cloud.enabled mismatch")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user