Repository navigation
Description
The question
Should Citry check or allowlist the scheme of a URL that data puts in a link attribute (href, src, action) through c-bind? Today it does not, like plain Vue, Jinja and Django. Citry UI (Citry's component library) checks the URLs it accepts. How should deep links be handled?
c-bind is the template syntax that spreads a Python dict of attributes onto an element. A deep link is a link that opens a native app, such as myapp://item/3. The scheme is the part before the first colon, such as https.
This is a design question about a documented default, not a report of a bug. The security page says in "Check URL attributes" that the app checks the scheme itself before it passes request data to one of these attributes, because a javascript: URL in a link runs when a visitor clicks it.
What happens today
- Citry escapes a value for the place it lands, but it does not look at the scheme of a URL given to a plain HTML attribute.
- The opt-in settings
security_cspandsecurity_javascriptscan the finished page and report ajavascript:URL in a link attribute, wherever the value came from. Neither is on by default, and neither sees what Vue builds in the browser from a binding such as:href. - The Citry UI components that take a link or an image URL refuse other schemes themselves: links accept a relative URL,
http:,https:,mailto:,sms:andtel:. actions.Redirecthas its own scheme check since 0.7.0, and Add a helper to check that a redirect URL stays on the site #568 plans a helper that checks a redirect URL stays on the site.
Options
- Keep the default and the docs. Nothing changes. App authors check the scheme.
- Check by default. A value that data puts in a link attribute must be a relative URL or use an allowed scheme. For links the list would be
http:,https:,mailto:,sms:andtel:, as in Citry UI. Image sources also needdata:image/andblob:, sosrcgets its own list. A setting lists more schemes for apps with deep links. - Check when asked. The same rule, behind a setting that starts off, like the other output checks.
Questions to answer
- Which attributes does the rule read? The output check already has a list:
href,src,action,formaction,xlink:href, anddataon<object>. - Which ways of setting them does the rule cover?
c-bindis one.c-href="...",href="{{ ... }}"and a Vue:hrefcarry data the same way, and a Vue binding cannot be checked on the server. - What happens to a refused value: the render raises
ValueError, the attribute is dropped, or the render warns? Raising is easiest to find in a test; dropping hides the mistake. - Does the rule apply to a URL the template author writes literally, or only to a value that comes from a binding?
- How does an app allow a deep link: a list of schemes, a list of full URLs, or a function it supplies? A setting that lists
javascriptshould be rejected when the app is built, withValueError. - How does the rule read the URL? It should read it as a browser does: leading spaces, tabs and line breaks the browser removes, and letters in any case (see Add a helper to check that a redirect URL stays on the site #568).
Security pass
Options 2 and 3 add or change a security check. They need a written plan and the security pass that CLAUDE.md asks for before a change merges (Mechanism 7), with every way a value can reach these attributes listed.
Done when
- One of the three options is chosen, with the reason.
- If a check is added: the rule is one function that every path calls (with and without Vue, and from a cached render), its refusal is tested for each attribute, and the security page describes it.
Activity
JuroOravec commentedon Nov 13, 2026
Decision for 1.0: the current behavior stays. Citry does not check the scheme of a URL that data puts in a link attribute, and the app checks the scheme itself, as the security page says under "Check URL attributes". An opt-in scheme allowlist may come after 1.0, so this issue stays open for it.
Two small follow-ups come with this choice:
sms:scheme to the security page.Both are listed in the 1.0 plan (#624). Neither is part of this decision, and neither is done yet.
refactor: read URL schemes with one Rust reader on the server (#601) (#…