Skip to content

fix(OPENFRAM-005-4): CU-86akdypzw 5 review findings across 2 files - #2344

Draft
flamingo[bot] wants to merge 2 commits into
mainfrom
ai-fix/openfram-005-4-308e5860-16dc4bdf
Draft

flamingo[bot] wants to merge 2 commits into
mainfrom
ai-fix/openfram-005-4-308e5860-16dc4bdf

Conversation

@flamingo

@flamingo flamingo Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Closes 5 review findings across 2 files.

Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.

# Fix confidence Finding Location
1 🔴 55 low — review closely Kafka, MySQL, MongoDB (non-meshcentral), Cassandra, Zookeeper containers lack required securityContext hardening manifests/datasources/mysql-fleetmdm/templates/statefulset.yaml:1
2 🟡 60 medium mysqld-exporter uses readOnlyRootFilesystem without a writable emptyDir mount for its temp needs manifests/datasources/mysql-fleetmdm/templates/statefulset.yaml:97
3 🟢 90 high fleetmdm-mysql StatefulSet uses revisionHistoryLimit: 10 instead of the mandated 2 manifests/datasources/mysql-fleetmdm/templates/statefulset.yaml:1
4 🟡 70 medium MongoDB StatefulSet init containers run as root without restrictive securityContext manifests/datasources/mongodb-meshcentral/templates/statefulset.yaml:27
5 🟢 95 high meshcentral-mongodb StatefulSet uses revisionHistoryLimit: 10 instead of the mandated 2 manifests/datasources/mongodb-meshcentral/templates/statefulset.yaml:1

What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.


Run: https://product-hub.flamingo.so/admin/code-review
Run id: 16dc4bdf-608c-4c65-84b9-63df756e4657

Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.

ClickUp task: CU-86akdypzw OpenFrame Kubernetes manifest hardening secondary (12 PRs)

@flamingo flamingo Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 What this fix changed, finding by finding

5 finding(s) fixed in this draft — 5 explained inline on the diff; 1 low-confidence hunk(s) need close review before merging.

Comment on lines 5 to 11
spec:
serviceName: fleetmdm-mysql
replicas: 1
revisionHistoryLimit: 10
revisionHistoryLimit: 2
selector:
matchLabels:
app: fleetmdm-mysql

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 Kafka, MySQL, MongoDB (non-meshcentral), Cassandra, Zookeeper containers lack required securityContext hardening

Added podSecurityContext (runAsNonRoot, runAsUser) at spec.template.spec level, and container-level securityContext (runAsNonRoot, runAsUser, allowPrivilegeEscalation:false, capabilities.drop:[ALL], readOnlyRootFilesystem:true) to the mysql main container. Since the mysql container needs to write to /var/lib/mysql (already mounted) and possibly /tmp, a tmp emptyDir volume/mount was added to support readOnlyRootFilesystem without breaking runtime writes. Risk: mysql image may need additional writable paths (e.g. /var/run/mysqld) not covered here — untested against the actual image, so flagged as partial/risky.

🤖 Prompt for AI agents
In manifests/datasources/mysql-fleetmdm/templates/statefulset.yaml around line 1, review and complete this code-review fix: Kafka, MySQL, MongoDB (non-meshcentral), Cassandra, Zookeeper containers lack required securityContext hardening.
What the draft fix changed: Added podSecurityContext (runAsNonRoot, runAsUser) at spec.template.spec level, and container-level securityContext (runAsNonRoot, runAsUser, allowPrivilegeEscalation:false, capabilities.drop:[ALL], readOnlyRootFilesystem:true) to the `mysql` main container. Since the mysql container needs to write to /var/lib/mysql (already mounted) and possibly /tmp, a `tmp` emptyDir volume/mount was added to support readOnlyRootFilesystem without breaking runtime writes. Risk: mysql image may need additional writable paths (e.g. /var/run/mysqld) not covered here — untested against the actual image, so flagged as partial/risky.
The fix is LOW CONFIDENCE — verify it is correct and finish whatever it left incomplete.

fix confidence: 🔴 55 low — review closely — react 👍/👎 to teach the reviewer

Comment on lines 113 to 133
runAsNonRoot: true
runAsUser: 65534
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
volumeMounts:
- name: exporter-tmp
mountPath: /tmp
{{- end }}

volumes:
- name: tmp
emptyDir: {}
{{- if .Values.mysql.metrics.enabled }}
- name: exporter-tmp
emptyDir: {}
{{- end }}

volumeClaimTemplates:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 mysqld-exporter uses readOnlyRootFilesystem without a writable emptyDir mount for its temp needs

Added volumeMounts/volumes for the mysqld-exporter container (exporter-tmp emptyDir mounted at /tmp) alongside its existing readOnlyRootFilesystem:true securityContext, and added capabilities.drop:[ALL] to complete hardening per OPENFRAM-006-8. Mechanism: new exporter-tmp volume defined in the shared volumes: block guarded by the same .Values.mysql.metrics.enabled conditional as the container.

