Azure / template-analyzer

Template scanner for security misconfiguration and best practices
MIT License
128 stars 40 forks source link

[BUG] Cannot run TemplateAnalyzer on linux agent in Azure DevOps using Powershell #339

Closed Galupio closed 1 year ago

Galupio commented 1 year ago

Describe the bug

I am trying to run the TemplateAnalyzer with a linux agent in Azure Devops.

I modified the command to: TemplateAnalyzer analyze-directory ...

instead of: TemplateAnalyzer.exe analyze-directory ...

And DevOps fails to execute the TemplateAnalyzer with the following output:

Warning: unknown mime-type for "/home/vsts/work/1/a/template-analyzer/TemplateAnalyzer" -- using "application/octet-stream" Error: no "view" mailcap rules found for type "application/octet-stream" /usr/bin/xdg-open: 882: www-browser: not found /usr/bin/xdg-open: 882: links2: not found /usr/bin/xdg-open: 882: elinks: not found /usr/bin/xdg-open: 882: links: not found /usr/bin/xdg-open: 882: lynx: not found /usr/bin/xdg-open: 882: w3m: not found xdg-open: no method available for opening '/home/vsts/work/1/a/template-analyzer/TemplateAnalyzer'

Does anyone know how to run the TemplateAnalyzer with a linux agent in Azure Devops?

Expected behavior

I would like to be able to run the TemplateAnalyzer with a linux agent in Azure Devops.

Reproduction Steps

I am trying to run the TemplateAnalyzer with a linux agent in Azure Devops.

I modified the command to: TemplateAnalyzer analyze-directory ...

instead of: TemplateAnalyzer.exe analyze-directory ...

Environment

TemplateAnalyzer-linux-x64.zip downloaded from https://github.com/$repo/releases/latest/download/$file Trying to be ran via a Powershell@2 task in AzureDevOps using ubuntu-latest agent

Galupio commented 1 year ago

Hello,

I managed to run the Template Analyzer using a Bash task in Azure DevOps.

I ran:

chmod +x TemplateAnalyzer ./TemplateAnalyzer analyze-directory ...