Skip to content

Conversation

@kiblik
Copy link
Contributor

@kiblik kiblik commented Dec 12, 2025

I just noticed that the production image release is full of (unit)tests, which are definitely not needed there.
It contains so many dummy secrets that decrease the image score.

$ trivy image --scanners secret defectdojo/defectdojo-django:2.53.1 
2025-12-12T15:47:42+01:00       INFO    [secret] Secret scanning is enabled
2025-12-12T15:47:42+01:00       INFO    [secret] Please see https://trivy.dev/docs/v0.68/guide/scanner/secret#recommendation for faster secret detection
2025-12-12T15:47:47+01:00       INFO    [python] Licenses acquired from one or more METADATA files may be subject to additional terms. Use `--debug` flag to see all affected packages.
2025-12-12T15:47:49+01:00       WARN    [secret] The size of the scanned file is too large. It is recommended to use `--skip-files` for this file to avoid high memory consumption.     file_path="app/unittests/scans/jfrog_xray_unified/very_many_vulns.json" size (MB)=24
2025-12-12T15:48:07+01:00       INFO    Detected OS     family="debian" version="13.1"
2025-12-12T15:48:07+01:00       INFO    Number of language-specific files       num=2

Report Summary

┌──────────────────────────────────────────────────────────────────────────────────┬────────────┬─────────┐
│                                      Target                                      │    Type    │ Secrets │
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────┤
│ defectdojo/defectdojo-django:2.53.1 (debian 13.1)                                │   debian   │    -    │
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────┤
...
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────┤
│ /app/unittests/scans/github_secrets_detection_report/github_secrets_detection_r- │    text    │    1    │
│ eport_many_vul.json                                                              │            │         │
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────┤
│ /app/unittests/scans/noseyparker/noseyparker_0_22_0.jsonl                        │    text    │    9    │
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────┤
│ /app/unittests/scans/rusty_hog/gottingenhog_many_vulns.json                      │    text    │    2    │
└──────────────────────────────────────────────────────────────────────────────────┴────────────┴─────────┘
Legend:
- '-': Not scanned
- '0': Clean (no security findings detected)


/app/unittests/scans/github_secrets_detection_report/github_secrets_detection_report_many_vul.json (secrets)

Total: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 1)

CRITICAL: GitHub (github-pat)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
GitHub Personal Access Token
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 /app/unittests/scans/github_secrets_detection_report/github_secrets_detection_report_many_vul.json:300 (offset: 18336 bytes) (added by 'COPY unittests/ ./unittests/ # buildkit')
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 298          "secret_type":"github_personal_access_token",
 299          "secret_type_display_name":"GitHub Personal Access Token",
 300 [        "secret":"****************************************",
 301          "repository":{
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────



/app/unittests/scans/noseyparker/noseyparker_0_22_0.jsonl (secrets)

Total: 9 (UNKNOWN: 0, LOW: 0, MEDIUM: 3, HIGH: 3, CRITICAL: 3)

CRITICAL: GitHub (github-fine-grained-pat)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
GitHub Fine-grained personal access tokens
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 /app/unittests/scans/noseyparker/noseyparker_0_22_0.jsonl:15 (offset: 88664 bytes) (added by 'COPY unittests/ ./unittests/ # buildkit')
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  13   {"finding_id":"9521950b90ee23af6a5c95f9094f7f53f4dfe693","rule_name":"Generic Username and Password"
  14   {"finding_id":"6bd2fc96f6ca817526063128466d97d3ac22d631","rule_name":"GitHub Personal Access Token",
  15 [ )\n\t\ntoken = '","matching":"*********************************************************************************************","after":"'\nprojec
  16   {"finding_id":"430a3b39efb937edef71eb3cf18e76532bea7fd5","rule_name":"GitLab Personal Access Token",
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


CRITICAL: GitHub (github-pat)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
GitHub Personal Access Token
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 /app/unittests/scans/noseyparker/noseyparker_0_22_0.jsonl:14 (offset: 86667 bytes) (added by 'COPY unittests/ ./unittests/ # buildkit')
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  12   {"finding_id":"025edf89aabf5730eba20f56a2bdd3152d7da1c1","rule_name":"Generic Username and Password"
  13   {"finding_id":"9521950b90ee23af6a5c95f9094f7f53f4dfe693","rule_name":"Generic Username and Password"
  14 [ pet":{"before":"","matching":"****************************************","after":"\n"},"str
  15   {"finding_id":"90ab285686cd020122f3fe710a2a1b77e9c6e0b3","rule_name":"GitHub Personal Access Token (
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


CRITICAL: GitLab (gitlab-pat)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
GitLab Personal Access Token
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 /app/unittests/scans/noseyparker/noseyparker_0_22_0.jsonl:16 (offset: 90436 bytes) (added by 'COPY unittests/ ./unittests/ # buildkit')
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  14   {"finding_id":"6bd2fc96f6ca817526063128466d97d3ac22d631","rule_name":"GitHub Personal Access Token",
  15   {"finding_id":"90ab285686cd020122f3fe710a2a1b77e9c6e0b3","rule_name":"GitHub Personal Access Token (
  16 [ {"before":"PAT: ","matching":"**************************","after":"\nCalenda
  17   {"finding_id":"0267af8fb4a4efa5a061cfd920a4903ac27be4a8","rule_name":"Google API Key","rule_text_id"
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


MEDIUM: JWT (jwt-token)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
JWT token
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 /app/unittests/scans/noseyparker/noseyparker_0_22_0.jsonl:21 (offset: 105763 bytes) (added by 'COPY unittests/ ./unittests/ # buildkit')
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  19   {"finding_id":"60c5f47b58e4414a214a79d4d004619b91a56eb9","rule_name":"HTTP Basic Authentication","ru
  20   {"finding_id":"c753b17c895df529327b5a0823b9413455bc8b7d","rule_name":"Hardcoded Gradle Credentials",
  21 [ pet":{"before":"","matching":"*****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************","after":""},"struc
  22   {"finding_id":"1f0747f7e41976c37054e342011438fac87498aa","rule_name":"JSON Web Token (base64url-enco
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


MEDIUM: JWT (jwt-token)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
JWT token
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 /app/unittests/scans/noseyparker/noseyparker_0_22_0.jsonl:22 (offset: 109093 bytes) (added by 'COPY unittests/ ./unittests/ # buildkit')
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  20   {"finding_id":"c753b17c895df529327b5a0823b9413455bc8b7d","rule_name":"Hardcoded Gradle Credentials",
  21   {"finding_id":"b33ada155b6fb43aa0593b81634eaf94dd93b189","rule_name":"JSON Web Token (base64url-enco
  22 [ pet":{"before":"","matching":"***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************","after":""},"struc
  23   {"finding_id":"3c83ac99b70dbd5190f5ef0efab27dec109b7aa3","rule_name":"PEM-Encoded Private Key","rule
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


HIGH: AsymmetricPrivateKey (private-key)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Asymmetric Private Key
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 /app/unittests/scans/noseyparker/noseyparker_0_22_0.jsonl:23 (offset: 111470 bytes) (added by 'COPY unittests/ ./unittests/ # buildkit')
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  21   {"finding_id":"b33ada155b6fb43aa0593b81634eaf94dd93b189","rule_name":"JSON Web Token (base64url-enco
  22   {"finding_id":"1f0747f7e41976c37054e342011438fac87498aa","rule_name":"JSON Web Token (base64url-enco
  23 [ -----BEGIN EC PRIVATE KEY-----****************************************************************************************************************************************************************************-----END EC PRIVATE 
  24   {"finding_id":"3e348cf2520dd9b40880ca270e2914ab930d9d00","rule_name":"PEM-Encoded Private Key","rule
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


HIGH: AsymmetricPrivateKey (private-key)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Asymmetric Private Key
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 /app/unittests/scans/noseyparker/noseyparker_0_22_0.jsonl:24 (offset: 117511 bytes) (added by 'COPY unittests/ ./unittests/ # buildkit')
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  22   {"finding_id":"1f0747f7e41976c37054e342011438fac87498aa","rule_name":"JSON Web Token (base64url-enco
  23   {"finding_id":"3c83ac99b70dbd5190f5ef0efab27dec109b7aa3","rule_name":"PEM-Encoded Private Key","rule
  24 [ ":"-----BEGIN PRIVATE KEY-----**************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************-----END PRIVATE KEY
  25   {"finding_id":"e25450d6863684f5ee94aa8de0f38e57c0a6df1e","rule_name":"PEM-Encoded Private Key","rule
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


HIGH: AsymmetricPrivateKey (private-key)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Asymmetric Private Key
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 /app/unittests/scans/noseyparker/noseyparker_0_22_0.jsonl:25 (offset: 122429 bytes) (added by 'COPY unittests/ ./unittests/ # buildkit')
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  23   {"finding_id":"3c83ac99b70dbd5190f5ef0efab27dec109b7aa3","rule_name":"PEM-Encoded Private Key","rule
  24   {"finding_id":"3e348cf2520dd9b40880ca270e2914ab930d9d00","rule_name":"PEM-Encoded Private Key","rule
  25 [ GIN PGP PRIVATE KEY BLOCK-----*****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************-----END PGP PRIVATE
  26   {"finding_id":"61a76f28932780cb03402457c97a21e76d2bc2ec","rule_name":"Slack Webhook","rule_text_id":
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


MEDIUM: Slack (slack-web-hook)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Slack Webhook
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 /app/unittests/scans/noseyparker/noseyparker_0_22_0.jsonl:26 (offset: 124750 bytes) (added by 'COPY unittests/ ./unittests/ # buildkit')
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  24   {"finding_id":"3e348cf2520dd9b40880ca270e2914ab930d9d00","rule_name":"PEM-Encoded Private Key","rule
  25   {"finding_id":"e25450d6863684f5ee94aa8de0f38e57c0a6df1e","rule_name":"PEM-Encoded Private Key","rule
  26 [ pet":{"before":"","matching":"*******************************************************************************","after":"\n"},"str
  27   
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────



/app/unittests/scans/rusty_hog/gottingenhog_many_vulns.json (secrets)

Total: 2 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 2)

CRITICAL: AWS (aws-access-key-id)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
AWS Access Key ID
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 /app/unittests/scans/rusty_hog/gottingenhog_many_vulns.json:31 (offset: 703 bytes) (added by 'COPY unittests/ ./unittests/ # buildkit')
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  29     {
  30       "stringsFound": [
  31 [       "********************"
  32       ],
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────


CRITICAL: Stripe (stripe-secret-token)
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Stripe Secret Key
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 /app/unittests/scans/rusty_hog/gottingenhog_many_vulns.json:67 (offset: 1634 bytes) (added by 'COPY unittests/ ./unittests/ # buildkit')
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  65     {
  66       "stringsFound": [
  67 [       "********************************"
  68       ],
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

@kiblik kiblik force-pushed the docker_clean_tests branch 4 times, most recently from a335e48 to 3069275 Compare December 13, 2025 13:39
@valentijnscholten valentijnscholten added this to the 2.54.0 milestone Dec 13, 2025
@kiblik kiblik force-pushed the docker_clean_tests branch 2 times, most recently from a998455 to d019bb4 Compare December 19, 2025 22:47
@kiblik kiblik force-pushed the docker_clean_tests branch from d019bb4 to eaa862e Compare December 20, 2025 08:58
@kiblik kiblik marked this pull request as ready for review December 20, 2025 09:53
Copy link
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@valentijnscholten valentijnscholten merged commit 2741ed2 into DefectDojo:dev Dec 29, 2025
157 of 159 checks passed
@kiblik kiblik deleted the docker_clean_tests branch December 29, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants