Skip to content

Fix sonar issues - #703

Open
MykolaSuperman wants to merge 26 commits into
aosedge:developfrom
MykolaSuperman:fix_sonar_issues
Open

MykolaSuperman wants to merge 26 commits into
aosedge:developfrom
MykolaSuperman:fix_sonar_issues

Conversation

@MykolaSuperman

Copy link
Copy Markdown

No description provided.

Mykola Solianko added 26 commits November 23, 2026 12:55
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
…ctions

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
GetX509CertExtensions stopped iterating over the certificate extensions
as soon as both the subject key identifier and the authority key
identifier were parsed. An issuer alternative name extension located
after them was never parsed, so mIssuerURLs stayed empty and no error
was reported. As a result, the service discovery URL from the
certificate was silently ignored and a fallback one was used instead.

The order of extensions is not defined by the standard and depends on
the certificate issuer, so the result depended on how the certificate
was generated. The OpenSSL provider is not affected.

Parse all extensions regardless of their order and add a test with the
issuer alternative name placed after the key identifiers.

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
The subject and authority key identifiers were copied to the
certificate with memcpy while the result of Resize was ignored. If a key
identifier in a certificate was longer than cCertKeyIdSize (24 bytes),
Resize failed, but memcpy still copied the whole identifier and wrote
past the end of the array. For example, a key identifier based on
SHA-256 has 32 bytes.

Return the Resize error instead, the same way the OpenSSL provider does,
and add a test with long subject and authority key identifiers.

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Certificate extension OIDs were compared with memcmp using the OID
length read from the certificate, without checking that it equals the
length of the expected OID. An extension with a longer OID starting with
the same bytes followed by a zero byte, e.g. 2.5.29.14.0, was handled as
the subject key identifier and overwrote the real one. A zero length OID
matched every extension, and for a longer OID memcmp read past the end
of the OID literal.

Compare the OID length before comparing the bytes and add a test with
an unknown extension, which OID starts with the subject key identifier
OID.

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant