Skip to content

fix(security): access control hardening - #37796

Merged
pmbrull merged 13 commits into
mainfrom
fix/21rt-security-hardening
Nov 17, 2026
Merged

pmbrull merged 13 commits into
mainfrom
fix/21rt-security-hardening

Conversation

@mohityadav766

@mohityadav766 mohityadav766 commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

A batch of access-control hardening fixes from 2.1 release testing, one commit per area:

  • Column reads: field-level checks on the table column endpoints.
  • Search: asset counts for tags and glossary terms.
  • Attachments: soft delete.
  • AI governance: framework fork.
  • Context Center: file edits inside folders.
  • UI: Knowledge Graph tab visibility.
  • Secrets: regression coverage for secret-manager cleanup of removed connection elements.

Each commit carries its own regression tests. Details are tracked internally.

Addresses open-metadata/openmetadata-collate#7797
Addresses open-metadata/openmetadata-collate#7963

Needs a 2.1 backport after review.

Type of change:

  • Bug fix

Checklist:

  • I have read the CONTRIBUTING document.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests around the new logic.

🤖 Generated with Claude Code

Review follow-up (2026-11-14)

Column custom-metric access now derives its required operation from ViewOperations instead of duplicating the table mapping. A regression changes the registered operation and checks that the column endpoint follows it. Focused unit run: 26 passed; UI: 153 passed; MySQL/Elasticsearch integration run: 56 passed; PostgreSQL/OpenSearch search-access integration run: 5 passed.


Summary by Gitar

  • Data migration:
    • Upgrade step re-derives Context Center file FQNs from their folders and moves matching tag_usage rows
  • Column access:
    • Column reads and searches drop profile and customMetrics fields the caller may not view
  • Asset counts:
    • Tag and glossary term asset counts exclude assets the caller's search policies deny
  • Attachments:
    • Soft delete marks only the targeted attachment as deleted
  • Visibility:
    • Knowledge Graph tab appears only for admins when RDF is enabled

This will update automatically on new commits.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the previous tag-loss issue is addressed and no new actionable issues were found.

Summary

This PR tightens access checks for column fields and asset counts, fixes attachment deletion and framework copying, preserves folder names when editing Context Center files, and limits the Knowledge Graph tab to admins.

  • Column reads keep restricted fields out unless the caller has permission.
  • Tag and glossary counts include only assets the caller can see.
  • Context Center edits and upgrades keep folder-based file names.
  • Soft-deleting an attachment changes only that attachment.
  • Framework forks copy controls that belong to the source framework.
  • The Knowledge Graph tab appears only to admins when RDF is enabled.
  • Secret cleanup tests cover removed MCP server keys.

Reviews (3) · Last reviewed commit: "fix(context-center): leave tag rows anot..." · Reviewed by Greptile

…d metric fields

A column read returns a column's profile only to a caller holding ViewDataProfile on the table and its custom metrics only to one holding ViewTests, as the table's own reads do, and still returns the columns otherwise. The rule is recorded in ADR:2026-11-12-a-column-read-leaves-out-fields-the-caller-may-not-view.
…arch access policies

The asset counts now search as their asset listings do, for the caller, so the counts match the listings when search access control is on.
The soft delete updates that attachment by id. The prefix-wide update it used is removed.
The fork lists controls with the control repository's own fields and keeps those of the source framework, since the control listing does not filter by framework.
… patched

A patch loads the file's folder, which is kept out of the stored JSON, so the FQN derived from the patched file still starts with the folder's.
The graph explorer endpoint answers admins only, so the table page offers the tab to admins when RDF is enabled.
A server removed from an MCP service by an update keeps its key in the external store until the service is hard-deleted, and then the key is removed with the others.
@mohityadav766
mohityadav766 requested review from a team as code owners November 13, 2026 19:19
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

Distributions that build on the shared DAO still call it; only the soft delete here stops using it.

@manerow manerow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this. The new checks look right to me. I left three comments inline that I'd like resolved before merging. Two are about data that released versions already wrote, and these fixes go into the 2.1 backport, so they matter there too. The third is about fields=* on the column search endpoints returning less than the caller may see.

Released versions stored a file edited inside a folder under its bare name,
in its FQN and its nameHash alike. A 2.1.0 data migration step derives each
file's FQN from its folder link, as setFullyQualifiedName does, and rewrites
the FQN and nameHash together where they differ. Tags under the stored FQN
move with it, the file is reindexed, and soft-deleted files are included. A
file whose derived FQN another file holds is left as it is and logged, and a
rewrite applies only while the file still holds the FQN the scan read.

The step is in 2.1.0 because that is the newest migration version on main
and it is not released yet, so the 2.1 backport carries the same files. A
database on 2.0 runs it with the rest of 2.1.0. One on a 2.1.0 release
candidate reruns the 2.1.0 data migration because its code changed, and
runOnce keeps the step to one run. The FQN and hash are computed in Java, so
MySQL and PostgreSQL share the step.
A column search returns tags, custom metrics and extension for *, so * is
read as those three, and each is kept when the caller holds its operation:
tags reach a caller with ViewTests or ViewDataProfile alone. The other column
reads return none of them for *, so it is left out there. The decision record
is amended to match.
.bind("tagFQNHash", FullyQualifiedName.buildHash(tag.getTagFQN()))
.execute();
}
dao.tagUsageDAO().updateTargetFQNHash(storedFqn, derivedFqn);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

updateTargetFQNHash moves every tag_usage row whose targetFQNHash is the hash of the stored FQN, and the delete loop above it matches rows the same way. tag_usage doesn't record which entity a row belongs to. The stored FQN here is the file's bare name, which is also a root-level FQN, so other entities can own rows under it. Root folders and metrics store the raw name as their FQN. Root services, glossaries, domains and data products do too, for a name without dots or quotes. All of them carry tags.

