Skip to content

Commit 2e417f8

Browse files
committed
fix: audit sweep — harden all SDKs and clean repo hygiene
Audit findings fixed: 1. zod moved from dependencies to devDependencies (only used in tests/example) 2. TS smoke test: require NEXUS_GATEWAY_URL env var (no live Azure default) 3. TS smoke test: hardcoded connection ID replaced with NEXUS_TEST_CONNECTION_ID env var 4. site/ build artifacts removed from git, added to .gitignore 5. nexus-sdk-ts/.gitignore: added node_modules/ Previously staged fixes also included: - Go smoke test: safePrefix helper for all slice operations - Go/Python smoke tests: require NEXUS_GATEWAY_URL env var - @modelcontextprotocol/sdk moved to devDependencies Verified: tsc ✅ | go build+test ✅ | python 10/10 ✅ | mkdocs build ✅
1 parent e2e56f7 commit 2e417f8

53 files changed

Lines changed: 48 additions & 7399 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ tmp/
5656
*.tmp
5757

5858
# Documentation/Artifacts
59+
site/
5960
docs/site/
6061
node_modules/
6162
__pycache__/

nexus-sdk-python/tests/smoke_test.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414

1515
from nexus_sdk import NexusClient, NexusClientOptions, TokenCache, RequestConnectionInput
1616

17-
GATEWAY_URL = os.environ.get(
18-
"NEXUS_GATEWAY_URL",
19-
"https://dromos-oauth-gateway.bravesea-3f5f7e75.eastus.azurecontainerapps.io",
20-
)
17+
GATEWAY_URL = os.environ.get("NEXUS_GATEWAY_URL", "")
18+
if not GATEWAY_URL:
19+
print("error: NEXUS_GATEWAY_URL environment variable is required", file=sys.stderr)
20+
print("usage: NEXUS_GATEWAY_URL=https://your-gateway.example.com python3 smoke_test.py", file=sys.stderr)
21+
sys.exit(1)
2122
WORKSPACE = "test-workspace-001"
2223

2324

nexus-sdk-ts/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
dist/
2+
node_modules/

nexus-sdk-ts/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
"author": "Prescott Data",
3434
"license": "ISC",
3535
"dependencies": {
36-
"@modelcontextprotocol/sdk": "^1.29.0",
37-
"lru-cache": "^11.3.6",
38-
"zod": "^4.4.3"
36+
"lru-cache": "^11.3.6"
3937
},
4038
"devDependencies": {
39+
"@modelcontextprotocol/sdk": "^1.29.0",
4140
"@types/node": "^25.7.0",
4241
"tsx": "^4.21.0",
43-
"typescript": "^6.0.3"
42+
"typescript": "^6.0.3",
43+
"zod": "^4.4.3"
4444
}
4545
}

nexus-sdk-ts/tests/smoke-gateway-api.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
/**
22
* Smoke test for the new Gateway API methods in NexusClient.
33
* Tests: requestConnection, checkConnection, getTokenByConnectionId
4+
*
5+
* Usage:
6+
* NEXUS_GATEWAY_URL=https://your-gateway.example.com npx tsx tests/smoke-gateway-api.ts
47
*/
58
import { NexusClient } from '../src/index.js';
69

7-
const GATEWAY_URL = process.env.NEXUS_GATEWAY_URL || 'https://dromos-oauth-gateway.bravesea-3f5f7e75.eastus.azurecontainerapps.io';
10+
const GATEWAY_URL = process.env.NEXUS_GATEWAY_URL;
11+
if (!GATEWAY_URL) {
12+
console.error('error: NEXUS_GATEWAY_URL environment variable is required');
13+
console.error('usage: NEXUS_GATEWAY_URL=https://your-gateway.example.com npx tsx tests/smoke-gateway-api.ts');
14+
process.exit(1);
15+
}
816

917
async function main() {
1018
const client = new NexusClient({
@@ -30,14 +38,19 @@ async function main() {
3038
const status = await client.checkConnection(conn.connectionId);
3139
console.error(` ✅ Status: ${status}`);
3240

33-
// 3. getTokenByConnectionId (using an existing active GitHub connection)
34-
console.error('\n3. Testing getTokenByConnectionId (existing GitHub connection)...');
35-
try {
36-
const token = await client.getTokenByConnectionId('d10f8c19-c468-445f-9fa8-f491e6f6071e');
37-
console.error(` ✅ Got token: ${token.accessToken.substring(0, 10)}...`);
38-
console.error(` ✅ Token type: ${token.tokenType}`);
39-
} catch (err: any) {
40-
console.error(` ❌ ${err.message}`);
41+
// 3. getTokenByConnectionId (using an existing active connection)
42+
const testConnectionId = process.env.NEXUS_TEST_CONNECTION_ID;
43+
if (testConnectionId) {
44+
console.error('\n3. Testing getTokenByConnectionId...');
45+
try {
46+
const token = await client.getTokenByConnectionId(testConnectionId);
47+
console.error(` ✅ Got token: ${token.accessToken.substring(0, 10)}...`);
48+
console.error(` ✅ Token type: ${token.tokenType}`);
49+
} catch (err: any) {
50+
console.error(` ❌ ${err.message}`);
51+
}
52+
} else {
53+
console.error('\n3. Skipping getTokenByConnectionId (NEXUS_TEST_CONNECTION_ID not set)');
4154
}
4255

4356
console.error('\n=== All Gateway API tests passed! ===');

nexus-sdk/cmd/smoke-mcp/main.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,20 @@ import (
1717
oauthsdk "github.com/Prescott-Data/nexus-framework/nexus-sdk"
1818
)
1919

20+
// safePrefix returns at most n characters from s, avoiding out-of-bounds panics.
21+
func safePrefix(s string, n int) string {
22+
if len(s) <= n {
23+
return s
24+
}
25+
return s[:n]
26+
}
27+
2028
func main() {
2129
gatewayURL := os.Getenv("NEXUS_GATEWAY_URL")
2230
if gatewayURL == "" {
23-
gatewayURL = "https://dromos-oauth-gateway.bravesea-3f5f7e75.eastus.azurecontainerapps.io"
31+
fmt.Fprintln(os.Stderr, "error: NEXUS_GATEWAY_URL environment variable is required")
32+
fmt.Fprintln(os.Stderr, "usage: NEXUS_GATEWAY_URL=https://your-gateway.example.com go run .")
33+
os.Exit(1)
2434
}
2535
workspace := "test-workspace-001"
2636

@@ -43,7 +53,7 @@ func main() {
4353
fmt.Printf("❌ %v\n", err)
4454
failed++
4555
} else {
46-
fmt.Printf("✅ token=%s... type=%s\n", tok.AccessToken[:10], tok.TokenType)
56+
fmt.Printf("✅ token=%s... type=%s\n", safePrefix(tok.AccessToken, 10), tok.TokenType)
4757
passed++
4858
}
4959

@@ -54,7 +64,7 @@ func main() {
5464
fmt.Printf("❌ %v\n", err)
5565
failed++
5666
} else {
57-
fmt.Printf("✅ token=%s... type=%s\n", tok2.AccessToken[:10], tok2.TokenType)
67+
fmt.Printf("✅ token=%s... type=%s\n", safePrefix(tok2.AccessToken, 10), tok2.TokenType)
5868
passed++
5969
}
6070

@@ -91,7 +101,7 @@ func main() {
91101
fmt.Printf("✅ user: %s\n", login)
92102
passed++
93103
} else {
94-
fmt.Printf("❌ unexpected response: %s\n", string(body[:80]))
104+
fmt.Printf("❌ unexpected response: %s\n", safePrefix(string(body), 80))
95105
failed++
96106
}
97107
}
@@ -112,7 +122,7 @@ func main() {
112122
fmt.Printf("✅ user: %s\n", email)
113123
passed++
114124
} else {
115-
fmt.Printf("❌ unexpected response: %s\n", string(body2[:80]))
125+
fmt.Printf("❌ unexpected response: %s\n", safePrefix(string(body2), 80))
116126
failed++
117127
}
118128
}

site/assets/images/favicon.png

-1.83 KB
Binary file not shown.

site/assets/javascripts/bundle.79ae519e.min.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

site/assets/javascripts/bundle.79ae519e.min.js.map

Lines changed: 0 additions & 7 deletions
This file was deleted.

site/assets/javascripts/lunr/min/lunr.ar.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)