Repository: conda/conda

Issue:
re-implement --override-channels
Work out a way for `--override-channels` to start working again, without violating the security model.

Will probably need to add an `#!exclude` flag for sequence config parameters as part of this task.

conda search --override-channels not working (4.3.30)?
My understanding of `--override-channels` is that results should be returned *only* for the specified channel. I'm pretty sure that was the previous behaviour.

As can be seen below despite specifying `--override-channels` and my anaconda.org channel results are being brought back from both conda-forge and defaults.
```
λ conda search --override-channels --channel https://conda.anaconda.org/dhirschfeld tensorflow
Fetching package metadata ...................
r-tensorflow                 0.7                    r3.3.2_0  conda-forge
                             0.7                    r3.4.1_0  conda-forge
                             0.8.2                  r3.4.1_0  defaults
                             1.4              r342h0bf44f9_0  defaults
tensorflow                   0.12.0rc0                py35_0  dhirschfeld
                             0.12.1                   py35_1  conda-forge
                             0.12.1                   py35_2  conda-forge
                             1.0.0                    py35_0  conda-forge
                             1.1.0                    py35_0  conda-forge
                             1.1.0               np112py35_0  defaults
                             1.1.0               np112py36_0  defaults
                             1.2.0                    py35_0  conda-forge
                             1.2.0                    py36_0  conda-forge
                             1.2.0                    py36_0  dhirschfeld
                             1.2.1                    py35_0  conda-forge
                             1.2.1                    py36_0  conda-forge
                             1.2.1                    py35_0  defaults
                             1.2.1                    py36_0  defaults
                             1.3.0                    py35_0  conda-forge
                             1.3.0                    py36_0  conda-forge
                             1.4.0                    py35_0  conda-forge
                          *  1.4.0                    py36_0  conda-forge
tensorflow-gpu               1.1.0               np112py35_0  defaults
                             1.1.0               np112py36_0  defaults
```


Discussion:
Also `allow_other_channels` per #4026.
Any news on this bug ?
A workaround for this issue is to temporarily add the lines 

```
default_channels: [] 
channels: []
```

to the `.condarc` file.  This seems to disable all channels except those specified on the command line.
```
               platform : win-64
          conda version : 4.3.30
       conda is private : False
      conda-env version : 4.3.30
    conda-build version : 0+unknown
         python version : 3.6.3.final.0
       requests version : 2.18.4
       root environment : C:\Miniconda3  (writable)
    default environment : C:\Miniconda3
       envs directories : C:\Miniconda3\envs
                          C:\Users\dhirschf\AppData\Local\conda\conda\envs
                          C:\Users\dhirschf\.conda\envs
          package cache : C:\Miniconda3\pkgs
                          C:\Users\dhirschf\AppData\Local\conda\conda\pkgs
           channel URLs : https://conda.anaconda.org/dhirschfeld/win-64
                          https://conda.anaconda.org/dhirschfeld/noarch
                          https://repo.continuum.io/pkgs/main/win-64
                          https://repo.continuum.io/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/win-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/win-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/win-64
                          https://repo.continuum.io/pkgs/pro/noarch
                          https://repo.continuum.io/pkgs/msys2/win-64
                          https://repo.continuum.io/pkgs/msys2/noarch
                          https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/numba/win-64
                          https://conda.anaconda.org/numba/noarch
            config file : C:\Users\dhirschf\.condarc
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.30 requests/2.18.4 CPython/3.6.3 Windows/7 Windows/6.1.7601
          administrator : True
```
What happened to the `channel_priority` in the `conda info` output? I'm sure it used to be there :confused: 
```
λ conda info | grep priority
C:\dev\src
λ cat  C:\Users\dhirschf\.condarc
channels:
  - https://conda.anaconda.org/dhirschfeld
  - defaults
  - https://conda.anaconda.org/conda-forge
  - https://conda.anaconda.org/numba

channel_priority: false

C:\dev\src
λ

I've been encountering this on OSX El Capitan with the same version while investigating another issue.

```
conda create --yes --name FIONATEST python=3.6
source activate FIONATEST
conda install --yes -c conda-forge --override-channels geopandas
conda list
```

fiona is a dependency of geopandas but the defaults channel version is what gets installed. This ends up breaking geopandas. It's also not the only package this happens with.

If I specifically install fiona along with geopandas, the correct channel is used.

```
source deactivate
conda env remove --yes --name FIONATEST
conda create --yes --name FIONATEST python=3.6
source activate FIONATEST
conda install --yes -c conda-forge --override-channels geopandas fiona
conda list
```

version info
```
platform : osx-64
conda version : 4.3.30
conda is private : False
conda-env version : 4.3.30
conda-build version : 3.0.27
python version : 3.6.3.final.0
requests version : 2.18.4
```
I'm having the same problem.
`--override-channel` has been broken for some time, see #5158.
I guess in the short term grep on the channel works.

Resolving patch:
diff --git a/conda/core/index.py b/conda/core/index.py
--- a/conda/core/index.py
+++ b/conda/core/index.py
@@ -160,6 +160,8 @@ def get_reduced_index(prefix, channels, subdirs, specs):
     with backdown_thread_pool() as executor:
 
         channel_urls = all_channel_urls(channels, subdirs=subdirs)
+        check_whitelist(channel_urls)
+
         if context.offline:
             grouped_urls = groupby(lambda url: url.startswith('file://'), channel_urls)
             ignored_urls = grouped_urls.get(False, ())


Test patch: