[hermes] soteria: go:S1192 #48

Open
opened 2026-09-26 18:27:16 +00:00 by hermes-automation · 0 comments

SonarQube reports go:S1192 in internal/k8s/job_manifests.go. The build is green; this is a standing finding, not a failure.

What is wrong

The literal "/cache" is written out three times in internal/k8s/job_manifests.go: the cache VolumeMount in buildBackupJob, the cache VolumeMount in buildRestoreJob, and the RESTIC_CACHE_DIR env var in resticEnv. Because the mount path and the env var must always agree for restic caching to work, the duplication is a real drift risk and go:S1192 wants it centralized in one named constant.

Ariadne opened no pull request for it: no automated patch was possible for this finding.

Facts

  • gitea — Define a constant instead of duplicating this literal "/cache" 3 times. (CRITICAL, 6min estimated) (internal/k8s/job_manifests.go:45)

Suggested fix (not applied)

Hermes could not open a pull request for this, so the change below was not written, validated, or pushed anywhere. It is a starting point for whoever picks this up, not a reviewed patch.

internal/k8s/job_manifests.go — Declare a package-level constant for the restic cache directory (e.g. directly after the import block) and use it at all three sites: both jobs' cache volume mounts and the RESTIC_CACHE_DIR environment variable. The rendered Job manifests are byte-for-byte identical to today's output, so behaviour is unchanged; the constant also makes it impossible for the mount path and cache env var to diverge. The /cache/restore paths inside restoreCommand are a different literal and are not flagged, so they can stay as-is.

const resticCacheDir = "/cache"

// buildBackupJob, container VolumeMounts:
VolumeMounts: []corev1.VolumeMount{
	{Name: "data", MountPath: "/data", ReadOnly: true},
	{Name: "cache", MountPath: resticCacheDir},
},

// buildRestoreJob, container VolumeMounts:
VolumeMounts: []corev1.VolumeMount{
	{Name: "restore", MountPath: "/restore"},
	{Name: "cache", MountPath: resticCacheDir},
},

// resticEnv, cache dir entry:
{Name: "RESTIC_CACHE_DIR", Value: resticCacheDir},

Filed automatically by Ariadne from a Hermes Agent diagnosis (run run_bb689187296048eab7b76bae2da8b246). Hermes has no write access to this repository; no files or infrastructure were changed.

SonarQube reports **go:S1192** in `internal/k8s/job_manifests.go`. The build is green; this is a standing finding, not a failure. ## What is wrong The literal "/cache" is written out three times in internal/k8s/job_manifests.go: the cache VolumeMount in buildBackupJob, the cache VolumeMount in buildRestoreJob, and the RESTIC_CACHE_DIR env var in resticEnv. Because the mount path and the env var must always agree for restic caching to work, the duplication is a real drift risk and go:S1192 wants it centralized in one named constant. Ariadne opened no pull request for it: no automated patch was possible for this finding. ## Facts - **gitea** — Define a constant instead of duplicating this literal "/cache" 3 times. (CRITICAL, 6min estimated) (`internal/k8s/job_manifests.go:45`) ## Suggested fix (not applied) Hermes could not open a pull request for this, so the change below was not written, validated, or pushed anywhere. It is a starting point for whoever picks this up, not a reviewed patch. **`internal/k8s/job_manifests.go`** — Declare a package-level constant for the restic cache directory (e.g. directly after the import block) and use it at all three sites: both jobs' cache volume mounts and the RESTIC_CACHE_DIR environment variable. The rendered Job manifests are byte-for-byte identical to today's output, so behaviour is unchanged; the constant also makes it impossible for the mount path and cache env var to diverge. The /cache/restore paths inside restoreCommand are a different literal and are not flagged, so they can stay as-is. ``` const resticCacheDir = "/cache" // buildBackupJob, container VolumeMounts: VolumeMounts: []corev1.VolumeMount{ {Name: "data", MountPath: "/data", ReadOnly: true}, {Name: "cache", MountPath: resticCacheDir}, }, // buildRestoreJob, container VolumeMounts: VolumeMounts: []corev1.VolumeMount{ {Name: "restore", MountPath: "/restore"}, {Name: "cache", MountPath: resticCacheDir}, }, // resticEnv, cache dir entry: {Name: "RESTIC_CACHE_DIR", Value: resticCacheDir}, ``` ## Links - SonarQube finding: https://quality.bstein.dev/project/issues?resolved=false&id=soteria&open=AZ9pTqVcN0JrBQvDGDs3 - Full evidence bundle and audit trail live in Ariadne at `/api/admin/audit/events`, event types `hermes_autotriage_incident` and `hermes_autotriage_diagnosis`. Filed automatically by Ariadne from a Hermes Agent diagnosis (run [run_bb689187296048eab7b76bae2da8b246](https://triage.bstein.dev/chat?resume=run_bb689187296048eab7b76bae2da8b246)). Hermes has no write access to this repository; no files or infrastructure were changed. <!-- hermes-triage job=soteria classification=go:S1192 incident=sonar/soteria/go:S1192/AZ9pTqVcN0JrBQvDGDs3 -->
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: titan/soteria#48
No description provided.