Skip to content

fix(controlplane): exclude deleted workflows from referrer visibility - #3880

Open
perfloop[bot] wants to merge 2 commits into
mainfrom
perfloop-pr-open-vh0c3qb9qb
Open

perfloop[bot] wants to merge 2 commits into
mainfrom
perfloop-pr-open-vh0c3qb9qb

Conversation

@perfloop

@perfloop perfloop Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Private discovery can expose a shared referrer to a project-scoped caller when a deleted workflow supplies its only granted project. Deleted workflows now stop contributing to referrer visibility, for both root lookups and first-level references.

Consider digest D linked to a live workflow in hidden project B and a deleted workflow in granted project A. The organization-level SQL check finds the live workflow, while hydration currently includes both projects; the grant for A then admits D. Hydration now skips the deleted workflow, so only B participates and the caller cannot retrieve D. A live workflow in A still grants access.

The guard lives in hydrateWorkflowsInfo, which both discovery paths use. This keeps query ordering and cursor construction unchanged rather than duplicating the rule in the eager-loading queries. Deleted workflows also stop contributing workflow IDs, and project or organization IDs contributed solely by those workflows, to the internal discovery result. There is no API or schema change.

AI assistance: Perfloop.

cc @migmartri @javirln

Case and evidence


Made by Perfloop.

View guided diff

Assisted-by: Perfloop
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
Assisted-by: Perfloop
Signed-off-by: Perfloop Agent <agent@perfloop.ai>
@chainloop-platform

chainloop-platform Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

AI Session Checks — ⏭️ bypassed by label

AI Coding Session Check Bypassed

This PR carries the skip-ai-session label, so the AI coding session check was bypassed.

Learn more about Chainloop Trace.


Powered by Chainloop and Chainloop Trace

// - projectIDs: the list of associated projects
// It also returns the associated projects grouped by organization, for the visibility check.
func hydrateWorkflowsInfo(root *ent.Referrer, out *biz.StoredReferrer) map[uuid.UUID][]uuid.UUID {
workflowIDs := make([]uuid.UUID, 0, len(root.Edges.Workflows))

@migmartri migmartri Dec 2, 2026 •

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.

can't we prevent the edges from having deleted workflows instead of skipping it downstream in the serialization step?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes—the workflow edges can be filtered at both query sites, in GetFromRoot and referencesPage. I’ll move the exclusion there and verify the root and reference visibility cases, so hydration only receives live workflows.

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.

are you doing it then?

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.

so?

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.

will you change this in the end?

@perfloop

perfloop Bot commented Dec 4, 2026

Copy link
Copy Markdown
Author

Perfloop paused work on this pull request before it answered the open comments. The work reached the workspace's overall usage limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants