Skip to content

Commit 6727e95

Browse files
chore(security): sanitize example cookies and test literals to avoid secret detection
1 parent 84c6533 commit 6727e95

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

scrapegraph-js/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ const prompt = 'Extract user profile information';
230230

231231
// Define cookies for authentication
232232
const cookies = {
233-
session_id: 'abc123def456',
234-
auth_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
235-
user_preferences: 'dark_mode,usd'
233+
session_id: '<SESSION_ID>',
234+
auth_token: '<JWT_TOKEN>',
235+
user_preferences: '<USER_PREFERENCES>'
236236
};
237237

238238
(async () => {

scrapegraph-js/examples/advanced_features/cookies/cookies_integration_example.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ async function scrapeEcommerceWithAuth() {
5858

5959
// Example cookies for an e-commerce site
6060
const cookies = {
61-
session_id: 'abc123def456',
62-
user_id: 'user789',
63-
cart_id: 'cart101112',
64-
preferences: 'dark_mode,usd',
65-
auth_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
61+
session_id: '<SESSION_ID>',
62+
user_id: '<USER_ID>',
63+
cart_id: '<CART_ID>',
64+
preferences: '<PREFERENCES>',
65+
auth_token: '<JWT_TOKEN>'
6666
};
6767

6868
const websiteUrl = 'https://example-ecommerce.com/products';
@@ -94,11 +94,11 @@ async function scrapeSocialMediaWithSession() {
9494

9595
// Example cookies for a social media site
9696
const cookies = {
97-
session_token: 'xyz789abc123',
98-
user_session: 'def456ghi789',
99-
csrf_token: 'jkl012mno345',
100-
remember_me: 'true',
101-
language: 'en_US'
97+
session_token: '<SESSION_TOKEN>',
98+
user_session: '<USER_SESSION>',
99+
csrf_token: '<CSRF_TOKEN>',
100+
remember_me: '<REMEMBER_ME>',
101+
language: '<LANGUAGE>'
102102
};
103103

104104
const websiteUrl = 'https://example-social.com/feed';
@@ -166,11 +166,11 @@ async function scrapeBankingWithSecureCookies() {
166166

167167
// Example secure cookies for a banking site
168168
const cookies = {
169-
secure_session: 'pqr678stu901',
170-
auth_token: 'vwx234yz567',
171-
mfa_verified: 'true',
172-
device_id: 'device_abc123',
173-
last_activity: '2024-01-15T10:30:00Z'
169+
secure_session: '<SECURE_SESSION>',
170+
auth_token: '<AUTH_TOKEN>',
171+
mfa_verified: '<MFA_VERIFIED>',
172+
device_id: '<DEVICE_ID>',
173+
last_activity: '<LAST_ACTIVITY_ISO8601>'
174174
};
175175

176176
const websiteUrl = 'https://example-bank.com/transactions';
@@ -202,11 +202,11 @@ async function scrapeApiWithAuthTokens() {
202202

203203
// Example API authentication cookies
204204
const cookies = {
205-
api_token: 'api_abc123def456',
206-
client_id: 'client_789',
207-
access_token: 'access_xyz789',
208-
refresh_token: 'refresh_abc123',
209-
scope: 'read:all'
205+
api_token: '<API_TOKEN>',
206+
client_id: '<CLIENT_ID>',
207+
access_token: '<ACCESS_TOKEN>',
208+
refresh_token: '<REFRESH_TOKEN>',
209+
scope: '<SCOPE>'
210210
};
211211

212212
const websiteUrl = 'https://api.example.com/data';

scrapegraph-js/examples/smartscraper/smartScraper_cookies_simple_example.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ const apiKey = process.env.SGAI_APIKEY;
1111

1212
// Example cookies for authentication
1313
const cookies = {
14-
session_id: 'abc123def456',
15-
auth_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
16-
user_preferences: 'dark_mode,usd'
14+
session_id: '<SESSION_ID>',
15+
auth_token: '<JWT_TOKEN>',
16+
user_preferences: '<USER_PREFERENCES>'
1717
};
1818

1919
async function scrapeWithCookies() {

scrapegraph-js/test/healthz_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function testInputValidation() {
141141
const testCases = [
142142
{
143143
name: 'Valid API key',
144-
apiKey: 'sgai-valid-key-123',
144+
apiKey: 'dummy-api-key',
145145
expected: true,
146146
description: 'Should accept valid API key'
147147
},

0 commit comments

Comments
 (0)