Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ The provider deploys the edge function itself, with the [reference implementatio
| CloudFront | Lambda@Edge | The `aws-cloudfront-edge` Terraform module | A JSON file built into the bundle |
| Cloudflare | Workers | The `cloudflare-edge` Terraform module, or Wrangler | The Worker's variables |

The edge function stores nothing of its own on either: it reads no KV store. The reference implementation also has a Fastly Compute entry point, `src/entries/fastly.ts`, which its tests run locally under Viceroy.
The edge function stores nothing of its own on either: it reads no KV store. It also runs on Fastly Compute, through its `fastly.ts` adapter, which the reference implementation tests in Node and in its Docker-based E2E stack under Viceroy ([`README.md`](https://github.com/FORA-Protocol/reference-implementation/blob/v1.1.0/src/edge/README.md)). Fastly has no row in the table: the reference implementation has no Terraform module, console package or build script for it.

### When to Use

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The absolute minimum a provider needs to do:

## Distribution Formats

The edge function is the edge worker in the reference implementation, [`src/edge`](https://github.com/FORA-Protocol/reference-implementation/tree/v1.1.0/src/edge). It runs on Cloudflare Workers and AWS Lambda@Edge. The reference implementation also has a Fastly Compute entry point, `src/entries/fastly.ts`, which its tests run locally under Viceroy. The edge worker reaches a provider's CDN in one of two formats.
The edge function is the edge worker in the reference implementation, [`src/edge`](https://github.com/FORA-Protocol/reference-implementation/tree/v1.1.0/src/edge). It runs on Cloudflare Workers, Fastly Compute and AWS Lambda@Edge, each through its own adapter in `src/entries/`: `cloudflare.ts`, `fastly.ts` and `aws-lambda.ts` ([`README.md`](https://github.com/FORA-Protocol/reference-implementation/blob/v1.1.0/src/edge/README.md)). Fastly's WebCrypto has no Ed25519, so `fastly.ts` checks signatures with `@noble/ed25519`. Fastly and Lambda@Edge are tested in Node harnesses, and both get a full Agent → Broker → Exchange → Edge → Origin run in the Docker-based E2E stack, where the Fastly build runs under Viceroy, Fastly's local runtime. The publisher console's automated setup covers Cloudflare and CloudFront, and so do the Terraform modules below. For Fastly, the reference implementation has no console package, no Terraform module and no build script. On Cloudflare and CloudFront, the edge worker reaches a provider's CDN in one of two formats.

### Format 1: Console Package

Expand Down
18 changes: 10 additions & 8 deletions website/src/lib/onboarding/cdn-integrations.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ export const CDN_INTEGRATIONS = {
name: 'Fastly',
scheme: 'Ed25519',
path: 'The FORA Edge package checks the Exchange’s signed URLs before allowing access to your licensed content.',
guidance: 'We’ll provide the package and guide you through connecting it to your Fastly service, choosing which paths to protect, and testing access before going live.',
guidance: 'The console sets up Cloudflare and CloudFront for you. For Fastly, write to us: we’ll provide the package and guide you through connecting it to your Fastly service, choosing which paths to protect, and testing access before going live.',
contact: true,
},
cloudflare: {
name: 'Cloudflare',
Expand All @@ -26,7 +27,8 @@ export function cdnName(provider) {

/**
* The label of the page's links to the publisher contact address: on the CDN
* card when no network was identified, and in the note shown when no discovery
* card when no network was identified or the console does not set the network
* up (Fastly, Akamai), and in the note shown when no discovery
* document could be generated. The page owns the address; this module owns the
* words.
*/
Expand All @@ -46,21 +48,21 @@ export function cdnPresentation(provider) {
title: `Integration path: ${integration.scheme} signed URLs`,
description: integration.path,
guidance: integration.guidance ?? 'We’ll provide a CDN package and setup instructions tailored to your site. Setup includes choosing the content paths to license and checking that ordinary visitors can still browse normally.',
contact: '',
contact: integration.contact ? CONTACT_LABEL : '',
};
if (provider === 'akamai') return {
badge: 'Akamai detected', tone: 'ok',
evidenceIntro: 'We recognized Akamai-specific patterns:',
title: 'Integration path: Signed delivery URLs',
description: 'We’ll configure your Akamai integration to check the Exchange’s signed URLs before allowing access to your licensed content.',
guidance: 'We’ll provide the package and guide you through connecting it to your Akamai service, choosing which paths to protect, and testing access before going live.',
contact: '',
title: 'Akamai isn’t supported today',
description: 'The console sets up Cloudflare and CloudFront for you. FORA’s edge function doesn’t run on Akamai today, so write to us and we’ll help you find the right setup.',
guidance: '',
contact: CONTACT_LABEL,
};
return {
badge: 'We couldn’t identify your CDN', tone: 'none',
evidenceIntro: 'We found these network signals:',
title: 'We’ll help you connect your website',
description: 'CloudFront, Cloudflare, and Fastly are supported today. If you use another CDN — or no CDN — write to us and we’ll help you find the right setup.',
description: 'The console sets up CloudFront and Cloudflare for you, and we help Fastly sites connect. If you use another CDN — or no CDN — write to us and we’ll help you find the right setup.',
guidance: '',
contact: CONTACT_LABEL,
};
Expand Down
6 changes: 3 additions & 3 deletions website/src/lib/onboarding/default-preview.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ const cdnCases = [
['CloudFront', 'cloudfront', 'edge_package', 'x-amz-cf-id', /Lambda@Edge/],
['Cloudflare', 'cloudflare', 'edge_package', 'cf-ray', /worker/i],
['Fastly', 'fastly', 'edge_package', 'x-served-by', /FORA Edge package/],
['Akamai', 'akamai', 'contact_us', 'akamai-grn', /signed.*URLs/i],
['unknown CDN', 'none', 'contact_us', null, /CloudFront, Cloudflare, and Fastly are supported today/],
['Akamai', 'akamai', 'contact_us', 'akamai-grn', /doesn’t run on Akamai today/],
['unknown CDN', 'none', 'contact_us', null, /The console sets up CloudFront and Cloudflare for you, and we help Fastly sites connect/],
// Controlled-origin scenario is test provenance, never a service assertion:
// the same none payload cannot distinguish direct origin from an unknown CDN.
['known direct origin', 'none', 'contact_us', null, /CloudFront, Cloudflare, and Fastly are supported today/],
['known direct origin', 'none', 'contact_us', null, /The console sets up CloudFront and Cloudflare for you, and we help Fastly sites connect/],
];
function cdnResponse([, provider, integration, header], overrides = {}) {
const data = response(overrides);
Expand Down
23 changes: 15 additions & 8 deletions website/src/lib/onboarding/page-fallback.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ test('CloudFront preserves both verification choices without selecting a default
assert.doesNotMatch(result.guidance, /default|recommend.*RSA|use RSA/i);
});

test('Akamai uses the same detected styling and promises setup guidance', () => {
test('Akamai is named as detected, said to be unsupported, and promised no integration', () => {
const result = presentation('akamai');
assert.match(result.badge, /Akamai/);
assert.equal(result.tone, 'ok');
assert.match(result.title, /^Integration path:/);
assert.match(result.guidance, /We’ll provide the package/);
assert.doesNotMatch(`${result.title} ${result.description}`, /not yet supported|no integration package/i);
assert.equal(result.title, 'Akamai isn’t supported today');
assert.match(result.description, /sets up Cloudflare and CloudFront/);
assert.match(result.description, /doesn’t run on Akamai today/);
assert.equal(result.guidance, '');
assert.doesNotMatch(`${result.title} ${result.description}`, /integration path|we’ll (?:provide|configure)|\bpackage\b/i);
assert.notEqual(result.badge, presentation('none').badge);
assert.doesNotMatch(`${result.description} ${result.guidance}`, /\bdownload\b|\bdeploy\b|start registration/i);
assert.doesNotMatch(result.description, /\bdownload\b|\bdeploy\b|start registration/i);
});

test('absent, unexpected, prototype and hostile provider tokens share an honest unknown outcome', () => {
Expand All @@ -63,14 +65,19 @@ test('absent, unexpected, prototype and hostile provider tokens share an honest
}
});

test('only an unidentified CDN offers the contact link, and the mapping carries no address', () => {
for (const provider of ['cloudfront', 'cloudflare', 'fastly', 'akamai']) {
test('Fastly, Akamai and an unidentified CDN offer the contact link, and the mapping carries no address', () => {
for (const provider of ['cloudfront', 'cloudflare']) {
assert.equal(presentation(provider).contact, '', `${provider} needs no contact link`);
}
const fastly = presentation('fastly');
const unknown = presentation('none');
assert.equal(integrations.CONTACT_LABEL, 'Write to us');
assert.equal(fastly.contact, integrations.CONTACT_LABEL, 'The console routes Fastly publishers to us');
assert.match(fastly.guidance, /sets up Cloudflare and CloudFront/);
const akamai = presentation('akamai');
assert.equal(akamai.contact, integrations.CONTACT_LABEL, 'The console routes Akamai publishers to us');
assert.equal(unknown.contact, integrations.CONTACT_LABEL, 'One label for every contact link on the page');
for (const value of Object.values(unknown)) {
for (const value of [...Object.values(fastly), ...Object.values(akamai), ...Object.values(unknown)]) {
assert.doesNotMatch(value, /mailto:|https?:\/\//, 'The page supplies the contact address, never the mapping');
}
});
Expand Down
Loading