Repository navigation
fix(inference-benchmarks): harden secret management scripts, dockerfile execution context, and Kubernetes cronjobs - #1
Open
mertcano wants to merge 1 commit into
Conversation
…le execution context, and Kubernetes cronjobs ### Description This PR hardens the security posture of the `inference-benchmarks` environment across secret generation scripts, container definitions, and Kubernetes CronJob manifests[cite: 30, 31, 32, 33]. It eliminates insecure credential passing vectors, enforces least-privilege container execution, and prevents dangerous non-atomic secret rotation behaviors[cite: 30, 31, 32, 33]. ### Key Changes * **Secure Secret Provisioning (`aiperf/create-secret.sh`, `aiperf/create-api-key-secret.sh`):** - Removed insecure command-line argument passing for sensitive credentials, preventing leaks via process lists (`ps`) and shell command histories[cite: 30]. - Replaced dangerous `source` file execution with explicit, line-by-line parsing for expected keys (`CLIENT_ID`, `CLIENT_SECRET`)[cite: 30]. - Replaced non-atomic delete-then-create secret deployment steps with idempotent, safe dry-run apply patterns (`kubectl create ... --dry-run=client -o yaml | kubectl apply -f -`)[cite: 30, 33]. * **Container Hardening (`aiperf/Dockerfile`):** - Eliminated root-user container execution by creating and switching to a dedicated non-privileged user (`benchmark`, UID/GID `10001:10001`)[cite: 32]. * **Kubernetes Infrastructure Security (`aiperf/cronjob.yaml`):** - Disabled default ServiceAccount token automounting (`automountServiceAccountToken: false`) across benchmark workloads[cite: 31]. - Enforced strict Pod Security Standards by configuring `securityContext` settings (`runAsNonRoot: true`, `allowPrivilegeEscalation: false`, dropping all capabilities, and setting `seccompProfile: RuntimeDefault`)[cite: 31]. ### Validation & Testing * **Static Verification:** Bash scripts successfully passed syntax checks (`bash -n`)[cite: 30, 33], and YAML manifests were structurally validated using safe loading techniques.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR hardens the security posture of the
inference-benchmarksenvironment across secret generation scripts, container definitions, and Kubernetes CronJob manifests[cite: 30, 31, 32, 33]. It eliminates insecure credential passing vectors, enforces least-privilege container execution, and prevents dangerous non-atomic secret rotation behaviors[cite: 30, 31, 32, 33].Key Changes
aiperf/create-secret.sh,aiperf/create-api-key-secret.sh):ps) and shell command histories[cite: 30].sourcefile execution with explicit, line-by-line parsing for expected keys (CLIENT_ID,CLIENT_SECRET)[cite: 30].kubectl create ... --dry-run=client -o yaml | kubectl apply -f -)[cite: 30, 33].aiperf/Dockerfile):benchmark, UID/GID10001:10001)[cite: 32].aiperf/cronjob.yaml):automountServiceAccountToken: false) across benchmark workloads[cite: 31].securityContextsettings (runAsNonRoot: true,allowPrivilegeEscalation: false, dropping all capabilities, and settingseccompProfile: RuntimeDefault)[cite: 31].Validation & Testing
bash -n)[cite: 30, 33], and YAML manifests were structurally validated using safe loading techniques.