Repository navigation
Open
Labels
next-sprintPlanned for the next sprint, not tied to a release version
Description
When an app sets security_csp to "warn" or "strict", citry check and the editor report inline scripts and styles, on* attributes, and javascript: URLs written as fixed text in a template (#478). They skip every binding, even when its value is a constant that is already known before the page renders:
<a c-href="'javascript:void(0)'">Open</a>
<a :href="'javascript:void(0)'">Open</a>
The first is reported only when the page renders. The second is never reported, because Vue sets it in the browser and the render-time check does not see it. For a Vue page this static check is the only coverage, since Citry does not server-render a Vue page when security_csp is on.
These are the follow-ups listed under "Not in this PR" in #478, plus related gaps found while checking.
Items
- Read constant expressions in Citry bindings. When a
c-*attribute, or a key in a literalc-binddict, is a string literal (or uses no variables), check its value with the same shared rule (_csp_attribute_problem) as a fixed attribute. Report at the literal's range. - Report Citry bindings whose name alone is the problem. The rule skips any name that starts with
c-(packages/py/citry/citry/_markup_lint.py), soc-onclickescapes the check although it writes anonclickattribute whatever its value. Decide whether to report everyc-on*binding, or only those with a constant value. - Decide whether to read constant Vue bindings too, such as
:href="'javascript:x'". Neither check sees these today. - Add a catalog field for a rule whose severity follows a setting. Today
citry.template.csp-incompatibleusesdefaultSeverity: "ignore"and an exemption intest_diagnostics.py(_SETTING_SWITCHED_CODES). A field inpackages/protocol/diagnostics/v1/catalog.jsonwould let the docs and the editor say "followssecurity_csp" from the catalog. The schema stays at version 1. - Update
docs/design/security_csp.mdsection 4.3, which still says CSP problems are found only when a page renders.
Done when
citry checkand the editor report items 1 and 2 with"warn"and"strict", at the expression's range, and stay silent with"off".- The agreement test in
test_markup_lint.pycovers constant bindings, and lists any deliberate difference from the render-time check with its reason. - The decision on item 3 is recorded in the design doc, with tests if it is implemented.
- The catalog field exists, or the issue records why the exemption stays; section 4.3 of the design doc matches the code.
Metadata
Metadata
Assignees
Labels
next-sprintPlanned for the next sprint, not tied to a release version
Activity