Skip to content

kubeconfig appears in ansible log module invocations, even when in dictionary form #782

@jnm27

Description

@jnm27
SUMMARY

When passing the kubeconfig to various kubernetes.core modules as a dictionary instead of a path, it contains sensitive data and should not be logged.
I've patched this in our environment in the meantime to simply always no_log the kubeconfig argument in args_common.py.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

kubernetes/core/plugins/module_utils/args_common.py

ANSIBLE VERSION
ansible [core 2.15.0]
  python version = 3.11.2 (main, Feb 17 2023, 09:28:16) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] (/usr/bin/python3.11)
  jinja version = 3.1.2
COLLECTION VERSION
kubernetes.core          4.0.0
CONFIGURATION
not relevant
OS / ENVIRONMENT

RHEL8.6 ansible engine, Openshift 4.16 target.

STEPS TO REPRODUCE

Pass kubeconfig as a dictionary to any kubernetes.core module that uses args_common.py.

kubernetes.core.helm, community.okd.k8s
EXPECTED RESULTS

Sensitive kubeconfig dictionary is omitted from logs.

ACTUAL RESULTS

Kubeconfig dictionary is in plaintext in logs.

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic/securityIssue or pull request relating to security concerntype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions