mssql-mcp 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +4 -29
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ class MSSQLMCPServer {
24
24
  constructor() {
25
25
  this.server = new McpServer({
26
26
  name: "mssql-mcp-server",
27
- version: "1.0.2",
27
+ version: "1.0.3",
28
28
  });
29
29
  this.setupTools();
30
30
  this.setupResources();
@@ -82,32 +82,6 @@ class MSSQLMCPServer {
82
82
  if (!this.pool) {
83
83
  throw new Error("No database connection. Please connect first using connect_database tool.");
84
84
  }
85
- // Security: Basic SQL injection pattern detection
86
- const suspiciousPatterns = [
87
- /;\s*(drop|delete|truncate|alter|create|exec|execute)\s+/i,
88
- /union\s+select/i,
89
- /'\s*or\s+['"]?\w/i,
90
- /--\s*\w/,
91
- /\/\*.*\*\//,
92
- /xp_\w+/i,
93
- /sp_\w+/i
94
- ];
95
- if (!parameters || Object.keys(parameters).length === 0) {
96
- // Only check for dangerous patterns if no parameters are used
97
- const hasSuspiciousPattern = suspiciousPatterns.some(pattern => pattern.test(query));
98
- if (hasSuspiciousPattern) {
99
- console.warn("⚠️ Potentially dangerous SQL query detected:", query.substring(0, 100));
100
- return {
101
- content: [
102
- {
103
- type: "text",
104
- text: "⚠️ Security Warning: This query contains potentially dangerous patterns. Please use parameterized queries for user input.",
105
- },
106
- ],
107
- isError: true,
108
- };
109
- }
110
- }
111
85
  const request = this.pool.request();
112
86
  // Add parameters if provided (recommended for security)
113
87
  if (parameters) {
@@ -374,7 +348,8 @@ class MSSQLMCPServer {
374
348
  }
375
349
  if (orderBy) {
376
350
  // Validate ORDER BY clause for basic security
377
- const orderByPattern = /^[a-zA-Z0-9_,\s]+(ASC|DESC)?$/i;
351
+ // Allow dotted identifiers, bracketed identifiers, commas, spaces and optional ASC/DESC per column
352
+ const orderByPattern = /^([\[\]a-zA-Z0-9_.]+(\s+(ASC|DESC))?)(\s*,\s*[\[\]a-zA-Z0-9_.]+(\s+(ASC|DESC))?)*$/i;
378
353
  if (!orderByPattern.test(orderBy)) {
379
354
  throw new Error("Invalid ORDER BY clause. Only column names, commas, spaces, ASC, and DESC are allowed.");
380
355
  }
@@ -618,7 +593,7 @@ class MSSQLMCPServer {
618
593
  console.error('❌ Unhandled Rejection at:', promise, 'reason:', reason);
619
594
  shutdown('unhandledRejection');
620
595
  });
621
- console.log("🚀 Starting MSSQL MCP Server v1.0.2...");
596
+ console.log("🚀 Starting MSSQL MCP Server v1.0.3...");
622
597
  console.log("🔒 Security features enabled:");
623
598
  console.log(" - SQL injection protection: Enabled");
624
599
  console.log(" - Input validation: Enhanced");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mssql-mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "MCP Server for MS SQL Server integration with Claude Desktop, Cursor, Windsurf and VS Code",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",