VS Code's sign-in keeps its place; recordings checked for secrets
CI / test (push) Successful in 9m14s
CI / test (push) Successful in 9m14s
From review. - /profile asked before signing in keeps its query for ten minutes, and the sign-in (password or OIDC) returns to it: VS Code's sign-in state came back lost, and the confirmation came every time. Only /profile is ever returned to. - The extension keeps an https gateway at https when a link names it by plain http (a proxy ending TLS unannounced), so the key is never sent in the clear. The install command says --force, since dev builds share a version and VS Code kept the old one. - Every frame of every install recording is checked for a key, a password or a private key, not only the page. - The admin API document again matches the API: f94d902's MCPServerRequest.clear was not in it. - CHANGELOG for this round's fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
258591b3f2
commit
ecf5545a7a
11 files changed
+133
-6
No files matched your search
@@ -103,12 +103,18 @@ function activate(context) {
|
||||
async function handleUri(uri) {
|
||||
if (uri.path !== '/connect') return;
|
||||
const q = new URLSearchParams(uri.query);
|
||||
const base = lib.gatewayBase(q.get('gateway'));
|
||||
let base = lib.gatewayBase(q.get('gateway'));
|
||||
const key = (q.get('key') || '').trim();
|
||||
if (!base || !key) {
|
||||
vscode.window.showErrorMessage('llmgw: the link has no gateway or no key in it.');
|
||||
return;
|
||||
}
|
||||
// The same gateway by plain http, behind a proxy that ends TLS without
|
||||
// saying so: kept at https, so the key is never sent in the clear.
|
||||
const current = gateway();
|
||||
if (current && lib.downgrades(current, base)) {
|
||||
base = current;
|
||||
}
|
||||
const expected =
|
||||
pending && pending.base === base && q.get('state') === pending.state && Date.now() - pending.at < SIGN_IN_TTL_MS;
|
||||
pending = null;
|
||||
|
||||
@@ -263,7 +263,19 @@ function tokenGuess(text) {
|
||||
return Math.ceil(String(text || '').length / 4);
|
||||
}
|
||||
|
||||
// downgrades reports whether next is the gateway at current by plain http
|
||||
// where current is https: the same host and port, a weaker scheme.
|
||||
function downgrades(current, next) {
|
||||
try {
|
||||
const a = new URL(current);
|
||||
const b = new URL(next);
|
||||
return a.protocol === 'https:' && b.protocol === 'http:' && a.hostname === b.hostname;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
USER, ASSISTANT, SYSTEM,
|
||||
gatewayBase, modelInfo, chatMessages, chatTools, requestBody, sseData, Answer, errorMessage, tokenGuess,
|
||||
gatewayBase, modelInfo, chatMessages, chatTools, requestBody, sseData, Answer, errorMessage, tokenGuess, downgrades,
|
||||
};
|
||||
@@ -121,3 +121,10 @@ test('errorMessage says what to do about a refused key', () => {
|
||||
assert.match(lib.errorMessage(429, '{"error":{"message":"rate limit"}}'), /rate limit/);
|
||||
assert.match(lib.errorMessage(500, 'boom'), /500: boom/);
|
||||
});
|
||||
|
||||
test('a link to the same gateway by plain http is a downgrade', () => {
|
||||
assert.equal(lib.downgrades('https://llm.example.com', 'http://llm.example.com'), true);
|
||||
assert.equal(lib.downgrades('https://llm.example.com', 'https://llm.example.com'), false);
|
||||
assert.equal(lib.downgrades('http://llm.example.com', 'https://llm.example.com'), false);
|
||||
assert.equal(lib.downgrades('https://a.example.com', 'http://b.example.com'), false);
|
||||
});
|
||||
Reference in new issue
Block a user