Skip to content

matthewwong525/WongStack / .agents/plugins/access

access

Verified

See who can sign in and what each person may use; add, change or remove a person.

FileKindSize
README.mdmarkdown3.4 KB
SKILL.mdskill md2.3 KB
VERSIONother6 B
hooks/claude.jsonconfig251 B
hooks/codex.jsonconfig232 B
references/setup.mdmarkdown9.7 KB
screen/access.cssother10.5 KB
screen/address.mjsscript2.1 KB
screen/api.mjsscript11.6 KB
screen/api.test.mjsscript13.4 KB
screen/app.mjsscript1.2 KB
screen/app.test.mjsscript40.3 KB
screen/confirm.mjsscript1.1 KB
screen/context.mjsscript248 B
screen/copy-text.mjsscript1.3 KB
screen/fields.mjsscript1001 B
screen/hidden.test.mjsscript6.8 KB
screen/labels.mjsscript1.4 KB
screen/leaving.test.mjsscript14.6 KB
screen/level-choice.mjsscript1.3 KB
screen/levels.mjsscript3.7 KB
screen/levels.test.mjsscript7.9 KB
screen/loading.mjsscript457 B
screen/main.d.mtsother1.0 KB
screen/main.mjsscript1.3 KB
screen/note.mjsscript2.1 KB
screen/note.test.mjsscript4.1 KB
screen/notices.mjsscript4.3 KB
screen/notices.test.mjsscript2.2 KB
screen/own.mjsscript889 B
screen/owner.mjsscript2.7 KB
screen/page.mjsscript4.2 KB
screen/people.mjsscript4.5 KB
screen/person-page.mjsscript3.5 KB
screen/person-page.test.mjsscript37.2 KB
screen/project-step.mjsscript1.7 KB
screen/project-step.test.mjsscript5.4 KB
screen/pushers.mjsscript3.5 KB
screen/pushers.test.mjsscript5.2 KB
screen/role-page.mjsscript2.5 KB
screen/role-select.mjsscript1.6 KB
screen/roles.mjsscript1.5 KB
screen/roles.test.mjsscript22.2 KB
screen/router.mjsscript3.3 KB
screen/seal.d.mtsother470 B
screen/seal.mjsscript2.6 KB
screen/seal.test.mjsscript1.1 KB
screen/services.mjsscript4.3 KB
screen/services.test.mjsscript12.5 KB
screen/set-fields.mjsscript3.5 KB
screen/status.mjsscript2.4 KB
screen/status.test.mjsscript2.7 KB
screen/style.test.mjsscript11.5 KB
screen/subjects.mjsscript487 B
screen/subjects.test.mjsscript2.4 KB
screen/table.mjsscript4.5 KB
screen/test-dom.mjsscript9.4 KB
screen/ui.mjsscript14.2 KB
screen/view.mjsscript2.1 KB
screen/welcome.mjsscript2.3 KB
screen/welcome.test.mjsscript11.2 KB
scripts/check-definitions.mjsexecutablescript1.1 KB
scripts/lib/check-definitions.mjsscript1.2 KB
scripts/lib/client.mjsscript4.6 KB
scripts/lib/openapi.mjsscript20.6 KB
scripts/lib/scrub.mjsscript7.0 KB
scripts/lib/seal-keys.mjsscript1.1 KB
scripts/lib/services.mjsscript17.6 KB
scripts/services.mjsexecutablescript8.6 KB
scripts/session-start.mjsscript1.7 KB
server/errors.d.mtsother572 B
server/errors.mjsscript1.8 KB
server/errors.test.mjsscript1.3 KB
server/forward.d.mtsother1.6 KB
server/forward.mjsscript11.0 KB
server/forward.test.mjsscript9.4 KB
server/index.d.mtsother3.3 KB
server/index.mjsscript11.3 KB
server/index.test.mjsscript11.8 KB
server/key-rules.d.mtsother643 B
server/key-rules.mjsscript4.0 KB
server/key-rules.test.mjsscript5.2 KB
server/levels.d.mtsother2.3 KB
server/levels.mjsscript4.3 KB
server/levels.test.mjsscript2.4 KB
server/management.mjsscript2.8 KB
server/page.mjsscript1.3 KB
server/pass.d.mtsother213 B
server/pass.mjsscript3.5 KB
server/people.mjsscript5.3 KB
server/policy.d.mtsother1.5 KB
server/policy.mjsscript8.1 KB
server/roles.mjsscript2.4 KB
server/sealed.d.mtsother377 B
server/sealed.mjsscript3.2 KB
server/sealed.test.mjsscript4.9 KB
server/services.d.mtsother487 B
server/services.mjsscript3.1 KB
server/services.test.mjsscript4.5 KB
server/sets.mjsscript4.5 KB
server/start.mjsscript1.8 KB
server/tools.d.mtsother1.2 KB
server/tools.mjsscript8.7 KB
server/tools.test.mjsscript10.4 KB
signin/cloudflare-list.d.mtsother969 B
signin/cloudflare-list.mjsscript11.6 KB
signin/cloudflare-list.test.mjsscript1.4 KB
signin/cloudflare.d.mtsother1.5 KB
signin/cloudflare.mjsscript7.2 KB
signin/cloudflare.test.mjsscript1.4 KB
signin/computer.d.mtsother557 B
signin/computer.mjsscript2.4 KB
signin/computer.test.mjsscript1.0 KB
store/contract.d.mtsother293 B
store/contract.mjsscript14.3 KB
store/interface.d.mtsother4.2 KB
store/interface.mjsscript1.2 KB
store/stand-in.d.mtsother93 B
store/stand-in.mjsscript10.4 KB
store/stand-in.test.mjsscript202 B

server/forward.test.mjs

View on GitHub
import { afterEach, beforeEach, expect, test, vi } from 'vitest';
import { checkInput, forwardActions } from './forward.mjs';

// A made-up registry. Notion offers both levels and names two searches it sends as POST; Ledger offers Read alone and
// sends its key bare in a header of its own; Shop trades an ID and a secret for a token; Stripe is not used directly.
const registry = {
  notion: { title: 'Notion', purpose: 'Notion work', docs: 'https://developers.notion.example/', secrets: ['NOTION_TOKEN'], forward: { base: 'https://api.notion.example/v1/', secret: 'NOTION_TOKEN',
    header: 'Authorization', prefix: 'Bearer ', headers: { 'Notion-Version': '2022-06-28' }, lookups: ['POST search', 'POST databases/*/query'] } },
  ledger: { title: 'Ledger', purpose: 'Ledger work', secrets: ['LEDGER_ID', 'LEDGER_KEY'], levels: ['read'], forward: { base: 'https://ledger.example/', secret: 'LEDGER_KEY', header: 'X-Api-Key' } },
  shop: { title: 'Shop', purpose: 'Store orders', secrets: ['SHOP', 'SHOP_ID'], levels: ['read'], forward: { base: 'https://shop.example/admin/', secret: 'SHOP',
    header: 'X-Shop-Token', prefix: '', exchange: { url: 'https://shop.example/admin/oauth/access_token' } } },
  stripe: { title: 'Stripe', purpose: 'Stripe work', secrets: ['STRIPE_SECRET_KEY'] },
};
const saved = { NOTION_TOKEN: 'notion-token-value', LEDGER_KEY: 'ledger-key-value', SHOP: 'shop-secret', SHOP_ID: 'shop-client' };
let answer;
let send;
let log;
const ask = (key, kind, input) => forwardActions(registry, send).routes.get(`POST /api/direct/${key}/${kind}`)
  .handler(input, { secret: name => saved[name], signal: new AbortController().signal, caller: 'owner@example.com' });
const code = async response => [response.status, (await response.json()).error.code];
const sent = () => { const [url, init] = send.mock.calls.at(-1); return { url: String(url), init }; };

beforeEach(() => {
  answer = () => Response.json({ results: [] });
  send = vi.fn(async url => String(url).endsWith('oauth/access_token') ? Response.json({ access_token: 'token-1', expires_in: 3600 }) : answer());
  log = vi.spyOn(console, 'log').mockImplementation(() => {});
});
afterEach(() => { vi.restoreAllMocks(); });

test('builds a look-up action per key set up, a change action where it offers Read & write, each mapped to its key', () => {
  const { routes, access } = forwardActions(registry, send);
  expect([...access]).toEqual([
    ['POST /api/direct/notion/read', { keys: ['notion'], direct: true }], ['POST /api/direct/notion/change', { keys: ['notion'], direct: true }],
    ['POST /api/direct/ledger/read', { keys: ['ledger'], direct: true }], ['POST /api/direct/shop/read', { keys: ['shop'], direct: true }]]);
  const notion = routes.get('POST /api/direct/notion/read');
  expect([notion.operationId, notion.effect, routes.get('POST /api/direct/notion/change').effect]).toEqual(['notion.read', 'read', 'external']);
  expect(notion.description).toContain('GET, HEAD, and POST search, POST databases/*/query. Anything else needs notion.change, which needs Read & write.');
  expect(routes.get('POST /api/direct/ledger/read').description).toContain('GET, HEAD. This key passes on nothing else.');
  expect(Object.keys(notion.errors).sort()).toEqual(['bad_answer', 'not_a_lookup', 'not_allowed', 'too_large']);
  expect('no_token' in routes.get('POST /api/direct/shop/read').errors).toBe(true);
  expect(() => forwardActions({ bad: { ...registry.notion, forward: { ...registry.notion.forward, base: 'http://x.example/' } } })).toThrow('bad: base must be an HTTPS address ending in /');
});

test('passes a look-up on with the key added, and a change with its body; refuses what is not a look-up at Read', async () => {
  const looked = await ask('notion', 'read', { method: 'GET', path: 'pages/abc', query: 'page_size=5' });
  expect(await looked.json()).toEqual({ status: 200, contentType: 'application/json', body: { results: [] } });
  expect(sent().url).toBe('https://api.notion.example/v1/pages/abc?page_size=5');
  expect(sent().init.headers).toEqual({ 'Notion-Version': '2022-06-28', Accept: 'application/json', Authorization: 'Bearer notion-token-value' });
  expect([sent().init.method, sent().init.redirect, sent().init.body]).toEqual(['GET', 'manual', undefined]);
  expect((await ask('notion', 'read', { method: 'POST', path: 'databases/db-1/query', body: { q: 1 } })).status).toBe(200);
  expect(sent().init.body).toBe('{"q":1}');
  expect(await code(await ask('notion', 'read', { method: 'POST', path: 'databases/a/b/query' }))).toEqual([400, 'not_a_lookup']);
  expect((await ask('notion', 'change', { method: 'PATCH', path: 'pages/abc', body: 'title=x', contentType: 'text/plain' })).status).toBe(200);
  expect([sent().init.body, sent().init.headers['Content-Type']]).toEqual(['title=x', 'text/plain']);
  expect((await ask('ledger', 'read', { method: 'GET', path: 'accounts' })).status).toBe(200);
  expect(sent().init.headers).toEqual({ Accept: 'application/json', 'X-Api-Key': 'ledger-key-value' });
});

test('refuses a path off the address and an input it does not take, before any request leaves', async () => {
  for (const path of ['/pages', '//evil.example/x', '../v2', 'pages?x=1']) expect(await code(await ask('notion', 'change', { method: 'GET', path }))).toEqual([400, 'not_allowed']);
  for (const input of [null, [], { method: 'GET', path: '' }, { method: 'TRACE', path: 'x' }, { method: 'GET', path: 'x', query: 1 },
    { method: 'GET', path: 'x', contentType: 'text/plain\r\nX: 1' }, { method: 'GET', path: 'x', headers: {} }]) {
    expect(await code(await ask('notion', 'change', input)), JSON.stringify(input)).toEqual([400, 'invalid_input']);
  }
  expect(checkInput({ method: 'GET', path: 'x', headers: {} })).toEqual({ problem: 'headers: is not a field' });
  expect(send).not.toHaveBeenCalled();
  expect(log).not.toHaveBeenCalled();
});

test('follows no redirect, bounds the answer, and returns none that carries the key', async () => {
  answer = () => new Response(null, { status: 302, headers: { Location: 'https://elsewhere.example/' } });
  expect(await code(await ask('notion', 'read', { method: 'GET', path: 'pages' }))).toEqual([502, 'bad_answer']);
  answer = () => new Response('x'.repeat(1_000_001));
  expect(await code(await ask('notion', 'read', { method: 'GET', path: 'pages' }))).toEqual([413, 'too_large']);
  answer = () => new Response('ok', { headers: { 'content-type': 'text/plain; note=notion-token-value' } });
  expect(await code(await ask('notion', 'read', { method: 'GET', path: 'pages' }))).toEqual([502, 'bad_answer']);
  answer = () => new Response('<html>', { status: 500, headers: { 'content-type': 'application/json' } });
  expect(await (await ask('notion', 'read', { method: 'GET', path: 'pages' })).json()).toEqual({ status: 500, contentType: 'application/json', body: '<html>' });
  answer = () => new Response(null, { status: 204 });
  expect(await (await ask('notion', 'change', { method: 'DELETE', path: 'pages/a' })).json()).toEqual({ status: 204, contentType: '', body: '' });
});

test('records each request with who, which key, what kind and where, and never the query, the body or the key', async () => {
  await ask('notion', 'change', { method: 'POST', path: 'pages', query: 'private=1', body: { title: 'Private title' } });
  send.mockImplementationOnce(async () => { throw new Error('unreachable'); });
  await expect(ask('notion', 'read', { method: 'GET', path: 'pages' })).rejects.toThrow('unreachable');
  expect(log.mock.calls.map(([line]) => JSON.parse(line))).toEqual([
    { event: 'direct_request', caller: 'owner@example.com', key: 'notion', kind: 'change', method: 'POST', path: 'pages', status: 200 },
    { event: 'direct_request', caller: 'owner@example.com', key: 'notion', kind: 'read', method: 'GET', path: 'pages', status: 0 }]);
  for (const hidden of ['private', 'Private title', 'notion-token-value']) expect(JSON.stringify(log.mock.calls)).not.toContain(hidden);
});

test('trades the ID and the secret for a token once, trades again on a refusal, and refuses when none comes', async () => {
  answer = () => Response.json({ shop: 'Claymoo' });
  expect(await (await ask('shop', 'read', { method: 'GET', path: 'shop.json' })).json()).toMatchObject({ status: 200 });
  await ask('shop', 'read', { method: 'GET', path: 'shop.json' });
  const trades = () => send.mock.calls.filter(([url]) => String(url).endsWith('oauth/access_token'));
  expect(trades()).toHaveLength(1);
  expect(String(trades()[0][1].body)).toBe('grant_type=client_credentials&client_id=shop-client&client_secret=shop-secret');
  expect(sent().init.headers).toEqual({ Accept: 'application/json', 'X-Shop-Token': 'token-1' });
  answer = () => Response.json({}, { status: 401 });
  expect(await (await ask('shop', 'read', { method: 'GET', path: 'shop.json' })).json()).toMatchObject({ status: 401 });
  expect(trades()).toHaveLength(2);
  send.mockImplementation(async url => String(url).endsWith('oauth/access_token') ? Response.json({ token: 'wrong-field' }) : answer());
  expect(await code(await ask('shop', 'read', { method: 'GET', path: 'shop.json' }))).toEqual([502, 'no_token']);
  // A second trade that gives nothing refuses too.
  let first = true;
  send.mockImplementation(async url => String(url).endsWith('oauth/access_token')
    ? first ? (first = false, Response.json({ access_token: 'token-2' })) : new Response(null, { status: 400 }) : Response.json({}, { status: 401 }));
  expect(await code(await ask('shop', 'read', { method: 'GET', path: 'shop.json' }))).toEqual([502, 'no_token']);
});
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall