Debian Codegraph @

changelogs/fragments/sensitive-data-masking.yml

raw
1 major_changes:
2 - >-
3 Secret masking - Ansible now automatically redacts known secret values from the output it generates, such as ``display`` output (including verbose,
4 warning, deprecation, and error output), module logging, and task results passed to callback plugins. Masking is non-destructive; the real value
5 remains available to tasks, conditionals, and registered variables, only the rendered output is redacted with ``$REDACTED$``. Secrets shorter than 4
6 characters are never masked, secrets of 4 to 6 characters are only masked when they appear as a whole word or when they overlap or are adjacent to
7 another secret, and secrets longer than 65536 characters are matched on their first 65536 characters.
8 - >-
9 Secret masking - add the ``ansible.module_utils.secrets`` public API for working with secrets manually. It provides ``register_secret`` and
10 ``register_secrets`` to register values that should be redacted from masked output, and ``mask_secrets`` to redact any registered secrets from a
11 string. The API can be used on the controller and in Python modules; the new ``Ansible.Secrets`` C# module_util provides the equivalent
12 ``[Ansible.Secrets.SecretMasker]::RegisterSecret()`` and ``MaskString()`` methods for PowerShell modules. Secrets registered inside a module or worker
13 process are propagated back to the controller so they are also masked there.
14 - >-
15 callback plugins - callback plugin authors should opt into the new secret masking behaviour by setting the class attribute ``ANSIBLE_SUPPORTS_MASKING
16 = True``. A callback that sets this receives the unmasked task result and must ensure any secrets are redacted before they are written, either by
17 emitting output through ``Display`` which masks automatically, or by passing the values through ``ansible.module_utils.secrets.mask_secrets()`` before
18 writing them elsewhere. Callbacks that do not set the attribute continue to receive task results with any registered secrets replaced by
19 ``$REDACTED$``, matching the redacted results they receive today. This implicit masking exists only for backwards compatibility with existing
20 callbacks and will be removed in a future release, at which point all callbacks will receive unmasked results and must mask them manually if not using
21 ``Display``. Task-level ``no_log: true`` continues to censor the entire result regardless of this attribute.
22 minor_changes:
23 - >-
24 Secret masking - the following values are now automatically registered as secrets and redacted from masked output: vault passwords provided by prompt,
25 file, or script; the decrypted plaintext of vault encrypted values and every string or numeric value in a vault encrypted vars file; passwords entered
26 for ``--ask-pass`` and ``--ask-become-pass``; ``no_log`` module option values; the ``become_pass`` option of the ``sudo``, ``su``, and ``runas``
27 become plugins; the ``password``, ``private_key``, and ``private_key_passphrase`` options of the ``ssh`` connection plugin; the ``password`` option of
28 the ``winrm`` and ``psrp`` connection plugins and the ``certificate_key_password`` option of ``psrp``; the ``password`` option of the ``url`` lookup;
29 the values returned by the ``password`` and ``unvault`` lookups; the secret passed to the ``vault`` and ``unvault`` filters; the user input of the
30 ``pause`` action when ``echo`` is ``false``; and values entered for a play ``vars_prompt`` when ``private`` is ``true`` (the default).
31 - >-
32 config - add a ``secret`` boolean keyword to plugin configuration option definitions. When set to ``true``, the resolved value of the option is
33 automatically registered as a secret for output masking, regardless of the source it was set from (env, ini, vars, CLI, or plugin arguments). It is
34 only supported for the ``str``, ``string``, and ``list`` types (string elements of a list are registered); using it with any other type raises an
35 error when the plugin configuration is loaded.
36 - >-
37 Secret masking - add the internal ``_SECRETS_INPUT_FILES`` config option to pre-seed values to redact from the output of ``ansible``,
38 ``ansible-playbook``, and ``ansible-console``. Each file is YAML or JSON containing a mapping with a ``version`` key (currently only ``1``) and a
39 ``secrets`` key listing the string values to mask. A file with the executable bit set is run instead of read, and its stdout is parsed as the document.
40 - >-
41 ssh, winrm, and psrp connection plugins - the raw stdout and stderr of executed commands are no longer displayed at increased verbosity
42 (``-vvv`` for ``ssh``, ``-vvvvv`` for ``winrm`` and ``psrp``), only the return code is shown. Module output can contain secrets, such as
43 ``no_log`` option values, which are only registered for masking once the result has been parsed, so displaying the raw output before then could
44 leak them. The raw output is still available with ``ANSIBLE_DEBUG=1`` if needed for debugging purposes.
45 breaking_changes:
46 - >-
47 Module options that are marked as ``no_log: true`` will no longer be redacted literally as ``"VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"`` in the module
48 result and ``invocation.module_args``. Instead, the actual value is registered as a secret and is only redacted in generated output, allowing these
49 values to be used by subsequent tasks without any loss of data. The value is still redacted in callback output and module logging. Playbooks or tests
50 that check for the ``VALUE_SPECIFIED_IN_NO_LOG_PARAMETER`` placeholder in results should be updated.
51 - >-
52 AnsibleModule - ``log()`` and the automatic invocation logging now only redact values registered as secrets (such as ``no_log`` option values) and no
53 longer apply the ``heuristic_log_sanitize()`` heuristics, for example ``user:password@host`` in URLs is no longer rewritten unless the password is a
54 registered secret. ``no_log`` and password-like options are logged as ``$REDACTED$`` instead of ``NOT_LOGGING_PARAMETER`` or ``NOT_LOGGING_PASSWORD``.
55 - >-
56 AnsibleModule - ``run_command()`` no longer rewrites the ``cmd`` value in a failure result to replace password-like arguments (such as
57 ``--password=...``) with ``********``, and the ``msg`` value is no longer passed through ``heuristic_log_sanitize()``. Registered secrets in these
58 values are still redacted in output. Modules that pass a secret on the command line which is not a ``no_log`` option should register it with
59 ``ansible.module_utils.secrets.register_secret()``.
60 - >-
61 uri - response keys are no longer rewritten to strip ``no_log`` values (previously done with ``sanitize_keys()``); registered secrets are masked in
62 output instead.
63 deprecated_features:
64 - >-
65 module_utils - the ``heuristic_log_sanitize()`` function in ``ansible.module_utils.basic`` is deprecated and will be removed in ansible-core 2.25.
66 Secret values are now masked automatically, use functions from the ``ansible.module_utils.secrets`` module to handle secrets manually.
67 - >-
68 module_utils - the ``remove_values()`` and ``sanitize_keys()`` functions in ``ansible.module_utils.common.parameters`` are deprecated and will be
69 removed in ansible-core 2.25. Secret values are now masked automatically, use functions from the ``ansible.module_utils.secrets`` module to handle
70 secrets manually.
71 - >-
72 ansible.utils.cmd_functions.run_cmd - the ``live`` argument is deprecated and will be removed in ansible-core 2.25 because it writes the subprocess
73 output directly to stdout/stderr, bypassing the built-in secret masking applied to captured output. Callers that need to stream output live should run
74 the subprocess themselves and are responsible for masking any secrets.
75 known_issues:
76 - >-
77 Secret masking - when ``ANSIBLE_DEBUG=1`` is set, the raw stdout and stderr of commands executed on the target, including module results, are displayed
78 before the secrets contained in the module result have been registered for masking. Secrets which are only known to the module, such as ``no_log``
79 option values, may therefore be shown in plaintext in debug output.