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

blueprint: Import parses unwanted hidden files #4984

Closed
simonkeyd opened this issue Jun 13, 2022 · 6 comments · Fixed by #4985
Closed

blueprint: Import parses unwanted hidden files #4984

simonkeyd opened this issue Jun 13, 2022 · 6 comments · Fixed by #4985
Assignees
Labels
Blueprint bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. CXP Attention This issue is handled by CXP team.
Milestone

Comments

@simonkeyd
Copy link
Contributor

This is autogenerated. Please review and update as needed.

Describe the bug

blueprint import will import all files in the artifacts folder including hidden Linux files and might raise an UnicodeDecodeError (eg. for Vim swap files which often include non-ASCII chars)

Command Name
az blueprint import Extension Name: blueprint. Version: 0.3.1.

Errors:

The command failed with an unexpected error. Here is the traceback:
'utf-8' codec can't decode byte 0xfa in position 16: invalid start byte
Traceback (most recent call last):
  File "/home/generic_user/.venv_az/lib/python3.9/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/home/generic_user/.venv_az/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/home/generic_user/.venv_az/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/home/generic_user/.venv_az/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/home/generic_user/.venv_az/lib/python3.9/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/home/generic_user/.venv_az/lib/python3.9/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/home/generic_user/.azure/cliextensions/blueprint/azext_blueprint/custom.py", line 53, in import_blueprint_with_artifacts
    artifact = json.load(artifact_file)
  File "/usr/lib/python3.9/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/lib/python3.9/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfa in position 16: invalid start byte

To Reproduce:

  • vim generic_blueprint/artifacts/generic_artifact.json
  • az blueprint import --name generic_blueprint --input-path ./generic_blueprint --management-group deadbeef-dead-beef-8badf00d1337

Expected Behavior

Import works flawlessly

Environment Summary

Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.31, Debian GNU/Linux 11 (bullseye)
Python 3.9.2
Installer: PIP

azure-cli 2.37.0

Extensions:
blueprint 0.3.1
resource-graph 2.1.0
serial-console 0.1.1

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Additional Context

@ghost ghost added question The issue doesn't require a change to the product in order to be resolved. Most issues start as that customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Jun 13, 2022
@yonzhan yonzhan added this to the Backlog milestone Jun 13, 2022
@yonzhan yonzhan added CXP Attention This issue is handled by CXP team. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jun 13, 2022
@ghost
Copy link

ghost commented Jun 13, 2022

Thank you for your feedback. This has been routed to the support team for assistance.

@yonzhan
Copy link
Collaborator

yonzhan commented Jun 13, 2022

route to CXP team

@navba-MSFT navba-MSFT assigned navba-MSFT and unassigned jsntcy Jun 20, 2022
@navba-MSFT
Copy link
Contributor

navba-MSFT commented Jun 20, 2022

@simonkeyd Apologies for the late reply. Thanks for reaching out to us and sharing this feedback. We are looking into this issue and we will provide an update. In the meantime, I am following up with the reviewers on your above PR for the approval.

@navba-MSFT
Copy link
Contributor

navba-MSFT commented Jun 22, 2022

@simonkeyd Your above PR #4985 has been reviewed and the comments have been added for you to consider. Please check once you get a chance.

Also could you please try the below action plan and check if that helps:

Could you please try to update the Windows system language setting ?

Control panel -> Clock and Region -> Region -> Administrative -> Change system locale -> Check Beta: Use Unicode UTF-8 for worldwide language support.

image

The change will require reboot. Please let me know if you still face the same issue. Awaiting your reply.

@navba-MSFT navba-MSFT added the needs-author-feedback More information is needed from author to address the issue. label Jun 22, 2022
@navba-MSFT
Copy link
Contributor

@simonkeyd I wanted to do quick follow-up to check if you had a chance to look at my above comment. Please let us know if you are still facing the issue after following my above plan. Awaiting your reply.

simonkeyd pushed a commit to simonkeyd/azure-cli-extensions that referenced this issue Jun 27, 2022
Blueprint extension was parsing all files in the artifacts folder
including hidden files. This unwanted behavior can also raise errors
(eg. UnicodeDecodeError). This commit fixes this by preventing hidden
Linux and Windows files from being parsed.

closes Azure#4984
@simonkeyd
Copy link
Contributor Author

@navba-MSFT in most cases one wouldn't want hidden files to be parsed as they can contain unchecked code/content. For example in my particular use case vim swap files are temporary files not meant to be used by program other than vim - not JSON at all.

@ghost ghost added needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-author-feedback More information is needed from author to address the issue. labels Jun 27, 2022
@navba-MSFT navba-MSFT added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed needs-team-attention This issue needs attention from Azure service team or SDK team labels Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blueprint bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. CXP Attention This issue is handled by CXP team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants