Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions docs/site/check-deploy-contract.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@ test('rejects a Worker documentation mount that differs from site-config', async

test('admits the reviewed Legion reference, and nothing else off the mount', async () => {
const admitted = await runFixture({
html: '<a href="https://docs.picogrid.com/reference/start">Legion API</a>',
html: '<a href="https://docs.picogrid.com/legion/">Legion API</a>',
});
assert.equal(admitted.ok, true, admitted.output);

// Its neighbour on the same host is not the reviewed target.
const neighbour = await runFixture({
html: '<a href="https://docs.picogrid.com/reference/other">Legion API</a>',
html: '<a href="https://docs.picogrid.com/legion/other">Legion API</a>',
});
assert.equal(neighbour.ok, false);
assert.match(neighbour.output, /resolves outside \/ecn-sdk\/: .*\/reference\/other/);
assert.match(neighbour.output, /resolves outside \/ecn-sdk\/: .*\/legion\/other/);

// A page of the guide that escapes the mount still fails.
const escaped = await runFixture({ html: '<a href="/concepts/ecns/">Concepts</a>' });
Expand All @@ -151,7 +151,7 @@ test('admits the reviewed Legion reference, and nothing else off the mount', asy
});

test('rejects variants of the reviewed Legion reference', async () => {
const reviewed = 'https://docs.picogrid.com/reference/start';
const reviewed = 'https://docs.picogrid.com/legion/';
// The credential is applied through the URL API rather than written inline. A
// credential-bearing URL literal on an approved host is a publication-input
// violation in its own right, and the release scan refuses the file carrying
Expand Down
8 changes: 6 additions & 2 deletions docs/site/legion-documentation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@
*/

const approvedOrigin = 'https://docs.picogrid.com';
const defaultPath = '/reference/start';
const defaultPath = '/legion/';
const label = 'Legion API';
const segmentPattern = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
// Reference material lives under one of these roots. An allowlist rather than a
// list of authentication routes to refuse: a blacklist admits every endpoint
// nobody thought of, and the decision requires this to fail closed.
const documentationRoots = new Set(['docs', 'guides', 'reference']);
//
// `legion` is the current mount, built from the legion-docs repo. `reference` is
// retained because the ReadMe site it names is still served on this host, so a
// build can still be pointed back at it while that remains true.
const documentationRoots = new Set(['legion', 'docs', 'guides', 'reference']);
const versionPattern = /^[A-Za-z0-9][A-Za-z0-9. _-]{0,31}$/;
// A dot segment, single or double, literal or percent-encoded. `URL` normalizes
// these away, so the raw target has to be refused before it is parsed or the
Expand Down
8 changes: 4 additions & 4 deletions docs/site/legion-documentation.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function resolve(environment) {
}

const defaultTarget = {
href: 'https://docs.picogrid.com/reference/start',
href: 'https://docs.picogrid.com/legion/',
label: 'Legion API',
origin: 'https://docs.picogrid.com',
title: 'Legion API documentation',
Expand All @@ -28,7 +28,7 @@ test('uses the default target when LEGION_DOCS_URL is empty or whitespace', () =
});

test('accepts explicit targets under each documentation root', () => {
for (const root of ['docs', 'guides', 'reference']) {
for (const root of ['legion', 'docs', 'guides', 'reference']) {
const href = `https://docs.picogrid.com/${root}/start`;
assert.equal(resolve({ LEGION_DOCS_URL: href }).href, href);
}
Expand Down Expand Up @@ -122,14 +122,14 @@ test('rejects bare query and fragment delimiters', () => {
test('rejects a path outside the documentation roots', () => {
assert.throws(
() => resolve({ LEGION_DOCS_URL: 'https://docs.picogrid.com/api/start' }),
/the Legion documentation target must address a published documentation path \(docs, guides, reference\)/,
/the Legion documentation target must address a published documentation path \(legion, docs, guides, reference\)/,
);
});

test('rejects an empty path segment', () => {
assert.throws(
() => resolve({ LEGION_DOCS_URL: 'https://docs.picogrid.com/reference//start' }),
/the Legion documentation target must address a published documentation path \(docs, guides, reference\)/,
/the Legion documentation target must address a published documentation path \(legion, docs, guides, reference\)/,
);
});

Expand Down
Loading