Skip to content

feat(tenancy): create database using schema from existing tenant when a project is in tenant mode#295

Merged
spinningbot merged 32 commits into
mainfrom
tenant3
Dec 30, 2021
Merged

feat(tenancy): create database using schema from existing tenant when a project is in tenant mode#295
spinningbot merged 32 commits into
mainfrom
tenant3

Conversation

@spinningbot

Copy link
Copy Markdown
Contributor

No description provided.

@render

render Bot commented Dec 30, 2021

Copy link
Copy Markdown

@spinningbot spinningbot requested a review from tianzhou December 30, 2021 05:42
@spinningbot

Copy link
Copy Markdown
Contributor Author

@RainbowDashy

Comment thread server/issue.go
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated

@spinningbot spinningbot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated
Comment thread server/issue.go
Comment thread server/issue.go Outdated
@spinningbot spinningbot requested a review from tianzhou December 30, 2021 09:47

@tianzhou tianzhou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs more work

Comment thread server/issue.go Outdated
Comment thread server/issue.go
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated

@spinningbot spinningbot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

Comment thread server/issue.go Outdated
Comment thread server/issue.go
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated
@spinningbot spinningbot requested a review from tianzhou December 30, 2021 11:29
Comment thread server/issue.go Outdated
Comment thread server/issue_test.go
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated

@spinningbot spinningbot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated
Comment thread server/issue.go Outdated
Comment thread server/issue_test.go
@spinningbot spinningbot requested a review from tianzhou December 30, 2021 12:01

@tianzhou tianzhou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@spinningbot spinningbot merged commit 25e4251 into main Dec 30, 2021
h3n4l added a commit that referenced this pull request Jun 10, 2026
…SpanWithCatalog

Activates the omni lineage fixes for the seven audited Trino under-masking
vectors (BYT-9674..BYT-9680, sub-issues of BYT-9142): columns reaching a
sensitive base column through derived tables, CTEs, UNNEST, scalar subqueries,
set-operation arms, views, and SELECT * over derived relations previously had
empty/wrong lineage, so the result masker fell through to NoneMasker and
returned the values unmasked.

- Bump github.com/bytebase/omni to v0.0.0-20260610061900 (bytebase/omni#286
  additive lineage resolver, #296 provably-width-correct star expansion, #295
  catalog-aware view lineage).
- The query-span extractor now calls analysis.GetQuerySpanWithCatalog with a
  catalog built from instance metadata: views carry their defining query (so
  lineage through a view reaches the base-table columns masking config attaches
  to) and tables carry their column lists (so omni expands SELECT * to the
  exact projection — the positional masker stays aligned). Catalogs load
  lazily and TRANSITIVELY: a view definition referencing another catalog pulls
  that catalog in, so cross-catalog views resolve. Metadata fetches reuse the
  extractor's cache.
- completion.go fills catalog.View.Definition too (shared catalog model).
- IsPlainField now keys on the mapped physical source set (the additive
  resolver restates a plain column as written + qualified refs, which dedupe
  back to one column); inert for Trino, documented drift for repeated-column
  expressions.

Tests: 7 consumer-level audit regressions (query_span_lineage_test.go, one per
leak vector — including the SELECT*-over-derived positional repro pinned at
exact width/order) + 8 view-lineage tests carried from the superseded #20560
plus a new cross-catalog view test. Full trino parser/schema + api/v1 suites
green.

Notes for review:
- omni now surfaces a view definition's base tables in AccessTables, so
  access checks also consider tables read through views (visibility change).
- The pre-existing USING/NATURAL-join opaque-star positional residual is
  unchanged: appended view-def tables land at the END of AccessTables, beyond
  the executed result width, so they are never indexed by the masker.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
d-bytebase pushed a commit that referenced this pull request Jun 10, 2026
…alog (BYT-9674..9680) (#20565)

* feat(trino): catalog-aware masking lineage — bump omni, wire GetQuerySpanWithCatalog

Activates the omni lineage fixes for the seven audited Trino under-masking
vectors (BYT-9674..BYT-9680, sub-issues of BYT-9142): columns reaching a
sensitive base column through derived tables, CTEs, UNNEST, scalar subqueries,
set-operation arms, views, and SELECT * over derived relations previously had
empty/wrong lineage, so the result masker fell through to NoneMasker and
returned the values unmasked.

- Bump github.com/bytebase/omni to v0.0.0-20260610061900 (bytebase/omni#286
  additive lineage resolver, #296 provably-width-correct star expansion, #295
  catalog-aware view lineage).
- The query-span extractor now calls analysis.GetQuerySpanWithCatalog with a
  catalog built from instance metadata: views carry their defining query (so
  lineage through a view reaches the base-table columns masking config attaches
  to) and tables carry their column lists (so omni expands SELECT * to the
  exact projection — the positional masker stays aligned). Catalogs load
  lazily and TRANSITIVELY: a view definition referencing another catalog pulls
  that catalog in, so cross-catalog views resolve. Metadata fetches reuse the
  extractor's cache.
- completion.go fills catalog.View.Definition too (shared catalog model).
- IsPlainField now keys on the mapped physical source set (the additive
  resolver restates a plain column as written + qualified refs, which dedupe
  back to one column); inert for Trino, documented drift for repeated-column
  expressions.

Tests: 7 consumer-level audit regressions (query_span_lineage_test.go, one per
leak vector — including the SELECT*-over-derived positional repro pinned at
exact width/order) + 8 view-lineage tests carried from the superseded #20560
plus a new cross-catalog view test. Full trino parser/schema + api/v1 suites
green.

Notes for review:
- omni now surfaces a view definition's base tables in AccessTables, so
  access checks also consider tables read through views (visibility change).
- The pre-existing USING/NATURAL-join opaque-star positional residual is
  unchanged: appended view-def tables land at the END of AccessTables, beyond
  the executed result width, so they are never indexed by the masker.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(trino): extract shared loadCatalogMetadata for completion + span catalog builders

SonarCloud flagged the span-catalog builder as a structural clone of the
completion builder (26.1% duplication on new code). One helper now populates a
catalog's schemas/tables/views (with definitions) for both paths; the span
builder keeps its transitive worklist, completion its per-keystroke shape.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants