Skip to content

Commit 088ebc0

Browse files
committed
rabbit fixes
1 parent e2abd6e commit 088ebc0

4 files changed

Lines changed: 15 additions & 3 deletions

File tree

src/app.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ app.get("/", async (_c) => {
5151

5252
// Serve Gemini extension manifest
5353
app.get("/gemini-extension.json", (c) => {
54+
c.header("Cache-Control", "public, max-age=3600");
5455
return c.json(geminiExtension);
5556
});
5657

5758
app.get("/.well-known/gemini-extension.json", (c) => {
59+
c.header("Cache-Control", "public, max-age=3600");
5860
return c.json(geminiExtension);
5961
});
6062

src/lib/security.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ export function validateHost(host: string | null): boolean {
6767
return false;
6868
}
6969

70+
// Validate suffix after closing bracket
71+
const suffix = host.substring(closeBracketIndex + 1);
72+
if (suffix !== "") {
73+
// If there's a suffix, it must be :port (colon followed by digits)
74+
if (!/^:\d+$/.test(suffix)) {
75+
return false;
76+
}
77+
}
78+
7079
// Extract IPv6 address with brackets (e.g., "[::1]" from "[::1]:8080")
7180
// Preserve the brackets as getAllowedHostnames returns IPv6 with brackets
7281
normalizedHost = host.substring(0, closeBracketIndex + 1);

src/mcp/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export function formatMeasurementSummary(measurement: any): string {
136136
const avg = testResult.stats.avg !== undefined ? testResult.stats.avg : "N/A";
137137
const max = testResult.stats.max !== undefined ? testResult.stats.max : "N/A";
138138
const loss =
139-
testResult.stats.loss !== undefined
139+
typeof testResult.stats.loss === "number" && !isNaN(testResult.stats.loss)
140140
? testResult.stats.loss.toFixed(2)
141141
: "N/A";
142142

src/mcp/tools.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ export function registerGlobalpingTools(agent: GlobalpingMCP, getToken: () => st
350350
inputSchema: {
351351
target: z
352352
.string()
353-
.describe("Domain name or IP to test (e.g., 'google.com', '1.1.1.1')"),
353+
.min(1)
354+
.describe("Destination hostname or IP to run the MTR against"),
354355
locations: z
355356
.union([z.array(z.string()), z.string()])
356357
.optional()
@@ -556,7 +557,7 @@ export function registerGlobalpingTools(agent: GlobalpingMCP, getToken: () => st
556557
{
557558
title: "List Probe Locations",
558559
description:
559-
"Retrieve the list of available Globalping probe locations. Use this tool to find specific countries, cities, or ASNs to use as the 'locations' argument in other measurement tools. Avoid using this tool unless absolutely necessary, instead simplify provide the location you need to the tools above, the field is smart and will auto select the right probes.",
560+
"Retrieve the list of available Globalping probe locations. Use this tool to find specific countries, cities, or ASNs to use as the 'locations' argument in other measurement tools. Avoid using this tool unless absolutely necessary, instead simply provide the location you need to the tools above, the field is smart and will auto select the right probes.",
560561
annotations: {
561562
readOnlyHint: true,
562563
},

0 commit comments

Comments
 (0)