From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796424614; b=FGVlALgnjesQJEVudXTXNPlRmQkrWN/9fOY09eEndiYtC1sKIM5h23DR87sGMuS6AZUJ mrovGcuNb7Sb6kCkNt4xCoyBhsB44jiQUan3hAjYN2nymaPuWFl8/kP8uR5osa9FU3CxU b+vhXjg9nTDXVQ8NPvX6aR/T26VIPTO3yDZZmPm4EFmNkKWAWR7TvAneSA1XYTW+Oklcb emplrNdltjLwfJ6HkdWdUgH62FSZU1dqzvxYOtUNVh2fAp72mQeIjYryJGyBzTWCJhDsy X5Q5rRKrk3KD6Z2IfuhUztw0YbwtTlSPiMeI+F5rTCz2Ve14eXQ5KOIrvr+sKagnOJA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796424614; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=FWhFcYK1iyIeNpbyNktQ+2YkVblvqj9dao8fcUEQVkU=; b=Rar2KkzRDhKtKHQ6TW2Pgcs2byW7yN7SUhRexQ8CFwutyPvb0GPr7MDc0IJ3Y2vkht6T PzT2cyDUG20W/YaGh2+6fbOIgFU8ijFEQ0SM8SZCC3NamfmcwlfLEngrcrOS5NZu4TJ6a G5O/ppO555DhE6QEioo3bkh5m8gJQV2EfASKhNG0FIUlcxaGwSdm6qDWVxRVglEcDs4Tc TLffCOdtCLP4qKE74UsN26Nre+Jf7ovIsd2KVXdF0KMbn1A7+SM5fr2154y9137dqgpZM pZPj0Qk1dyuof6nCQMpKbNImlD4LLX0MznV1EWUXfjXVQDkBV6yNnfivDgS+KsmuCGw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VXb6oSLi; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1450606A332; Fri, 4 Dec 2026 22:50:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VXb6oSLi Received: by smtp.kernel.org (Postfix) with ESMTPSA id 812511F00A06; Fri, 4 Dec 2026 22:50:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796424614; bh=FWhFcYK1iyIeNpbyNktQ+2YkVblvqj9dao8fcUEQVkU=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=VXb6oSLinYnG/AxyX1CP96zhEYcFg0LVurPy1FAKenNSOIG9WPFRYIKJHX1N289cL cIT0UApoyRwlTIarAwvysGmNhGwfM8LeEJbMtO+Wb34n7G1WOqqo9XaIh3MatvxL0W TqJ7VdyV+Qh7IwMZdqsS4OxoZ14IyxMC/Kw4ZuTG5oD63taQiN4EUDpyY7y+k3fvvc 2damx0xtBMLzbqwFx/4GDVyzrXDAHWvW5AOvGZhRW1JHfMTlo5j3JBy7foLjGanN3b ZSU52k63o2uH8Zsg6LMy+cOLIgyNxPEsTddVvNHvx8aYUmVHFyV4UWFADIHWVHld6T HAOinEKFFCvSA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 05/11] kconfig-audit: Split policy schema for component reuse Reply-To: sashiko-reviews@lists.linux.dev To: "Ahmed S. Darwish" , "Nathan Chancellor" , "Nicolas Schier" , "Julian Braha" , "Emanuele Rocca" , "Clark Williams" , "Steven Rostedt" , "Ingo Molnar" Cc: "Sebastian Andrzej Siewior" , "Frederic Weisbecker" , "John Ogness" , "Derek Barbosa" , =?utf-8?b?WmJpZ25pZXcgSsSZZHJ6ZWpld3Nr?= =?utf-8?b?aS1Tem1law==?= , "Daan De Meyer" , "Luca Boccassi" , linux-rt-devel@lists.linux.dev, debian-kernel@lists.debian.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20261203224916.118064-6-darwi@linutronix.de> References: <20261203224916.118064-1-darwi@linutronix.de> <20261203224916.118064-6-darwi@linutronix.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 22:50:13 +0000 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Low] kconfig-audit: deprecated RefResolver in SchemaFile._create_validator() - [Low] kconfig-audit: symlinked schemas break $ref in SchemaFile.parse() - [Low] kconfig-audit: uncaught RefResolutionError in Helpers.validate_yaml() -- commit 754cf81ebb9a7fce9acd73e9326b44ad0a081fd7 Author: Ahmed S. Darwish kconfig-audit: Split policy schema for component reuse This commit extracts the common rule schema into schema/rule.yml so policy-v1.yml can reference it via $ref, and updates audit.py to build a Draft7Validator with a local file:// RefResolver for sibling schema files. > diff --git a/tools/kconfig-audit/audit.py b/tools/kconfig-audit/audit.py > index eac25740becab..94ff427715d11 100755 > --- a/tools/kconfig-audit/audit.py > +++ b/tools/kconfig-audit/audit.py [ ... ] > @@ -249,12 +249,7 @@ class Helpers: > def validate_yaml(yaml: YamlDict, schema: Schema, f_name: str) -> No= ne: > """Validate a parsed YAML mapping against passed JSON Schema""" > try: > - # For regex validation, manually enforce a format checker > - jsonschema.validate( > - yaml, > - schema, > - format_checker=3Djsonschema.FormatChecker(), > - ) > + schema.validator.validate(yaml) > except jsonschema.exceptions.ValidationError as e: > error( > f'{f_name} does not match its schema\n' [Severity: Low] Should validate_yaml() also catch jsonschema.exceptions.RefResolutionError? Draft7Validator.check_schema() only validates metaschema grammar, so $ref targets are resolved lazily during schema.validator.validate(). Because RefResolutionError does not inherit from ValidationError, a broken $ref escapes with a traceback and exit status 1 instead of os.EX_DATAERR. [ ... ] > def parse(self) -> Schema: > """Parse and validate a policy schema file""" > =20 > - schema =3D Schema(self.yaml) > + rule_schema_f =3D self.schema_f.parent / 'rule.yml' > + rule_schema_y =3D Helpers.load_yaml(rule_schema_f) > + > + self._check_schema(rule_schema_f, rule_schema_y) > + self._check_schema(self.schema_f, self.schema_y) > + > + validator =3D self._create_validator({ > + rule_schema_f.resolve().as_uri(): rule_schema_y, > + }) [Severity: Low] Can resolving rule_schema_f and self.schema_f independently break $ref lookup when schema files are symlinked? If policy-v1.yml or rule.yml is individually symlinked to a different directory or basename (as in Nix or symlink-farm packaging), resolving rule.yml relative to base_uri in _create_validator() will miss the preloaded store key and fall back to remote loading, failing validation. Resolving self.schema_f.parent once and deriving both URIs from that directory would keep base_uri and the store keys aligned. [ ... ] > + def _create_validator(self, store: dict[str, YamlDict]) -> YamlValid= ator: > + """Create a schema validator for resolving sibling '$ref' entrie= s""" > + > + resolver =3D jsonschema.RefResolver( > + base_uri=3Dself.schema_f.resolve().as_uri(), > + referrer=3Dself.schema_y, > + store=3Dstore, > + ) > + > + return jsonschema.Draft7Validator( > + self.schema_y, > + resolver=3Dresolver, > + # For regex entries validation, manually enforce a format ch= ecker > + format_checker=3Djsonschema.FormatChecker(), > + ) [Severity: Low] Will jsonschema.RefResolver and the resolver=3D argument emit deprecation warnings on jsonschema >=3D 4.18.0? Both were deprecated in favor of referencing.Registry passed via registry= =3D. Because audit.py runs as __main__, Python's default warning filter prints both DeprecationWarning messages to stderr on every run, and fails under python3 -W error or once jsonschema removes RefResolver. Preferring referencing.Registry when available and falling back to RefResolver for older jsonschema would avoid the warnings while keeping compatibility. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203224916.1180= 64-1-darwi@linutronix.de?part=3D5