mirror of
https://github.com/github/awesome-copilot.git
synced 2026-08-13 12:49:49 +00:00
Improve connector reload authentication UX (#2370)
Keep Azure tokens in memory and preserve linked namespace context across extension reloads. Co-authored-by: Alex Yang (DevDiv) <yangalex@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -67,6 +67,27 @@ test("setup prompts, polls, cancels, and reloads subscriptions after browser sig
|
||||
assert.match(html, /\/api\/subscriptions/);
|
||||
});
|
||||
|
||||
test("a linked namespace gets a focused sign-in state and returns to its catalog", () => {
|
||||
const html = renderSetupHtml([], "", "token", { linkedNamespace: "saved-gateway" });
|
||||
assert.match(html, /Sign in to see your connectors/);
|
||||
assert.match(html, /Connector namespace <code>saved-gateway<\/code> is already linked\./);
|
||||
assert.match(html, /Sign in to Azure to view and manage its connectors\./);
|
||||
assert.match(html, /const hasLinkedNamespace = true/);
|
||||
assert.match(html, /window\.location\.replace\("\/"\)/);
|
||||
assert.match(html, /<div id="setup-content" hidden>/);
|
||||
});
|
||||
|
||||
test("linked namespace sign-in escapes saved names and produces valid client JavaScript", () => {
|
||||
const html = renderSetupHtml([], "", "token", {
|
||||
linkedNamespace: `gateway</code><script>alert("xss")</script>`,
|
||||
});
|
||||
assert.doesNotMatch(html, /<script>alert\("xss"\)<\/script>/);
|
||||
assert.match(html, /gateway<\/code><script>alert\("xss"\)<\/script>/);
|
||||
const script = html.match(/<script>([\s\S]*)<\/script>/)?.[1];
|
||||
assert.ok(script, "linked setup page must include its client script");
|
||||
assert.doesNotThrow(() => new Function(script));
|
||||
});
|
||||
|
||||
test("setup sign-in uses a compact borderless blank state", () => {
|
||||
const html = renderSetupHtml([], "", "token");
|
||||
assert.match(html, /id="signin-btn" class="item-add primary signin-primary"/);
|
||||
|
||||
Reference in New Issue
Block a user