The result from JSON_SEARCH() is not a valid JSON path. It's quoted, like a JSON string value. Notice the double-quotes:
mysql> select json_search(config, 'one', 'Infrastructure')
from table_config;
+----------------------------------------------+
| json_search(config, 'one', 'Infrastructure') |
+----------------------------------------------+
| "$.deploy[0]" |
+----------------------------------------------+
So if you try to use it as the path argument in JSON_SET(), it doesn't work:
mysql> select json_set(config, json_search(config, 'one', 'Infrastructure'), 'Infrastructure')
from table_config;
ERROR 3143 (42000): Invalid JSON path expression. The error is around character position 1.
To use this as a JSON path, you have to remove those quotes:
mysql> select json_unquote(json_search(config, 'one', 'Infrastructure'))
from table_config;
+------------------------------------------------------------+
| json_unquote(json_search(config, 'one', 'Infrastructure')) |
+------------------------------------------------------------+
| $.deploy[0] |
+------------------------------------------------------------+
Then you can use it in a call to JSON_SET():
mysql> select json_set(config, json_unquote(json_search(config, 'one', 'Infrastructure')), 'Infrastructure')
from table_config;
+------------------------------------------------------------------------------------------------+
| json_set(config, json_unquote(json_search(config, 'one', 'Infrastructure')), 'Infrastructure') |
+------------------------------------------------------------------------------------------------+
| {"deploy": ["Infrastructure", "API Security"], "operate": ["Pen Testing", "Bug Bounty"]} |
+------------------------------------------------------------------------------------------------+