Skip to content

Commit 02a852e

Browse files
committed
ci: Address some pesky SonarQube false-positive warnings
SonarQube static analysis complains about our use of our `simd::shuffle`, saying we aren't using a cryptographically strong random number generator, hilariously confusing the fact that we have named this operation "shuffle" with the (unrelated!) potential error of not using a good permutation/shuffle algorithm. Also there are complaints about using http: instead of https:, but this isn't a security problem, it's part of the metadata namespacing for XMP. I learned that there's a way to put specific exlusions in sonar-project.properties, so here it is, finally silencing these warnings. Signed-off-by: Larry Gritz <lg@larrygritz.com>
1 parent ff2ebd8 commit 02a852e

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

sonar-project.properties

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,17 @@ sonar.cfamily.build-wrapper-output=/__w/OpenImageIO/OpenImageIO/bw_output
2525
sonar.cfamily.gcov.reportsPath=_coverage
2626
sonar.coverage.exclusions=src/iv/**,src/include/OpenImageIO/detail/pugixml/**,src/include/OpenImageIO/detail/fmt/**,src/libOpenImageIO/kissfft.hh
2727

28+
# Exclude false positives
29+
sonar.issue.ignore.multicriteria=e1,e2
30+
# Stop stupid Sonar from complaining about SIMD shuffle<>, it thinks it is
31+
# weak cryptography, but it's fooled simply by the name "shuffle", and we
32+
# aren't using it for cryptography at all. Sheesh.
33+
sonar.issue.ignore.multicriteria.e1.ruleKey=cpp:S2245
34+
sonar.issue.ignore.multicriteria.e1.resourceKey=**/simd.h,**/simd_test.cpp,**/texturesys.cpp
35+
# Stop stupid Sonar from complaining about using http: instead of https:, but
36+
# we aren't using it to establish a network connection, it's just a key we
37+
# must use for namespacing of XMP metadata groups.
38+
sonar.issue.ignore.multicriteria.e2.ruleKey=cpp:S5332
39+
sonar.issue.ignore.multicriteria.e2.resourceKey=**/xmp.cpp
40+
2841
sonar.verbose=false

src/libutil/filesystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ Filesystem::unique_path(string_view model)
465465
std::string name;
466466
#endif
467467
static const char chrs[] = "0123456789abcdef";
468-
static std::mt19937 rg { std::random_device {}() };
468+
static std::mt19937 rg { std::random_device {}() }; //NOSONAR
469469
static std::uniform_int_distribution<size_t> pick(0, 15);
470470
static std::mutex mutex;
471471
std::lock_guard<std::mutex> lock(mutex);

0 commit comments

Comments
 (0)