When embedding third-party videos on a page, what authorization is used for iframe's capability to pass through?
When embedding third-party videos, how should the iframe's capability authorization be granted? It needs to be considered in two layers: the source domain goes through the whitelist to be granted, and the capabilities are authorized item by item in the minimum set. Here, the iframe refers to the embedded frame, which is an area opened within the own page to carry the content of other sites. The source layer manages which sites' content is allowed to be embedded, and the capability layer manages which browser functions the content can call after entering. Both are handled by different configuration items on the page.
What does embedding third-party content bring?
The content running in the embedded frame is not static images, but a relatively complete page. It executes in its own frame context, can carry scripts, can apply for media devices, and can also play automatically under certain conditions. Therefore, video embedding involves two types of risks: whether this content comes from a trusted site, and what it is allowed to do after entering. A common oversight in actual configuration is to only pay attention to the first type, and after the domain is allowed through, it is believed that the work is done, and the capabilities layer is either fully open or fully closed.
Why does the source domain need to go through the whitelist
The object controlled by the source is 'Can be embedded'. The common practice is to maintain a list of allowed embedding domains, and sources outside the list are not rendered or degraded.PbootCMS has improved the security reconstruction of the rich text embedded framework in the update records of V3.2.18, where the default source strategy for trusted video domain names has been retained, that is, the strict-origin-when-cross-origin source reference rule is continued to be left for these domains to use.The nature of this action is reinforcement: to fix the existing trust relationship with clearer rules. Going back one record will be clearer: V3.2.17 enhanced the whitelist of embedded frames, supported wildcard subdomains, and automatically synchronized entries with accurate domain names when saving content.
Why should capability authorization be given in the smallest set
The object controlled by the ability is "What can be used after coming in." There is an allow attribute on the nested frame, which can be understood in Chinese as an authorization list, stating which capabilities such as camera, location, and auto-play are open to the frame content in an item-by-item manner.It is an easy and convenient approach to list a long list of abilities, but camera and positioning belong to sensitive abilities, which are mostly not used in video content, and each additional item adds another entry that can be called.The handling method for V3.2.18 is to do a token whitelist on the allow attribute, where the token refers to the individual capability names listed in the authorization list: only the names that fall within the whitelist will be retained, and the rest will be removed in the reconstruction process.Even if the rich text contains an authorization statement beyond expectations, only the recognized set of capability names remain on the page.
How to differentiate between precise domain and subdomain wildcard
In the whitelist, should you write an exact domain name or a subdomain wildcard? It is a choice between convenience and safety. The wildcard has a wide coverage, as video platforms often place content on different second-level subdomains, and one wildcard can cover all of them, reducing maintenance efforts;The cost is that it is not easy to tighten the range after it is relaxed. Precise domain names write each one down, with strong controllability, and one more source needs to be added, with a larger maintenance volume.These two appear in adjacent versions: V3.2.17 adds subdomain wildcard and synchronized precise domain name at save time, V3.2.18 further filters the allow authorization list item by item.This can be understood as a division of labor - wildcard is responsible for covering the frequently changing subdomains, while the precise entries are responsible for securing the confirmed sources individually.
| Control issues | Who decides | Common practice | Impact of looseness and tightness |
|---|---|---|---|
| Which sites' content is allowed to be embedded | List of source domain names | Maintain trusted video domain names, permit or deny according to domain names | Loosen for convenience but with a large coverage; tighten for safety but need to continuously supplement entries |
| What rules should embedded content carry source information according to | Framework reconstruction rules | Maintain the default source strategy for trusted sources | Keep the default to carry source information according to the rules; arbitrary changes will make troubleshooting inaccurate |
| What capabilities can be called after entering | Allow authorization list | Item by item declaration, only give the capabilities that the video indeed needs | All open is convenient but has more entries; to give the minimum set, you need to write more items |
Common questions
Question: If the source has been approved, do we still need to configure the capabilities separately?
Answer: Yes. The source list only cares about whether the content of this site can appear in the framework, and the capability authorization manages which browser functions the content in the framework can call. Approving a video domain does not mean it needs a camera or location.
Question: Why does the allow attribute need to go through a whitelist again at the save or rebuild stage?
Answer: The tags in rich text may come from paste, template, or historical content. The authorization statements entered may not necessarily comply with the current strategy. The approach in V3.2.18 is to filter by token whitelist during the reconstruction phase, retaining recognized capability names and removing the rest, so that the authorization set and list left on the page are consistent.
Question: If wildcard subdomain and exact domain exist at the same time, does it count as duplicate?
Answer: It does not count. Wildcard is responsible for covering the changing subdomains, and exact entries are responsible for keeping confirmed sources separately. PbootCMS supports subdomain wildcard in V3.2.17 and also automatically synchronizes entries with exact domain names when saving content, with each granularity managing a section.