Skip to content

Commit 68a439b

Browse files
authored
Merge pull request from GHSA-2fvv-qxrq-7jq6
See GHSA-2fvv-qxrq-7jq6 for details. Note that this doesn't affect the curl command shown in the colorful rendered non-embedded landing page, which is properly escaped by the React app.
1 parent 27ded2a commit 68a439b

File tree

4 files changed

+48
-9
lines changed

4 files changed

+48
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ The version headers in this history reflect the versions of Apollo Server itself
1010

1111
## vNEXT
1212

13+
## v3.10.1
14+
15+
- ⚠️ **SECURITY**: The default landing page contained HTML to display a sample `curl` command which is made visible if the full landing page bundle could not be fetched from Apollo's CDN. The server's URL is directly interpolated into this command inside the browser from `window.location.href`. On some older browsers such as IE11, this value is not URI-encoded. On such browsers, opening a malicious URL pointing at an Apollo Router could cause execution of attacker-controlled JavaScript. In this release, the fallback page does not display a `curl` command. More details are available at the [security advisory](https://github.com/apollographql/apollo-server/security/advisories/GHSA-2fvv-qxrq-7jq6).
16+
- Improve error message when both a graph ref and a graph variant are specified. [PR #6709](https://github.com/apollographql/apollo-server/pull/6709)
1317
- Fix the TypeScript declaration of the `fieldLevelInstrumentation` option to `ApolloServerPluginUsageReporting` to show that the function may return a number in addition to a boolean. This now matches the implementation and docs. [PR #6763](https://github.com/apollographql/apollo-server/pull/6763)
1418

1519
## v3.10.0

packages/apollo-server-core/src/plugin/landingPage/__tests__/getEmbeddedExplorerHTML.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ describe('Embedded Explorer Landing Page Config HTML', () => {
2929
graphRef: 'graph@current',
3030
};
3131
expect(getEmbeddedExplorerHTML(version, config)).toMatchInlineSnapshot(`
32+
<div class="fallback">
33+
<h1>
34+
Welcome to Apollo Server
35+
</h1>
36+
<p>
37+
Apollo Explorer cannot be loaded; it appears that you might be offline.
38+
</p>
39+
</div>
3240
<style>
3341
iframe {
3442
background-color: white;
@@ -59,6 +67,14 @@ describe('Embedded Explorer Landing Page Config HTML', () => {
5967
graphRef: 'graph@current',
6068
};
6169
expect(getEmbeddedExplorerHTML(version, config)).toMatchInlineSnapshot(`
70+
<div class="fallback">
71+
<h1>
72+
Welcome to Apollo Server
73+
</h1>
74+
<p>
75+
Apollo Explorer cannot be loaded; it appears that you might be offline.
76+
</p>
77+
</div>
6278
<style>
6379
iframe {
6480
background-color: white;

packages/apollo-server-core/src/plugin/landingPage/__tests__/getEmbeddedSandboxHTML.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ describe('Landing Page Config HTML', () => {
2020
embed: true,
2121
};
2222
expect(getEmbeddedSandboxHTML(version, config)).toMatchInlineSnapshot(`
23+
<div class="fallback">
24+
<h1>
25+
Welcome to Apollo Server
26+
</h1>
27+
<p>
28+
Apollo Sandbox cannot be loaded; it appears that you might be offline.
29+
</p>
30+
</div>
2331
<style>
2432
iframe {
2533
background-color: white;
@@ -49,6 +57,14 @@ describe('Landing Page Config HTML', () => {
4957
embed: true,
5058
};
5159
expect(getEmbeddedSandboxHTML(version, config)).toMatchInlineSnapshot(`
60+
<div class="fallback">
61+
<h1>
62+
Welcome to Apollo Server
63+
</h1>
64+
<p>
65+
Apollo Sandbox cannot be loaded; it appears that you might be offline.
66+
</p>
67+
</div>
5268
<style>
5369
iframe {
5470
background-color: white;

packages/apollo-server-core/src/plugin/landingPage/default/index.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ export const getEmbeddedExplorerHTML = (
101101
};
102102

103103
return `
104+
<div class="fallback">
105+
<h1>Welcome to Apollo Server</h1>
106+
<p>Apollo Explorer cannot be loaded; it appears that you might be offline.</p>
107+
</div>
104108
<style>
105109
iframe {
106110
background-color: white;
@@ -129,6 +133,10 @@ export const getEmbeddedSandboxHTML = (
129133
config: LandingPageConfig,
130134
) => {
131135
return `
136+
<div class="fallback">
137+
<h1>Welcome to Apollo Server</h1>
138+
<p>Apollo Sandbox cannot be loaded; it appears that you might be offline.</p>
139+
</div>
132140
<style>
133141
iframe {
134142
background-color: white;
@@ -162,6 +170,10 @@ const getNonEmbeddedLandingPageHTML = (
162170
const encodedConfig = encodeConfig(config);
163171

164172
return `
173+
<div class="fallback">
174+
<h1>Welcome to Apollo Server</h1>
175+
<p>The full landing page cannot be loaded; it appears that you might be offline.</p>
176+
</div>
165177
<script>window.landingPage = ${encodedConfig};</script>
166178
<script src="https://apollo-server-landing-page.cdn.apollographql.com/${version}/static/js/main.js"></script>`;
167179
};
@@ -224,15 +236,6 @@ function ApolloServerPluginLandingPageDefault(
224236
100% {opacity:1; }
225237
}
226238
</style>
227-
<div class="fallback">
228-
<h1>Welcome to Apollo Server</h1>
229-
<p>It appears that you might be offline. POST to this endpoint to query your graph:</p>
230-
<code style="white-space: pre;">
231-
curl --request POST \\
232-
--header 'content-type: application/json' \\
233-
--url '<script>document.write(window.location.href)</script>' \\
234-
--data '{"query":"query { __typename }"}'</code>
235-
</div>
236239
${
237240
config.embed
238241
? 'graphRef' in config && config.graphRef

0 commit comments

Comments
 (0)