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:
Anders Heimer
2026-06-05 06:58:26 +02:00
committed by Paul Barker
parent d47ac87fb6
commit d80ddd7b90
5 changed files with 115 additions and 6 deletions

View File

@@ -7,12 +7,19 @@ import asyncio
from contextlib import closing
import itertools
import json
import re
from collections import namedtuple
from urllib.parse import urlparse
from bb.asyncrpc.client import parse_address, ADDR_TYPE_UNIX, ADDR_TYPE_WS
User = namedtuple("User", ("username", "permissions"))
UNIHASH_REGEX = re.compile(r"^[0-9a-f]{64}$")
def is_valid_unihash(value):
return isinstance(value, str) and UNIHASH_REGEX.fullmatch(value) is not None
def create_server(
addr,
dbname,