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

[RULE] Image builder external scripts should compare hash #2903

Open
BernieWhite opened this issue Jun 1, 2024 · 0 comments
Open

[RULE] Image builder external scripts should compare hash #2903

BernieWhite opened this issue Jun 1, 2024 · 0 comments
Labels
pillar: security Aligned to the Security pillar. rule: azure-image-builder Rules for Azure Image Builder

Comments

@BernieWhite
Copy link
Collaborator

Existing rule

No response

Suggested rule

When running remote scripts in a build process, the remote script could be maliciously modified to execute unintended code. This is a supply chain threat. We should compare SHA hashes during the image build process for any external scripts.

The Microsoft.VirtualMachineImages/imageTemplates resource allows external scripts to be set:

  • During customization, properties.customize:
    • If type is File and sourceUri is set then sha256Checksum should be set.
    • If type is PowerShell and scriptUri is set then sha256Checksum should be set.
    • If type is Shell and scriptUri is set then sha256Checksum should be set.
  • During validate, properties.validate.inVMValidations:
    • If type is PowerShell and scriptUri is set then sha256Checksum should be set.
    • If type is Shell and scriptUri is set then sha256Checksum should be set.

If an inline script is used, we don't need to validate the SHA hash. We should not fail if no scripts external scripts are used.

Pillar

Security

Additional context

@BernieWhite BernieWhite added pillar: security Aligned to the Security pillar. rule: azure-image-builder Rules for Azure Image Builder labels Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pillar: security Aligned to the Security pillar. rule: azure-image-builder Rules for Azure Image Builder
Projects
None yet
Development

No branches or pull requests

1 participant