Skip to content

external_services: adjust the behavior of `ExcludeNamespaceUser` option

Warren Gifford requested to merge jc/ExcludeNamespaceUser into main

Created by: unknwon

Followup of https://github.com/sourcegraph/sourcegraph/pull/26828#discussion_r740933700.

Namely,

  1. NoNamespace -> any namespace is ignored
  2. ExcludeNamespaceUser -> only user namespace is ignored. If we supply NamespaceOrgID, it is still applied
  3. NamespaceUserID, NamespaceOrgID are mutually exclusive

The 3. is not precisely reflected in code because if we stop restricting conditions because of conflict, more rows would be returned (and could cause unauthorized access to external services). i.e. having deleted_at IS NULL AND namespace_user_id = 1 AND namespace_org_id = 2 would return nothing in practice, but no result is safer than not restricting namespace at all (deleted_at IS NULL), and ended up returning external services from other namespaces from the query.

Merge request reports

Loading