gpt4 book ai didi

coldfusion - CFDUMP 标签是否可以修改?

转载 作者:行者123 更新时间:2023-12-04 17:28:56 24 4
gpt4 key购买 nike

使用 ColdFusion MX7,如果我们遇到异常,我们会向开发团队发送一封电子邮件,其中包含各种数据范围(包括表单结构)的转储。

这对于调试非常有用,除非用户登录时出错。我们最终将密码打印出来。

那么,问题是,有没有办法修改 CFDUMP 文件,以便它从表单对象中过滤掉密码值?

当然,我们可以将它放在发送电子邮件的相同代码中,但是最好将它放在 CFDUMP 文件中,这样我们就不必担心它会出现在其他地方。

我已经找到了 CFDUMP 文件,它似乎是二进制文件,所以我猜我们不能这样做。

最佳答案

您可以将dump.cfm 文件复制到dumporiginal.cfm,然后新建一个调用dumporiginal.cfm 的dump.cfm。

<!--- 
So that it won't execute twice if you
have a closing slash (<cfdump ... />)
--->
<cfif thisTag.executionMode neq "start">
<cfexit method="exitTag" />
</cfif>


<!---
defaults for optional attributes, taken from the docs
http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_d-e_08.html
--->
<cfparam name="attributes.expand" default="yes" />
<cfparam name="attributes.format" default="html" />
<cfparam name="attributes.hide" default="all" />
<cfparam name="attributes.keys" default="9999" />
<cfparam name="attributes.label" default="" />
<cfparam name="attributes.metainfo" default="yes" />
<cfparam name="attributes.output" default="browser" />
<cfparam name="attributes.show" default="all" />
<cfparam name="attributes.showUDFs" default="yes" />
<cfparam name="attributes.top" default="9999" />

<!--- Hide the password, but store its value to put it back at the end --->
<cfif isStruct(attributes.var) and structKeyExists(attributes.var, 'password')>
<cfset originalPassword = attributes.var.password />
<cfset attributes.var.password = "{hidden by customized cfdump}"/>
</cfif>

<!---
Call the original cfdump.
Which attributes you pass depends on CF version.
--->
<cfswitch expression="#listFirst(server.coldfusion.productVersion)#">
<cfcase value="6">
<cfdumporiginal
var = "#attributes.var#"
expand = "#attributes.expand#"
hide = "#attributes.hide#"
label = "#attributes.label#"
>
</cfcase>
<cfcase value="7">
<cfdumporiginal
var = "#attributes.var#"
expand = "#attributes.expand#"
hide = "#attributes.hide#"
label = "#attributes.label#"
top = "#attributes.top#"
>
</cfcase>
<cfdefaultcase>
<cfdumporiginal
var = "#attributes.var#"
expand = "#attributes.expand#"
format = "#attributes.format#"
hide = "#attributes.hide#"
keys = "#attributes.keys#"
label = "#attributes.label#"
metainfo = "#attributes.metainfo#"
output = "#attributes.output#"
show = "#attributes.show#"
showUDFs = "#attributes.showUDFs#"
top = "#attributes.top#"
>
</cfdefaultcase>
</cfswitch>

<!--- Restore the password, in case it's read after cfdump call --->
<cfif isDefined("originalPassword")>
<cfset attributes.var.password = originalPassword />
</cfif>

关于coldfusion - CFDUMP 标签是否可以修改?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1206031/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com