mirror of
https://git.yoctoproject.org/poky
synced 2026-09-13 09:49:32 +02:00
bitbake: hashserv: validate unihash values
(Bitbake rev: a4daa14312d659333984aa1ae58ddfe0c96392f1) Signed-off-by: Anders Heimer <anders.heimer@est.tech> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit f9b817d8017e5d5a1d22b9aa10a3c974bc7fa33d) Signed-off-by: Yoann Congal <yoann.congal@smile.fr> Signed-off-by: Paul Barker <paul@pbarker.dev>
This commit is contained in:
committed by
Paul Barker
parent
d47ac87fb6
commit
d80ddd7b90
@@ -295,6 +295,36 @@ class HashEquivalenceCommonTests(object):
|
||||
self.assertEqual(result_outhash['outhash'], outhash)
|
||||
self.assertEqual(result_outhash['outhash_siginfo'], siginfo)
|
||||
|
||||
def test_report_rejects_invalid_unihash(self):
|
||||
taskhash = '68a9206490b2321bb033fb3eab013a4ec62c41f9'
|
||||
outhash = 'bf5f2efaf1ca351f3b4c3d079363540ab48f7c58db3d23cfbb069cf4ff1ea8f7'
|
||||
invalid_unihashes = (
|
||||
"${@os.system('true')}",
|
||||
'a' * 63,
|
||||
'a' * 65,
|
||||
'A' * 64,
|
||||
None,
|
||||
)
|
||||
|
||||
for unihash in invalid_unihashes:
|
||||
with self.subTest(unihash=unihash):
|
||||
with self.start_client(self.server_address) as client:
|
||||
with self.assertRaises(InvokeError) as context:
|
||||
client.report_unihash(taskhash, self.METHOD, outhash, unihash)
|
||||
|
||||
self.assertEqual(str(context.exception), "Invalid unihash")
|
||||
|
||||
self.assertClientGetHash(self.client, taskhash, None)
|
||||
|
||||
def test_equivreport_rejects_invalid_unihash(self):
|
||||
taskhash = 'ae6339531895ddf5b67e663e6a374ad8ec71d81c'
|
||||
|
||||
with self.assertRaises(InvokeError) as context:
|
||||
self.client.report_unihash_equiv(taskhash, self.METHOD, "${@os.system('true')}")
|
||||
|
||||
self.assertEqual(str(context.exception), "Invalid unihash")
|
||||
self.assertClientGetHash(self.start_client(self.server_address), taskhash, None)
|
||||
|
||||
def test_stress(self):
|
||||
def query_server(failures):
|
||||
client = Client(self.server_address)
|
||||
|
||||
Reference in New Issue
Block a user