wso2 / wso2/open-cloud-datacenter
[Task]: Verify project ownership and stop treating 409 as success
Nobody has claimed this yet.
- Dominant language
- HCL
- Stars
- 19
- Forks
- 15
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 4
Description
Description
CreateHarborProject currently treats HTTP 409 Conflict as a success. While safe under per-namespace isolation, in a shared multi-tenant Harbor instance, a 409 means another tenant likely owns that project.
Ignoring the 409 and immediately creating a robot account creates a critical security flaw: it hands one tenant push and pull credentials to another tenant's private images. This ownership check serves as the primary defense against cross-tenant access when two Registry objects race or share identical names.
Decide first
Determine where to store the project ownership marker either in Harbor project metadata or Harbor labels. Select the option based on two criteria:
- The marker must survive Harbor upgrades.
- The marker must be readable without requiring additional API calls.
Acceptance criteria
- Every project created by the operator must store an ownership marker recording its associated Registry (cluster, namespace, and name).
- On HTTP 409, fetch the existing project's marker and proceed only if it matches the reconciling Registry.
- On a 409 conflict for a foreign project, halt reconciliation immediately. Do not create a robot account, set resource quotas, or write a credentials Secret.
- Treat any project without an ownership marker as foreign. Implicit adoption is prohibited.
- Record the refusal as both a Kubernetes Event and a Status Condition on the resource so it is visible via kubectl describe without needing operator logs.
Out of scope
An adoption path for pre-existing or unmarked projects. (Any future adoption mechanism must be an explicit, opt-in action, not an automatic side effect of creating a Registry.)
Verification
- Verify reconciliation proceeds normally when encountering 409 on a project owned by the matching Registry.
- Verify reconciliation fails terminally when encountering 409 on a project owned by a different tenant, confirming no robot account or Secret is created.
- Verify reconciliation fails terminally on a project missing an ownership marker.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating CreateHarborProject and the reconciliation path that handles Harbor HTTP 409 responses. Compare Harbor project metadata and labels against the upgrade-survival and no-extra-API-call requirements, then inspect existing event and Status Condition patterns. Done means ownership is recorded, matching projects proceed, foreign or unmarked projects halt before credentials or quotas, and both verification cases pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kubernetes
- Domain
- backend, security
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100