This commit is contained in:
Tif Tran 2024-03-22 09:36:30 -07:00
Родитель 9369f1b7c0
Коммит 73b4d240ec
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 82C6D8511F9AA232
3 изменённых файлов: 17 добавлений и 3 удалений

Просмотреть файл

@ -69,7 +69,10 @@ class Autographer(object):
# base64 works in bytes. requests work in UTF-8.
# Convert to bytes, and then back.
encoded_implementation = base64.b64encode(item).decode("utf8")
signing_request.append({"input": encoded_implementation})
request = {"input": encoded_implementation}
if settings.AUTOGRAPH_KEYID:
request["keyid"] = settings.AUTOGRAPH_KEYID
signing_request.append(request)
res = self.session.post(url, json=signing_request)
res.raise_for_status()

Просмотреть файл

@ -63,6 +63,7 @@ class TestAutographer(object):
settings.AUTOGRAPH_URL = "https://autograph.example.com"
settings.AUTOGRAPH_HAWK_ID = "hawk id"
settings.AUTOGRAPH_HAWK_SECRET_KEY = "hawk secret key"
settings.AUTOGRAPH_KEYID = "hello autograph"
autographer = signing.Autographer()
autographer.session = MagicMock()
@ -120,8 +121,16 @@ class TestAutographer(object):
[
url,
[
{"template": "content-signature", "input": foo_base64},
{"template": "content-signature", "input": bar_base64},
{
"template": "content-signature",
"input": foo_base64,
"keyid": "hello autograph",
},
{
"template": "content-signature",
"input": bar_base64,
"keyid": "hello autograph",
},
],
]
)

Просмотреть файл

@ -371,6 +371,7 @@ class Base(Core, CORS, OIDC, Metrics):
AUTOGRAPH_HAWK_SECRET_KEY = values.Value()
AUTOGRAPH_SIGNATURE_MAX_AGE = values.IntegerValue(60 * 60 * 24 * 7)
AUTOGRAPH_X5U_CACHE_BUST = values.Value(None)
AUTOGRAPH_KEYID = values.Value(None)
# Remote Settings connection configuration
REMOTE_SETTINGS_URL = values.Value()
@ -547,6 +548,7 @@ class Test(InsecureAuthentication, Base):
AUTOGRAPH_URL = None
AUTOGRAPH_HAWK_ID = None
AUTOGRAPH_HAWK_SECRET_KEY = None
AUTOGRAPH_KEYID = None
OIDC_USER_ENDPOINT = "https://auth.example.com/userinfo"