Skip to content

Commit

Permalink
bitbucket_pipeline_variable: Hide secured values in console log (#1635)…
Browse files Browse the repository at this point in the history
… (#1637)

**SECURITY** - CVE-2021-20180

Hide user sensitive information which is marked as ``secured``
while logging in console.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 1d0c5e2)

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
  • Loading branch information
patchback[bot] and Akasurde committed Jan 14, 2021
1 parent 4c9c8e0 commit a3f0837
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/cve_bitbucket_pipeline_variable.yml
@@ -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).'
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'):
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

0 comments on commit a3f0837

Please sign in to comment.