@agentsignalnet/claude-plugin 0.2.62 → 0.2.63
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.
package/package.json
CHANGED
package/scripts/chat-viewer.mjs
CHANGED
|
@@ -151,6 +151,48 @@ function isPage(pathname) {
|
|
|
151
151
|
return pathname === '/' || pathname.startsWith('/a/');
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* What somebody sees when they arrive without the link.
|
|
156
|
+
*
|
|
157
|
+
* IT NAMES NOTHING. Not the product, not the account, not a channel or a
|
|
158
|
+
* handle, and not the word for what this is. Every one of those would be a
|
|
159
|
+
* fact handed to whoever asked without a credential, and none of them is
|
|
160
|
+
* needed to answer the only question the person actually has, which is "why
|
|
161
|
+
* is this refusing me and where do I get in".
|
|
162
|
+
*
|
|
163
|
+
* That restraint is load-bearing rather than decorative: a test asserts the
|
|
164
|
+
* refusal body does not match /agentsignal|viewer|token|unauthoris/, and it
|
|
165
|
+
* predates this page. Keeping the wording inside that line is what makes this
|
|
166
|
+
* an explanation rather than a weakening of the front door.
|
|
167
|
+
*
|
|
168
|
+
* Styled to match the light theme rather than left as browser default, since
|
|
169
|
+
* an unstyled wall of text reads as a crash page and the point is to look like
|
|
170
|
+
* a considered answer.
|
|
171
|
+
*/
|
|
172
|
+
function unlockPage() {
|
|
173
|
+
return [
|
|
174
|
+
'<!doctype html><html lang="en"><head><meta charset="utf-8">',
|
|
175
|
+
'<meta name="viewport" content="width=device-width,initial-scale=1">',
|
|
176
|
+
'<title>Dashboard</title><style>',
|
|
177
|
+
'body{margin:0;min-height:100vh;display:grid;place-items:center;background:#f7f7f5;',
|
|
178
|
+
'color:#1b1b19;font:15px/1.6 ui-sans-serif,-apple-system,system-ui,sans-serif}',
|
|
179
|
+
'main{max-width:34rem;padding:2rem}',
|
|
180
|
+
'h1{font-size:1.15rem;margin:0 0 .75rem}',
|
|
181
|
+
'p{margin:0 0 .75rem;color:#3d3d38}',
|
|
182
|
+
'code{background:#ecece7;padding:.15rem .35rem;border-radius:4px;',
|
|
183
|
+
'font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace}',
|
|
184
|
+
'</style></head><body><main>',
|
|
185
|
+
'<h1>This dashboard needs its link</h1>',
|
|
186
|
+
'<p>It is running. It is refusing because this browser has not been given the ',
|
|
187
|
+
'one-run link, which is printed by the command that started it and only has to ',
|
|
188
|
+
'be opened once — after that this plain address works.</p>',
|
|
189
|
+
'<p>Look in the terminal it was started from, for the line beginning ',
|
|
190
|
+
'<code>Watching</code>. To print a fresh link, stop it and start it again; a new ',
|
|
191
|
+
'one is minted per run, so the old link is already dead.</p>',
|
|
192
|
+
'</main></body></html>',
|
|
193
|
+
].join('');
|
|
194
|
+
}
|
|
195
|
+
|
|
154
196
|
/**
|
|
155
197
|
* Servers configured in ~/.claude.json that hold a key.
|
|
156
198
|
*
|
|
@@ -2458,9 +2500,10 @@ const server = createServer(async (req, res) => {
|
|
|
2458
2500
|
* could reach it.
|
|
2459
2501
|
* • An Origin check on everything that is not a GET, below.
|
|
2460
2502
|
*
|
|
2461
|
-
* A wrong or missing credential is
|
|
2462
|
-
*
|
|
2463
|
-
*
|
|
2503
|
+
* A wrong or missing credential is a flat 404 for everything EXCEPT a page
|
|
2504
|
+
* a browser asked for, which gets a short note saying a link is needed. See
|
|
2505
|
+
* `unlockPage` for why that exception is worth making and why it gives away
|
|
2506
|
+
* nothing the asker did not already have.
|
|
2464
2507
|
*/
|
|
2465
2508
|
const cookies = String(req.headers.cookie ?? '')
|
|
2466
2509
|
.split(';')
|
|
@@ -2476,6 +2519,37 @@ const server = createServer(async (req, res) => {
|
|
|
2476
2519
|
cookies[COOKIE] === token;
|
|
2477
2520
|
|
|
2478
2521
|
if (!presented) {
|
|
2522
|
+
// A LOCKED DOOR CAN STILL SAY IT IS A DOOR.
|
|
2523
|
+
//
|
|
2524
|
+
// Every unauthenticated request used to get the same flat 404, so that a
|
|
2525
|
+
// scanner learned nothing from one. For a page a person typed, that is the
|
|
2526
|
+
// wrong trade: `http://127.0.0.1:8899` is exactly what somebody types after
|
|
2527
|
+
// bookmarking the clean address, or coming back in another browser, or
|
|
2528
|
+
// clearing cookies -- and a bare 404 is indistinguishable from a dead
|
|
2529
|
+
// server. Somebody hit it and reported the viewer broken; it was working
|
|
2530
|
+
// perfectly and had no way to say so.
|
|
2531
|
+
//
|
|
2532
|
+
// The secrecy was buying almost nothing anyway. Reading this body needs a
|
|
2533
|
+
// same-origin read, which means a process on this machine -- and a local
|
|
2534
|
+
// process can already see the port with `lsof`, so it learns nothing here
|
|
2535
|
+
// it could not learn there. A hostile PAGE in the browser cannot read a
|
|
2536
|
+
// cross-origin response at all; it could always detect that something
|
|
2537
|
+
// answers on the port, and still cannot see a word of this.
|
|
2538
|
+
//
|
|
2539
|
+
// So: pages explain, everything else stays flat. No channel names, no
|
|
2540
|
+
// account, no token -- nothing about WHOSE viewer this is, only that a
|
|
2541
|
+
// link is needed and where the link comes from.
|
|
2542
|
+
if (req.method === 'GET' && isPage(url.pathname)) {
|
|
2543
|
+
// no-store because this is served at the same address the real page will
|
|
2544
|
+
// be. A cached 401 at `/` would greet the person again after the cookie
|
|
2545
|
+
// was granted, which is the original complaint with extra steps.
|
|
2546
|
+
res.writeHead(401, {
|
|
2547
|
+
'Content-Type': 'text/html; charset=utf-8',
|
|
2548
|
+
'Cache-Control': 'no-store',
|
|
2549
|
+
});
|
|
2550
|
+
res.end(unlockPage());
|
|
2551
|
+
return;
|
|
2552
|
+
}
|
|
2479
2553
|
res.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
2480
2554
|
res.end('Not found.');
|
|
2481
2555
|
return;
|