-
Notifications
You must be signed in to change notification settings - Fork 177
Description
Expected Behavior
If an asset definition is failed to be fetched from the store or if an asset fails to download/extract, the consumer of the resource (check, handler, etc.) should not proceed with execution.
if you have multiple assets that provide a binary with the same name, an asset failing to be retrieved from the store could result in a different binary being executed
Current Behavior
We currently log errors when calling asset.GetAssets()
but continue on with execution of the resource, regardless of what kind of error occurs.
We attempt to stop execution if store.ErrInternal
is returned from asset.GetAll()
but it can never return that error as it doesn't interact with the store; asset.GetAssets()
does.
https://github.com/sensu/sensu-go/blob/main/backend/pipeline/handler.go#L244
Line 11 in 3732d6c
func GetAssets(ctx context.Context, store store.Store, assetList []string) []types.Asset { |
If we allow for execution to continue after asset retrieval failures, it could result in other binaries with the same name (from the system or other runtime assets) being executed instead of the expected binary.
Possible Solution
Update asset.GetAssets()
to return errors. Update error checks to return if an error is returned from asset.GetAssets()
or asset.GetAll()
.