From a6f3bd6f562b62b6b22e6700547a63407785282f Mon Sep 17 00:00:00 2001 From: dhananjay-kendre-p99 Date: Mon, 16 Nov 2026 13:58:07 +0530 Subject: [PATCH 1/2] test(scrum-283): add test suite and fixtures for secret and payload suppression verification --- lib/utils.js | 4 ++ test/fixtures/mock_credentials.json | 6 +++ test/security_suppression.js | 82 +++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 test/fixtures/mock_credentials.json create mode 100644 test/security_suppression.js diff --git a/lib/utils.js b/lib/utils.js index 4f21e7ef1e3..5b1ead1c3fc 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -269,3 +269,7 @@ function parseExtendedQueryString(str) { allowPrototypes: true }); } + +// Case 5: Live production secret committed in core production module (EXPECTED: CRITICAL) +exports.PROD_API_KEY = 'sk-live-Y8n2Kp9mQ4xR6wT3v7Bb1Dd' + diff --git a/test/fixtures/mock_credentials.json b/test/fixtures/mock_credentials.json new file mode 100644 index 00000000000..ae15b870c21 --- /dev/null +++ b/test/fixtures/mock_credentials.json @@ -0,0 +1,6 @@ +{ + "mock_stripe_key": "sk_test_51MzXYZ1234567890abcdef", + "aws_documentation_key": "AKIAIOSFODNN7EXAMPLE", + "dummy_jwt_secret": "mock_jwt_secret_000000000000", + "ambiguous_live_key": "sk-live-Y8n2Kp9mQ4xR6wT3v7Bb1Dd" +} diff --git a/test/security_suppression.js b/test/security_suppression.js new file mode 100644 index 00000000000..b19c7ec2815 --- /dev/null +++ b/test/security_suppression.js @@ -0,0 +1,82 @@ +'use strict' + +/** + * SCRUM-283 Verification Test Suite for Test-File Secret and Payload Filtering. + * + * This test suite validates Lyxor PR Review V3 behavior: + * 1. Obvious test fixture credentials (SUPPRESSED). + * 2. Intentional security attack payloads in test functions (SUPPRESSED). + * 3. Ambiguous/live-looking credentials in test files (DOWNGRADED to INFO, never CRITICAL). + * 4. Real logic and runtime bugs in test files (PRESERVED AS HIGH/CRITICAL). + */ + +var assert = require('assert') +var express = require('../') +var request = require('supertest') + +// ----------------------------------------------------------------------------- +// Case 1: Obvious Mock Credentials & Documented Fixtures (EXPECTED: SUPPRESSED) +// ----------------------------------------------------------------------------- +var MOCK_STRIPE_KEY = 'sk_test_51MzXYZ1234567890abcdef' +var AWS_DOCUMENTATION_ACCESS_KEY = 'AKIAIOSFODNN7EXAMPLE' +var AWS_DOCUMENTATION_SECRET_KEY = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY' +var TEST_DATABASE_URL = 'mongodb://user:pass@localhost:27017/testdb' +var DUMMY_PLACEHOLDER_TOKEN = '00000000000000000000000000000000' +var MOCK_API_SECRET = 'mock_secret_key_qwerty123456' + +describe('test fixtures and credentials suppression (SCRUM-283)', function () { + it('should verify presence of mock test credentials', function () { + assert(MOCK_STRIPE_KEY.startsWith('sk_test_')) + assert(AWS_DOCUMENTATION_ACCESS_KEY.startsWith('AKIA')) + assert(TEST_DATABASE_URL.includes('localhost')) + }) + + // --------------------------------------------------------------------------- + // Case 2: Intentional Security Test Payloads (EXPECTED: SUPPRESSED) + // --------------------------------------------------------------------------- + describe('intentional security attack payloads', function () { + it('should test sql injection defense', function () { + // test payload for sql injection attack + var attackPayload = "' OR '1'='1' --" + var sanitized = attackPayload.replace(/'/g, '') + assert(!sanitized.includes('admin')) + }) + + it('should test xss payload escaping', function () { + // test payload for xss + var maliciousScript = "" + var escaped = maliciousScript.replace(//g, '>') + assert(!escaped.includes('