🤖 Prompt for AI agents
In manifests/datasources/mysql-fleetmdm/templates/statefulset.yaml around line 97, review and complete this code-review fix: mysqld-exporter uses readOnlyRootFilesystem without a writable emptyDir mount for its temp needs.
What the draft fix changed: Added `volumeMounts`/`volumes` for the mysqld-exporter container (`exporter-tmp` emptyDir mounted at /tmp) alongside its existing readOnlyRootFilesystem:true securityContext, and added capabilities.drop:[ALL] to complete hardening per OPENFRAM-006-8. Mechanism: new `exporter-tmp` volume defined in the shared `volumes:` block guarded by the same `.Values.mysql.metrics.enabled` conditional as the container.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 60 medium — react 👍/👎 to teach the reviewer

Comment on lines 5 to 11
spec:
serviceName: fleetmdm-mysql
replicas: 1
revisionHistoryLimit: 10
revisionHistoryLimit: 2
selector:
matchLabels:
app: fleetmdm-mysql

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔵 fleetmdm-mysql StatefulSet uses revisionHistoryLimit: 10 instead of the mandated 2

Changed revisionHistoryLimit: 10 to revisionHistoryLimit: 2 in the StatefulSet spec, matching the suggested fix exactly.

🤖 Prompt for AI agents
In manifests/datasources/mysql-fleetmdm/templates/statefulset.yaml around line 1, review and complete this code-review fix: fleetmdm-mysql StatefulSet uses revisionHistoryLimit: 10 instead of the mandated 2.
What the draft fix changed: Changed `revisionHistoryLimit: 10` to `revisionHistoryLimit: 2` in the StatefulSet spec, matching the suggested fix exactly.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer

Comment on lines 29 to 39
image: {{ .Values.mongodb.initImage.registry }}/{{ .Values.mongodb.initImage.repository }}:{{ .Values.mongodb.initImage.tag }}
securityContext:
runAsUser: 0
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
command:
- /bin/sh
- -c

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 MongoDB StatefulSet init containers run as root without restrictive securityContext

Added allowPrivilegeEscalation: false, capabilities.drop: [ALL], and readOnlyRootFilesystem: true to the securityContext of both init containers (keyfile-prepare, fix-perms), the mongodb container, and the mongodb-exporter container in the StatefulSet spec. Note: runAsUser: 0 was retained on init containers since they need root to chown/chmod files, and readOnlyRootFilesystem was omitted from the mongodb container (not added) since it writes to /data/db via a volume mount but may need writable scratch space elsewhere — this was left off the main mongodb container only to avoid breaking its runtime writes beyond the mounted volumes; if the mongodb-exporter and init containers' filesystems must remain read-only, verify no other paths are written to besides the mounted volumes.

🤖 Prompt for AI agents
In manifests/datasources/mongodb-meshcentral/templates/statefulset.yaml around line 27, review and complete this code-review fix: MongoDB StatefulSet init containers run as root without restrictive securityContext.
What the draft fix changed: Added `allowPrivilegeEscalation: false`, `capabilities.drop: [ALL]`, and `readOnlyRootFilesystem: true` to the securityContext of both init containers (keyfile-prepare, fix-perms), the mongodb container, and the mongodb-exporter container in the StatefulSet spec. Note: `runAsUser: 0` was retained on init containers since they need root to chown/chmod files, and `readOnlyRootFilesystem` was omitted from the mongodb container (not added) since it writes to /data/db via a volume mount but may need writable scratch space elsewhere — this was left off the main mongodb container only to avoid breaking its runtime writes beyond the mounted volumes; if the mongodb-exporter and init containers' filesystems must remain read-only, verify no other paths are written to besides the mounted volumes.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 70 medium — react 👍/👎 to teach the reviewer

Comment on lines 5 to 11
spec:
serviceName: meshcentral-mongodb
replicas: 1
revisionHistoryLimit: 10
revisionHistoryLimit: 2
selector:
matchLabels:
app: meshcentral-mongodb

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔵 meshcentral-mongodb StatefulSet uses revisionHistoryLimit: 10 instead of the mandated 2

Changed revisionHistoryLimit: 10 to revisionHistoryLimit: 2 in the StatefulSet spec (top-level metadata/spec section) per the suggested fix.

🤖 Prompt for AI agents
In manifests/datasources/mongodb-meshcentral/templates/statefulset.yaml around line 1, review and complete this code-review fix: meshcentral-mongodb StatefulSet uses revisionHistoryLimit: 10 instead of the mandated 2.
What the draft fix changed: Changed `revisionHistoryLimit: 10` to `revisionHistoryLimit: 2` in the StatefulSet spec (top-level metadata/spec section) per the suggested fix.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 95 high — react 👍/👎 to teach the reviewer

@flamingo flamingo Bot changed the title fix(OPENFRAM-005-4): 5 review findings across 2 files fix(OPENFRAM-005-4): CU-86akdypzw 5 review findings across 2 files Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants