Allow use of basic auth for security scan endpoints
This will allow the security labeler to send a pull secret to retrieve security information for a manifest Fixes https://jira.coreos.com/browse/QUAY-1087
This commit is contained in:
parent
f9da0caaa4
commit
a38edea11b
4 changed files with 37 additions and 2 deletions
30
endpoints/api/test/test_secscan.py
Normal file
30
endpoints/api/test/test_secscan.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import base64
|
||||
|
||||
import pytest
|
||||
|
||||
from data.registry_model import registry_model
|
||||
from endpoints.api.test.shared import conduct_api_call
|
||||
from endpoints.api.secscan import RepositoryImageSecurity, RepositoryManifestSecurity
|
||||
|
||||
from test.fixtures import *
|
||||
|
||||
@pytest.mark.parametrize('endpoint', [
|
||||
RepositoryImageSecurity,
|
||||
RepositoryManifestSecurity,
|
||||
])
|
||||
def test_get_security_info_with_pull_secret(endpoint, client):
|
||||
repository_ref = registry_model.lookup_repository('devtable', 'simple')
|
||||
tag = registry_model.get_repo_tag(repository_ref, 'latest', include_legacy_image=True)
|
||||
manifest = registry_model.get_manifest_for_tag(tag, backfill_if_necessary=True)
|
||||
|
||||
params = {
|
||||
'repository': 'devtable/simple',
|
||||
'imageid': tag.legacy_image.docker_image_id,
|
||||
'manifestref': manifest.digest,
|
||||
}
|
||||
|
||||
headers = {
|
||||
'Authorization': 'Basic %s' % base64.b64encode('devtable:password'),
|
||||
}
|
||||
|
||||
conduct_api_call(client, endpoint, 'GET', params, None, headers=headers, expected_code=200)
|
Reference in a new issue