Skip to content

chore: exclude test code from Snyk Code analysis - #41981

Merged
oc-tmueller merged 1 commit into
masterfrom
chore/snyk-exclude-test-code
Nov 16, 2026
Merged

oc-tmueller merged 1 commit into
masterfrom
chore/snyk-exclude-test-code

Conversation

@kw-fscheuer

Copy link
Copy Markdown
Member

Description

Adds a .snyk policy file at the repository root. Its exclude.code block takes test code out of Snyk Code (static analysis):

  • tests/** — PHP unit tests, acceptance tests, test helpers and CI test configuration
  • apps/*/tests/** — unit tests and JavaScript specs of the bundled apps
  • core/js/tests/** and settings/tests/** — JavaScript specs of core and of the settings pages

No product code is excluded. Snyk Open Source is not affected, because exclude.code applies to Snyk Code only.

The file is not part of a release: the dist target copies a fixed list of root files (core_src_files in the Makefile), and .snyk is not on it.

Related Issue

  • None. Housekeeping for the Snyk Code project of this repository.

Motivation and Context

Snyk Code reports the fixture values in tests (test passwords, dummy tokens) as hard-coded credentials, and the md5() and sha1() calls that tests use to compute expected path hashes and checksums as weak password hashing. On master these are 178 of the 256 open low-severity findings. None of the directories is part of a release: the dist target does not copy tests/ and deletes every other tests directory. The findings therefore carry no risk, and every new test adds more of them. Excluding the test paths keeps the findings list to code that ships.

Findings in product code stay visible and are handled one by one through the Snyk ignore approval workflow.

How Has This Been Tested?

  • The patterns were checked against the file paths of the open low-severity Snyk Code findings on master: tests/** and apps/*/tests/** match all 178 findings in test code and none of the 78 others. core/js/tests/** and settings/tests/** have no open finding today and are listed because they are test directories as well.
  • Every directory named tests in the repository is covered by one of the four patterns.
  • Not tested against Snyk itself. The file takes effect when the Snyk Code project is retested after the merge ("Retest now" on the project page). Expected result: the 178 findings in the excluded paths disappear from the project.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised: not needed
  • Changelog item: not needed, no change to shipped code

Signed-off-by: Florian Scheuer <florian.scheuer@kiteworks.com>
@kw-fscheuer
kw-fscheuer requested a review from a team as a code owner November 16, 2026 12:54
@update-docs

update-docs Bot commented Nov 16, 2026

Copy link
Copy Markdown

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@CLAassistant

CLAassistant commented Nov 16, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@oc-tmueller
oc-tmueller merged commit e059a26 into master Nov 16, 2026
37 checks passed
@oc-tmueller
oc-tmueller deleted the chore/snyk-exclude-test-code branch November 16, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants