040 securirty fix

This commit is contained in:
msyu
2024-12-26 17:14:15 +03:00
parent 11c0f0cec0
commit 22f3775d84
4 changed files with 18 additions and 9 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
v1/etc/info/
v1/etc/
build/manifests/
+16 -8
View File
@@ -71,7 +71,7 @@
//variables.framework.docs={};
variables.framework.docs.APIName="Deck API";
variables.framework.docs.APIVersion="0.039";
variables.framework.docs.APIVersion="0.040";
variables.framework.globalHeaders = structNew();
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
@@ -110,10 +110,10 @@
<cffunction name="locateIamService"><!--- *** архитектурный колхоз --->
<cfloop list="https://personal-cabinet.adl.nubes.ru/api/v1/user,https://deck.ngcloud.ru/api/v1/user" index="serviceUrl"><!--- *** начиная с девелоперского --->
<cfloop list="https://deck-test.ngcloud.ru/api/v1/user,https://deck.ngcloud.ru/api/v1/user" index="serviceUrl"><!--- *** начиная с девелоперского --->
<cftry>
<cfhttp url=#serviceUrl# method="OPTIONS" result="resp" timeout=1/>
<!--- <cfdump var=#resp#/> --->
<cfreturn serviceUrl/>
<cfcatch type="any">
<!--- <cfdump var=#cfcatch#/> --->
@@ -178,13 +178,21 @@
var httpService = new http(method = "GET", charset = "utf-8", url = #this.iamServiceUrl#, timeout="3");
httpService.addParam(type = "HEADER", name = "Accept", value = "application/json");
httpService.addParam(type = "HEADER", name = "Authorization", value = "#auth#"); //passthrough
var resp = httpService.send();
var result = resp.getPrefix().filecontent;
if (resp.responseheader.status_code NEQ 200) throw("IDP response not OK");
//writedump(this.iamServiceUrl);abort;
var resp = httpService.send();
//if (resp.status_code NEQ 200) throw("IDP response not OK");
//writedump(resp);abort;
var prefix = resp.getPrefix();
if (prefix.status_code NEQ 200) throw("IDP response not OK");
var result = prefix.filecontent;
//writedump(result);abort;
} catch (e) {
if (fileExists("#GetDirectoryFromPath(GetCurrentTemplatePath())#/etc/local-debug")) { //true for local debug without IDP, etc/* does not go to repository
/*if (fileExists("#GetDirectoryFromPath(GetCurrentTemplatePath())#/etc/local-debug")) { //true for local debug without IDP, etc/* does not go to repository
var result='{"accounts":[{"login":"","type":"telegram"}],"avatar":["d2d2b7ac-50af-432b-b7c4-f7d6561e288a"],"company":"ООО «НУБЕС»","companyId":"8ec70ac0-546d-42a7-8cff-339c8fb51a23","contactId":"983967a3-58c2-4cdd-84a5-8b427ccfac82","email":"smishchuk@nubes.ru","externalUser":false,"fio":{"fullName":"Мищук Сергей ","name":"Сергей","secondName":"","surname":"Мищук"},"groupIds":["94bf5be7-52f4-5c13-87c3-513786934685","ab12b6b8-0265-4683-a5c2-5e1a74a55216","aff008c3-7443-50f6-86e1-ecff3cd3b04d","d6000da0-c9aa-55eb-9882-f118b432730b","d89a33dc-3177-5854-9580-f7f860a5ab7c","ddfe2555-9ef4-42cb-9a2b-7f24e61e7747","df12926f-ecb8-5479-857f-6d291464baad","fda5c295-230a-5025-9797-b8b4e99e08aa","2be9b4b6-94d1-59f9-a649-cab228d82169","64fe6f5c-a91b-5fea-a7ca-d9823701ebd4"],"integration":{"serviceId":""},"login":"smishchuk@nubes.ru","mobilePhone":[],"position":"","userId":"d72530e1-66a4-412f-a046-38153c4e5405"}';}
*/
//writedump(resp);
//return representationOf( {"exception"=e} );
return representationOf( {"exception"=e, "idpResponse"=result} );//.withStatus(500);
}
//writeDump(result); abort;
View File
+1
View File
@@ -3,6 +3,7 @@
<!---v2 11:21 16.11.2020--->
<!---v3 14:15 16.11.2020 input struct instead of array--->
<!---v4 2024-10-15 input ANY--->
<!---v5 2024-12-23 default order --->
<cfparam name="ATTRIBUTES.sortCollection" type="any">
<cfparam name="ATTRIBUTES.fieldCount" type="integer" default=0>