Advanced Search: global searches via API are not restricted

What does this MR do and why?

This MR considers the feature flags for the scope in the global search API

Screenshots or screen recordings

Screenshot_2023-01-09_at_07.58.27

How to set up and validate locally

Turn off the feature flag global_search_code_tab

Feature.disable(:global_search_code_tab)

Ensure that you are logged in. Run the gdk

gdk start

Verify that http://127.0.0.1:3000/api/v4/search?scope=blobs&search=test is 403. Also, verify that the group or project search is 200

http://127.0.0.1:3000/api/v4/groups/33/search?scope=blobs&search=test

http://127.0.0.1:3000/api/v4/projects/7/search?scope=blobs&search=test

You might have a different group_id or project_id in your local

The second test is to enable the feature flag

Feature.enable(:global_search_code_tab)

And verify that http://127.0.0.1:3000/api/v4/search?scope=blobs&search=test is 200

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #371635

Merge request reports

Loading