HarnessRouter Community Edition: the self-hosted, Apache-2.0 edition of the unified interface for agent harnesses. Run Codex, Claude Code, Hermes, PI, DSH, and more through one API, with sessions, streaming, files, cancellation, and failure handling. Implements the Unified Harness Protocol (UHP), an open standard. Your keys, your infrastructure.
Python agent-apiagent-frameworkagent-harnessai-agentsai-infrastructurecoding-agentconformance-testingdeepseek-harnessharness-engineeringhermesllmopen-protocolopen-sourceopen-standardpi-coding-agentself-hosteduhpunified-apiunified-harness-protocolunified-interface
import { safeNext } from './safe-next';
// GHSA-59mq-hx4p-fw48: a sign-in link must not be able to send the person to another site.
test.each([
['https://evil.example/'],
['http://evil.example'],
['javascript:alert(1)'],
['data:text/html,hi'],
['evil.example'],
['//evil.example'],
['//evil.example/harnesses'],
['/\\evil.example'],
['\\\\evil.example'],
['/\\/evil.example'],
['/%2F%2Fevil.example'],
['/%2fevil.example'],
['/%5Cevil.example'],
['/%5cevil.example'],
['/\t/evil.example'],
['/\n/evil.example'],
['/\r//evil.example'],
[' /harnesses'],
[''],
])('%j is refused for the default', (raw) => {
expect(safeNext(raw)).toBe('/start');
});
test.each([
['/harnesses', '/harnesses'],
['/kits?tab=sheets', '/kits?tab=sheets'],
['/harnesses/chrn_abc#settings', '/harnesses/chrn_abc#settings'],
['/plugins?q=a%20b', '/plugins?q=a%20b'],
])('%j, a path on this site, is kept', (raw, want) => {
expect(safeNext(raw)).toBe(want);
});
test('what the middleware writes survives the round trip', () => {
const pathname = '/harnesses/chrn_abc';
const search = '?view=tasks';
const link = `/login?next=${encodeURIComponent(pathname + search)}`;
const next = new URLSearchParams(link.split('?')[1]).get('next');
expect(safeNext(next)).toBe(pathname + search);
});
test('nothing at all, and a custom default', () => {
expect(safeNext(null)).toBe('/start');
expect(safeNext(undefined, '/quickstart')).toBe('/quickstart');
});