Skip to content

Commit 1edd1eb

Browse files
authored
repo sync
2 parents b4082bc + 70ede27 commit 1edd1eb

File tree

8 files changed

+55
-38
lines changed

8 files changed

+55
-38
lines changed

content/actions/guides/publishing-nodejs-packages.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ redirect_from:
88
versions:
99
free-pro-team: '*'
1010
enterprise-server: '>=2.22'
11-
authors:
12-
- GitHub
1311
---
1412

1513
{% data reusables.actions.enterprise-beta %}

content/actions/guides/setting-up-continuous-integration-using-workflow-templates.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ redirect_from:
1111
versions:
1212
free-pro-team: '*'
1313
enterprise-server: '>=2.22'
14-
authors:
15-
- GitHub
1614
---
1715

1816
{% data reusables.actions.enterprise-beta %}

content/actions/reference/workflow-syntax-for-github-actions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,6 @@ The Docker image to use as the container to run the action. The value can be the
958958

959959
### `jobs.<job_id>.container.credentials`
960960

961-
962961
{% data reusables.actions.registry-credentials %}
963962

964963
#### Example

includes/guide-card.html

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
1-
{% assign authorsString = guide.page.authors | join: ", @" %}
1+
{% if guide.page.authors %}
2+
{% assign authors = guide.page.authors %}
3+
{% else %}
4+
{% assign authors = 'GitHub' | split: ' ' %}
5+
{% endif %}
6+
{% assign authorsString = authors | join: ", @" %}
27

38
<div class="col-lg-4 col-12 mb-3">
49
<a class="Box box-shadow-medium height-full d-block hover-shadow-large no-underline text-gray-dark p-5" href="{{ guide.href }}">
510
<h2>{{ guide.title }}</h2>
611
<p class="mt-2 mb-4 text-gray-light">{{ guide.intro }}</p>
712

8-
{% if guide.page.authors and guide.page.authors.length > 0 %}
9-
<footer class="d-flex">
10-
<div class="mr-1">
11-
{% if guide.page.authors.length == 1 %}
12-
<img class="avatar avatar-2 circle mr-1" src="https://github.com/{{ guide.page.authors[0] }}.png" alt="@{{ guide.page.authors[0] }}" />
13-
{% else %}
14-
<div class="AvatarStack AvatarStack--three-plus">
15-
<div
16-
class="AvatarStack-body tooltipped tooltipped-se tooltipped-align-left-1"
17-
aria-label="@{{ authorsString }}"
18-
>
19-
{% for author in guide.page.authors %}
20-
<img
21-
class="avatar circle"
22-
alt="@{{ author }}"
23-
src="https://github.com/{{ author }}.png"
24-
/>
25-
{% endfor %}
26-
</div>
13+
<footer class="d-flex">
14+
<div class="mr-1">
15+
{% if authors.length == 1 %}
16+
<img class="avatar avatar-2 circle mr-1" src="https://github.com/{{ authors[0] }}.png" alt="@{{ authors[0] }}" />
17+
{% else %}
18+
<div class="AvatarStack AvatarStack--three-plus">
19+
<div
20+
class="AvatarStack-body tooltipped tooltipped-se tooltipped-align-left-1"
21+
aria-label="@{{ authorsString }}"
22+
>
23+
{% for author in authors %}
24+
<img
25+
class="avatar circle"
26+
alt="@{{ author }}"
27+
src="https://github.com/{{ author }}.png"
28+
/>
29+
{% endfor %}
2730
</div>
28-
{% endif %}
29-
</div>
31+
</div>
32+
{% endif %}
33+
</div>
3034

31-
<div>
32-
@{{ authorsString }}
33-
</div>
34-
</footer>
35-
{% endif %}
35+
<div>
36+
@{{ authorsString }}
37+
</div>
38+
</footer>
3639
</a>
3740
</div>

javascripts/fake-hogan.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This module overrides "Hogan" that instantsearch.js uses
2+
// Hogan uses `new Function`,
3+
// so we can't use it with our content security policy.
4+
// Turns out, we use all our own templates anyway,
5+
// so we just have to shim out Hogan so it doesn't error!
6+
7+
export default {
8+
compile (template) {
9+
return {
10+
render (data) {
11+
return ''
12+
}
13+
}
14+
}
15+
}

middleware/csp.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ module.exports = contentSecurityPolicy({
3030
],
3131
scriptSrc: [
3232
"'self'",
33-
'data:',
34-
"'unsafe-eval'", // exception for Algolia instantsearch
35-
"'unsafe-inline'"
33+
'data:'
3634
],
3735
frameSrc: [ // exceptions for GraphQL Explorer
3836
'https://graphql-explorer.githubapp.com', // production env

tests/rendering/server.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ describe('server', () => {
5353
expect(csp.get('img-src').includes('octodex.github.com')).toBe(true)
5454

5555
expect(csp.get('script-src').includes("'self'")).toBe(true)
56-
expect(csp.get('script-src').includes("'unsafe-eval'")).toBe(true) // exception for Algolia instantsearch
57-
expect(csp.get('script-src').includes("'unsafe-inline'")).toBe(true)
5856

5957
expect(csp.get('style-src').includes("'self'")).toBe(true)
6058
expect(csp.get('style-src').includes("'unsafe-inline'")).toBe(true)

webpack.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
44
const { EnvironmentPlugin } = require('webpack')
55

66
module.exports = {
7+
devtool: 'source-map', // this prevents webpack from using eval
78
entry: './javascripts/index.js',
89
output: {
910
filename: 'index.js',
@@ -70,5 +71,12 @@ module.exports = {
7071
]
7172
}),
7273
new EnvironmentPlugin(['NODE_ENV'])
73-
]
74+
],
75+
resolve: {
76+
alias: {
77+
// Hogan uses `new Function` which breaks content security policy
78+
// Turns out, we aren't even using it anyways!
79+
'hogan.js': path.resolve(__dirname, 'javascripts/fake-hogan.js')
80+
}
81+
}
7482
}

0 commit comments

Comments
 (0)