From 4e4d4989139732009ca2080cd9c9b4173c2b0938 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Wed, 9 Oct 2024 11:58:40 +0530 Subject: [PATCH] Verify app in deployment request with auction when deploying --- stack_orchestrator/deploy/webapp/util.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/stack_orchestrator/deploy/webapp/util.py b/stack_orchestrator/deploy/webapp/util.py index e389ccb4..92d5ddc8 100644 --- a/stack_orchestrator/deploy/webapp/util.py +++ b/stack_orchestrator/deploy/webapp/util.py @@ -882,6 +882,21 @@ def confirm_auction(laconic: LaconicRegistryClient, record, deployer_lrn, paymen auction_id = record.attributes.auction auction = laconic.get_auction(auction_id) + # Fetch auction record for given auction + auction_records_by_id = laconic.app_deployment_auctions({"auction": auction_id}) + if len(auction_records_by_id) == 0: + logger.log(f"{record.id}: unable to locate record for auction {auction_id}") + return False + + # Cross check app against application in the auction record + requested_app = record.attributes.application + auction_app = auction_records_by_id[0].attributes.application + if requested_app != auction_app: + logger.log( + f"{record.id}: requested application {requested_app} does not match application from auction record {auction_app}" + ) + return False + if not auction: logger.log(f"{record.id}: unable to locate auction {auction_id}") return False