问题描述
鉴于我创建了一个API,其中某些参数反映在API的输出中。根据消费者,它可能会带来安全风险。如果输出以例如如果不先对WebView进行消毒,则存在以下风险:易受攻击的JavaScript代码可以在WebView的上下文中运行。
因此,我想知道是否有人知道如何在IICS中建立用于输入验证的方法?
到目前为止,我已经尝试过: 这是子流程的输入:
<a>
<Input1>{fn:matches($input.input[1]/Input1,'[a-zA-Z0-9]\.[a-zA-Z0-9]')}</Input1>
<Input2>{fn:matches($input.input[1]/Input2,'^[a-zA-Z0-9]+$')}</Input2>
<Input3>{fn:matches($input.input[1]/Input3,'^[a-zA-Z0-9]+$')}</Input3>
<Input4>{fn:matches($input.input[1]/Input4,'^[a-zA-Z0-9]+$')}</Input4>
</a>
在子流程中具有以下两个分配步骤: 作业1:
(: Return a list of positions where the regex Failed :)
for $elem at $i in $input.input_obj/*
where ($elem = 'false')
return <a>{$i}</a>
分配2(子流程的输出):
(: Returns the first name of the field where the regex fails :)
$input.input_obj/*[$temp.firstFalse[1]/text()]/name()
和
(: Returns true if the list is empty :)
fn:empty($temp.firstFalse)
如果列表为空,则主过程继续。否则,一个里程碑将为用户提供有关哪些输入字段验证失败的反馈。
但是这种方法不是通用的,因为它仅适用于可以将每个字段添加到xml列表进行循环的输入对象。
如何使此方法更通用,以便用于其他格式的输入对象,例如xml对象,大文本对象等?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)