For example: a tagged root folder Finance, and a file named Finance inside Archive that an edit damaged on 2.0.x. The repair deletes the folder's tags that the file already has under Archive.Finance, then moves the rest of the folder's tags onto the file. The folder ends up with no tags, nothing records that loss, and the file gains tags it never had. The step runs once, so nothing puts them back.

I'd like this resolved before merge, so the repair only moves tag rows that belong to the file it repairs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in cf3bd1b. The repair no longer touches a tag row it can't show is the file's.

  • Before it moves anything, the step looks the bare name up in every registered entity table, by each table's name hash, live and soft-deleted rows alike. That covers root folders, metrics, services, glossaries, domains and data products without a list of types.
  • If nothing else has that FQN, every row under it is the file's, and the rows move as before.
  • If another entity has it, the file's FQN and nameHash are still repaired. No row under the bare name is moved, copied or deleted, and the duplicate cleanup does not run. A WARN names the file, both FQNs and the other entity's type and id, for repair by hand. A type that can't be looked up counts as sharing.

I checked whether the file's own records could prove which rows are its own. Its versions do store tags, but a version saved after the damaging edit lists every row under the bare FQN, the other entity's included, and one row can be the tag of both. So the step leaves them all.

Tests in ContextFileFqnRepairMigrationIT cover your Finance example: a root folder with two tags, one of which the file also has under Archive.Finance. A second case does the same with a root glossary. After the step:

  • the other entity shows exactly the tags it showed before
  • the number of rows under the bare name is unchanged
  • the file's FQN and hash are repaired
  • the file has only its own tag

The folder case was RED on the previous commit, where the folder ended with no tags. The case where nothing else has the bare name also asserts now that no row is left under it. All of it is green on MySQL/Elasticsearch and on Postgres/OpenSearch.

tag_usage keys a row by FQN, not by entity, and a file's bare name can be
another entity's FQN: a root folder, service, glossary, domain or metric
named like the file. Before moving the rows under the bare name, the repair
looks the name up in every registered entity table. When another entity has
it, the file's FQN and nameHash are still repaired, every row under the bare
name stays where it is, and the file, both FQNs and the other entities are
logged for repair by hand. The file's versions cannot settle whose rows they
are: a version saved after the edit lists every tag under the bare name, and
one row can be the tag of both.
@gitar-bot

gitar-bot Bot commented Nov 16, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk 2 closed / 2 findings

The Context Center upgrade migration rewrites file FQNs, name hashes, and tag_usage rows; incorrect matching could misplace tags or disrupt entity lookup.

Hardens access control across column reads, tag and glossary-term asset counts, attachment soft delete, AI governance framework forks, Context Center file FQNs, and Knowledge Graph tab visibility, addressing the duplicated column field-to-operation map and the FQN repair that moved tag_usage rows belonging to other root entities. No open issues remain.

✅ 2 closed
✅ Quality: ColumnFieldAccess adds a second field→operation map, against ADR 11-03

📄 openmetadata-service/src/main/java/org/openmetadata/service/security/ColumnFieldAccess.java:26-31 📄 openmetadata-service/src/main/java/org/openmetadata/service/security/ColumnFieldAccess.java:54-65 📄 docs/decisions/2026-11-12-a-column-read-leaves-out-fields-the-caller-may-not-view.md:7 📄 docs/decisions/2026-11-12-a-column-read-leaves-out-fields-the-caller-may-not-view.md:17-21
ADR:2026-11-03-every-read-path-checks-the-fields-it-returns (Accepted) says ViewOperations.forFields(type, fields) is "the one mapping from requested fields to view operations". ViewOperations repeats this in its Javadoc: every read path that returns entity fields derives its check there. ColumnFieldAccess.RESTRICTED_FIELDS hard-codes a second mapping (customMetrics→ViewTests, profile→ViewDataProfile). The new record cites the 11-03 one only as Related and does not supersede or amend it.

The two maps can drift apart. Say the table resource re-maps customMetrics, or registers a view operation for a new column field. The column endpoints keep the old answer, and that is the exact gap the 11-03 record was written to close. There are two ways to fix it. One: derive the customMetrics operation from ViewOperations.forFields(Entity.TABLE, ...) and keep a local entry only for profile, which the table resource does not map. Two: add a v2 amendment to the 11-03 record saying column-only fields such as a column's profile are mapped in ColumnFieldAccess, and set its Revisions/Status to match.

✅ Bug: FQN repair moves tag_usage rows that belong to other root entities

📄 openmetadata-service/src/main/java/org/openmetadata/service/migration/utils/v210/ContextFileFqnRepair.java:269-283
moveTags calls tagUsageDAO().updateTargetFQNHash(storedFqn, derivedFqn), which moves every tag_usage row where targetFQNHash = hash(storedFqn) (ClassificationTagDAOs.java:661-666). tag_usage is keyed only by FQN hash and has no entity type. storedFqn here is the file's bare name, which is a root-level FQN, so the same hash can belong to a root folder, a service, a domain, a glossary or a classification with that name. For example, take a file reports that sits inside a folder, and a root folder or database service also named reports that has tags. When the migration repairs the file, those tags move to <folder>.reports: the other entity loses them and the file gains tags it never had. Because the step uses runOnce, this cannot be undone by running it again.

Fix: before moving tags, check whether any other entity resolves to storedFqn, at least the root-level entity types (folders, services, domains, glossaries, classifications). If one does, leave the rows where they are and log the file, as the code already does for a file whose derived FQN another file holds.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

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.

3 participants