feat: public blob rule (PAD-272) #198
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is another rule that can be used to check that VM images are publicly available. In this case, it's when an image is a VHD file exposed publicly via public Azure Blob Storage.
The rule is implemented by performing a HEAD request against a URL formed from the rule input. If the request succeeds, the file is deemed available. If any an HTTP response comes back with any status code except 200 OK, the file is deemed inaccessible. If any error occurs while creating or sending the request, this is treated as an error that causes the rule to fail, just like how we handle errors in all rules in all plugins.
Because at the end of the day this is just testing whether a URL is publicly accessible by all HTTP clients, if we want to, this could be moved later into a new plugin for non-cloud specific use cases. At that point, Azure users could be instructed to use the new "public HTTP file" rule for their VHD image use case.
Example of rule:
Succeeded example:
Failed example (no error, but blob not accessible because path in rule doesn't match a public blob):
Failed example (error during request because Azure storage account in rule doesn't exist):