Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bitbucket_pipeline_variable: Hide secured values in console log #1635

Merged
merged 1 commit into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/cve_bitbucket_pipeline_variable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
security_fixes:
- 'bitbucket_pipeline_variable - **CVE-2021-20180** - hide user sensitive information which are marked as ``secured`` from logging into the console (https://github.com/ansible-collections/community.general/pull/1635).'
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

RETURN = r''' # '''

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import AnsibleModule, _load_params
from ansible_collections.community.general.plugins.module_utils.source_control.bitbucket import BitbucketHelper

error_messages = {
Expand Down Expand Up @@ -211,6 +211,14 @@ def delete_pipeline_variable(module, bitbucket, variable_uuid):
))


class BitBucketPipelineVariable(AnsibleModule):
def __init__(self, *args, **kwargs):
params = _load_params() or {}
if params.get('secured'):
Akasurde marked this conversation as resolved.
Show resolved Hide resolved
kwargs['argument_spec']['value'].update({'no_log': True})
super(BitBucketPipelineVariable, self).__init__(*args, **kwargs)


def main():
argument_spec = BitbucketHelper.bitbucket_argument_spec()
argument_spec.update(
Expand All @@ -221,7 +229,7 @@ def main():
secured=dict(type='bool', default=False),
state=dict(type='str', choices=['present', 'absent'], required=True),
)
module = AnsibleModule(
module = BitBucketPipelineVariable(
argument_spec=argument_spec,
supports_check_mode=True,
)
Expand Down