Skip to content

citry check misses strict-CSP problems written as constant expressions #498

Open

Description

@JuroOravec

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

  1. Read constant expressions in Citry bindings. When a c-* attribute, or a key in a literal c-bind dict, 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.
  2. 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), so c-onclick escapes the check although it writes an onclick attribute whatever its value. Decide whether to report every c-on* binding, or only those with a constant value.
  3. Decide whether to read constant Vue bindings too, such as :href="'javascript:x'". Neither check sees these today.
  4. Add a catalog field for a rule whose severity follows a setting. Today citry.template.csp-incompatible uses defaultSeverity: "ignore" and an exemption in test_diagnostics.py (_SETTING_SWITCHED_CODES). A field in packages/protocol/diagnostics/v1/catalog.json would let the docs and the editor say "follows security_csp" from the catalog. The schema stays at version 1.
  5. Update docs/design/security_csp.md section 4.3, which still says CSP problems are found only when a page renders.

Done when

  • citry check and 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.py covers 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.

Activity

  1. added
    next-sprint
    on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    next-sprint

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions