At which layer should the site clean the cross-site scripting brought by the third-party embedded card

📅 October 10, 2026 👁️ 6

The cross-site scripting brought by third-party video and image card insertion in the article should be cleaned before publishing or blocked during frontend rendering? The answer is both layers are needed, because embedded cards and author-written text are not the same type of risk, and cannot be cleaned only at one layer.The WordPress of the peer system was released on October 6, 2026, in the security maintenance version, listing a fix for the 'Imgur embed exists cross-site scripting (XSS)' vulnerability.The conclusion can be as follows: The content embedded is generated by an external service, which bypasses the normal field filtering, so simply doing front-end escaping is not enough; and only reviewing before publication cannot prevent the external service from changing the returned content later.A reasonable approach is to divide into three layers - collecting and storing time limits, pre-release review marks, and releasing to the front-end according to the whitelist when outputting.

From which step does the script in the embedded card come in

The input of ordinary rich text is the author of the site itself, while the input of embedded content is from external services. There are three nodes on the chain where scripts may be introduced:

The first step is to retrieve the stage. The site uses the address to request the embedding interface of the other party (such as oEmbed mechanism), and get back a segment of content mark decided by the other party. The character string typed by the author is no longer written into the database.

The second step is the rendering stage. The returned mark often contains scripts, event attributes, and cross-domain resource references; when the browser executes it, the context is the current site, so it can read the page status and submit requests. This is the execution surface of cross-site scripts.

The third step is change. The return of external services today is clean, but it does not mean it will still be so after half a year; the characteristic of the risk of embedded classes is that the content is not under the control of the site, and the review has only been done at the moment of entry, which is equivalent to giving others long-term validity**.

These three steps explain why 'the author did not write the script' does not constitute a security basis: the script does not come from the author, but from the return outside the subject.

Why is it not enough to rely solely on front-end escaping?

The escaping resolves the issue of 'displaying tags as text'. If the entire embedded content is escaped, the card cannot be rendered as a video or image, and the function directly disappears; if embedded tags are allowed, it is equivalent to opening an exception hole in the output layer, and the size of this hole depends on which tags and attributes are allowed.

Common two invalid writing methods: First, make exceptions as 'the entire rich text is not escaped', causing both the author's text and embedded tags to lose protection; second, allow the entire domain, ignoring that the allowed domain may also be misused or return tags with scripts. The correct posture at the output layer is to fall on tags and attributes rather than on the 'this is embedded content' category of source.

What to look at for content review and sensitive word filtering before publishing

Two levels of responsibility are different and easy to mix. Sensitive word filtering and keyword replacement deal with textual violations, which belong to the dimension of content and compliance; content review deals with whether this content can be published, and it can include safety checks such as whether it contains scripts or if the source is controlled.

AnQiCMS has backend capabilities on these two layers: content security settings support sensitive word filtering and keyword replacement, content review; on the security mechanism, built-in JWT authentication, content sensitive word filtering and anti-crawling interference code are integrated to prevent SQL injection and XSS attacks. When embedded content is landed into this mechanism, it is recommended to add a check item for marking in the content review rules (whether there are script tags, event attributes, and cross-domain resources), and maintain it separately from 'sensitive words' because the judgment objects are different.

How to implement the three layers of internal protection, and what is the self-inspection sequence?

Arrange according to the data stream from top to bottom:

Collection and storage layer. AnQiCMS supports content collection and can automatically collect content from other websites; the intake point of this layer is the source and field range - the part with script tags in the collected text should be cleaned according to the whitelist instead of being stored as is. Bulk collection is more likely to bring in external tags in whole segments than manual pasting, and the risk is greater.

Pre-publication layer. Use content review to block content containing uncontrolled tags, sensitive word filtering and keyword replacement to handle text violations. This layer is suitable for 'reject and give a reason' because it does not interrupt the front-end access in the manual process.

Front-end output layer. Allow embedded tags based on the whitelist of tags and attributes, and escape the rest. At the same time, keep the anti-crawling mechanism: AnQiCMS's anti-crawling interference code is used to protect content from being bulk-crawled, which handles another type of problem (content being taken in bulk), and cannot replace script cleaning, but can be configured together with the output layer.

Suggested four-step self-inspection sequence:

  1. Take an old article with an embedded card, check the original tags stored in the database, and confirm whether the script comes from the stored content or the current external request.
  2. Use a segment of tags with event attributes for a release test to see if review and filtering block it, as well as at which layer the interception occurs.
  3. Check the release range of the output layer, confirm that the exception only covers controlled embedded tags, not the entire rich text.
  4. Check the inventory results of the collection function, confirm that the content collected in bulk has also been cleaned.

