Member Junction
    Preparing search index...

    SECURITY — screens for SQL text that a client (or a client-saved record) supplies to RunView.

    ClientClauseScreen.AssertClauseUsesEntityBaseViews is the full screen: one statement, parsed as a read-only fragment, that calls no function the dialect forbids in caller SQL and whose table references are only entity base views the acting user can read unscoped (no row filter). Base tables and system catalogs are refused. Apply it at every point where client text enters RunView: the GraphQL and REST entry points, ad-hoc list sources, and the clauses a saved view stores (at save and when the view runs).

    ClientClauseScreen.AssertSingleStatementFragment is the light check the provider runs on every RunView, server-internal ones included: no statement separator and no comment outside a literal or quoted identifier. It cannot refuse a legitimate fragment, so it is safe for callers whose filters the full screen would refuse (base tables, entities the acting user cannot read).

    Both use dialect-aware lexing, so a quote inside a bracket identifier ([a']) or a PostgreSQL E'\'' string cannot hide a statement the way it hides one from the keyword denylist.

    Index

    Constructors

    Methods

    • The full screen for one client clause fragment; throws when it refuses. The label OrderBy screens the text as an ORDER BY list; any other label screens it as a WHERE predicate. When user is given, every entity the fragment reads must be readable by that user, unscoped (AssertUnscopedRead). That includes the entity the clause filters: a subquery over its base view is outside the row filter RunView applies to the outer query.

      The reads come from a walk of the whole parse tree (CollectStatementReads), and the clause is refused when that walk does not account for every SELECT in the text (AssertEverySelectAccountedFor). Only the parse wrapper's own FROM item is skipped, and no CTE reference is exempt. A name reserved for the parser (AssertNoIdentifierAliasNames) and a call to a function the dialect forbids (AssertNoForbiddenFunctionCalls) are refused first.

      With LeaveUnparseableToProvider, text the parser cannot read returns without a refusal; the caller's own per-item check must refuse it instead.

      Parameters

      Returns void

    • Refuses a statement separator or a comment outside literals and quoted identifiers. A filter or sort fragment never needs either, so this cannot refuse a legitimate clause.

      Parameters

      Returns void

    • Resolves a table reference against the allow-list and returns its entity; throws when it is not an entity base view, or when user is given and lacks CanRead on that entity.

      A schema-qualified reference, dbo included, must match an entity in that exact schema. An unqualified one resolves only when the view name is unique across schemas, because the database's default-schema resolution, not this screen, would pick which view runs.

      Parameters

      Returns EntityInfo

    • Refuses an entity whose read user holds under a row filter (role row-level security). SQL that reads the entity's base view directly, such as a subquery in a client clause or an ad-hoc query, does not apply it; RunView on that entity does. For any other entity, a granted read covers every row and field of its base view.

      lts/5: row-level security is the only read narrowing on this line (no field-level security and no API-key row filters), so GetUserRowLevelSecurityWhereClause is the full read filter.

      Parameters

      Returns void

    • Every FROM item in a parsed statement, and the number of SELECT nodes. The walk visits every property of every node, so it finds a FROM list wherever the grammar puts one: a subquery in a CASE branch, HAVING, a window's ORDER BY or PARTITION BY, a function argument, IN, EXISTS, a set operation or a CTE body. Every FROM item is kept, even when its alias repeats. Names the fallback parse renamed are read back through SQLParser.IdentifierAliases, which holds only names the parser put in the tree. skip is a FROM item node to leave out (the screen's parse wrapper).

      Each FROM item records whether it reads a CTE in scope there (StatementRelation.IsCTEReference). A WITH covers its own SELECT, everything below it, and the following set-operation branches unless its SELECT is a parenthesized branch. A CTE body sees the CTEs before it, itself on SQL Server, and every CTE of a PostgreSQL WITH RECURSIVE list. Names match by the dialect's identifier rules (cteNameRules). The walk keeps a count of the CTEs of each name in scope as it goes, so its time is linear in the tree.

      Parameters

      Returns StatementReads