azure-ad-b2c - Why is Azure AD B2C restricting the use of the 'for' attribute in custom UIs?
问题描述
Does anyone know why the sanitizerPolicy
applied by B2C does not have the for
attribute listed within the allowedAttributes
list or if it's possible to modify the policy? I cannot think of any real vulnerability with allowing use of that attribute but instead it's stripped by the HTML sanitization of the HTML retrieved from the custom UI source. There is very little documentation to be found on the sanitizerPolicy.
The sanitizerPolicy
is complex property contained within the SETTINGS
JavaScript object which is injected by the Expression framework (so B2C itself) into the B2C UI and used when loading remote content (e.g. custom UI HTML and CSS) for a specific content definition. The injected settings are then applied by JavaScript functions (e.g. sanitizeHTML) which are also injected by default by the Expression Framework. The functions and settings are used to restrict the HTML being served by the remote source (via the LoadUri
property of the ContentDefinition in the Expression Framework). There is little or no documentation on this so no useful links can be provided
The current allowedAttribute
array within the sanitizerPolicy
is as follows:
['id', 'class', 'href', 'name', 'data-*', 'aria-*', 'type', 'lang', 'src', 'sizes', 'role', 'placeholder', 'title', 'width', 'height', 'style']
Context: My use case is that I would like to have a password policy toggle purely in CSS which makes use of a hidden checkbox and a label bound to the checkbox using the for
attribute but alas no binding as the for
attribute is stripped from the label element by the sanizterPolicy upon rendering my custom ui.
There is a closed GitHub issue relating to a request to add proper documentation on this functionality. The location of that documentation is unknown nor is any link to other open tasks to delivery same provided.
解决方案
我刚刚收到 Azure 支持工程师的回复,确认在 Azure B2C 场景下自定义 UI 时不支持“for”属性。目前,他们表示目前需要关于此行为的更好的文档。
推荐阅读
- python - 相对于其他数据框中的 bin 值从数据框中提取行(不使用列名)
- c# - 为什么当我更改 DropDownList 上的选择时没有触发事件?
- python-3.x - 如何将控制台输出转换为 txt 文件(使用 python 烧瓶服务器)
- node.js - 这个场景如何实现:调用serverA上的api自动去serverB运行请求,返回response给serverA
- java - 将 TIMESTAMP 列从 PostgreSQL 映射到 LocalDate
- java - 如何将 byte[] 转换为 Java 中字节码的文本表示?
- visual-studio-code - 当我按下 Ctrl + P 时,我可以配置 VS Code 以复制选择和搜索吗?
- google-chrome-extension - Chrome 扩展通过比较 URL 来提供反馈
- debugging - VS17 Professional 15.7.5 在 ashx 文件中悬停调试时不显示变量
- javascript - 如何处理鼠标和键盘的点击事件?