Common questions

Can embedded content be banned directly?Yes, this is the most hassle-free option: only allow images and videos to use the site's own material library. The cost is that external videos in articles will have to be replaced with screenshots and link descriptions.

Is it enough to upgrade to the latest version only?The version fixes a specific embedded implementation issue, and the overall risk surface brought by the embedded content is still there: changes in external service returns, new source domains, are all outside the patch coverage range. Layered control still needs to be done.

What layer does adding content security policy (CSP) count as?It is a bottom-line measure outside the output layer, used to limit the source and execution capabilities of scripts. It can reduce the success rate of exploitation, but does not change the fact that 'uncleaned tags have already been stored in the database', and still needs to be cleaned at the entry and publishing layers.

How do you determine that something has already happened?Look for two types of traces: external script addresses that do not belong to any embedded syntax appearing in the main text, and unexpected jumps or pop-ups appearing on the front-end page. After finding them, check back in sequence from collection to storage, before publication, and to the output layer.

Related articles

AI can capture the list page but not the detail page, which layer should be checked first?

The list page can be read, but the detail page cannot be read. The most effective way is to search layer by layer according to 'Entry List—Link Accessible—Content Renderable': First, confirm whether the detail page is listed in the site description file and sitemap provided for the model, then confirm whether the pseudo-static address of the detail page can be directly accessed, and finally check whether the new content has been submitted to the search channel. Each layer corresponds to different repair actions, and directly modifying the rendering by skipping the first two layers is usually ineffective.

2026-10-10

When choosing a content management system, what three questions should be clarified about the degree of interface openness?

When evaluating the openness of an interface, it is worth clarifying three questions: whether the capability list is complete and divided by domain, how the authorization method and exposure range are determined, and whether there is a confirmation step for write operations. The three questions correspond to visibility, boundaries, and risks, which can all be verified by documentation and a single practical test; high openness does not equal loss of control, the key is whether the granularity falls within the capability domain and actions.

2026-10-10

The official website says it is a permanently open-source and free website building system, what should be checked when selecting it

'Permanent open source and free' is the self-description on the official website, it should be divided into three layers to verify: cost of acquisition, usage conditions, and ability boundaries. The authorization statement of peer systems writes that it is free for commercial use, and obtaining a free domain authorization code through the official website counts as authorization and is permanent, while a common authorization code is only used for specified domains; these conditions should be verified for specific projects, and then compared with the actual content model and multi-site and multi-language capabilities needed by the corporate website.

2026-10-10

Can read which content in the station without logging in, whether to seal it off

According to the official manual, publicly available articles, pages, and categories on the site can be read through the interface by default, while encrypted content, internal users, custom types, and metadata require identity verification to access. The closure is not to shut down the interface as a whole, but to divide the exposed range by capability domain, collect permissions by user group, add confirmation steps to writing operations, and first test the visible surface with an unlogged request.

2026-10-10

The same CMS released seven security repairs in one go, how should the administrator follow up in order?

When releasing multiple security fixes at once, the follow-up order should be to confirm the ability to roll back, then upgrade, and finally check credentials and files. When reading the announcement, first look at the first three lines: the distribution of the number and type of fixes, whether an immediate update is required, and which branches the fixes have been rolled back to. Taking the security maintenance version of the peer system on October 6, 2026, as an example, it contains seven security fixes and four defect fixes, rolled back to earlier branches, and only the newer versions are being actively supported.

2026-10-10

How could a function that converts relative addresses to absolute addresses become an entry point for denial of service?

The public function that converts relative addresses to absolute addresses can become a source of denial of service problems because the cost of parsing and concatenation is determined by the external input. The approach to closing it is to first limit the source and length of the address, and then enter parsing, and process the remote capture and collection chain in the same order.

2026-10-10

What problems can arise when parameters are spliced into the action name, and how can such name splicing be self-checked?

When the request parameter is spliced into the internal action name or hook name, the caller may trigger an action that should not be triggered, resulting in unauthorized access or chaotic behavior. The self-inspection points are to find all the locations where parameters are spliced into names, converge the allowable values into a whitelist, and then check each item in the enumeration status.

2026-10-10

A module specifically designed for IP access restriction has been bypassed, can the whitelist still be considered as a line of defense?

When the module for access restriction based on IP itself is bypassed, the whitelist is still a line of defense, but it cannot be used as the only line of defense. It should be used in conjunction with account group permissions, interface exposure range control, and multi-site rule setting, so that the consequences will not be magnified when a single point fails.

2026-10-10