Skip to content

Commit a22b3cf

Browse files
authored
Merge branch 'main' into patch-1
2 parents e15d965 + b3924aa commit a22b3cf

File tree

10 files changed

+84
-71
lines changed

10 files changed

+84
-71
lines changed

content/github/site-policy/dmca-takedown-policy.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ One of the best features of GitHub is the ability for users to "fork" one anothe
6363

6464
GitHub *will not* automatically disable forks when disabling a parent repository. This is because forks belong to different users, may have been altered in significant ways, and may be licensed or used in a different way that is protected by the fair-use doctrine. GitHub does not conduct any independent investigation into forks. We expect copyright owners to conduct that investigation and, if they believe that the forks are also infringing, expressly include forks in their takedown notice.
6565

66+
In rare cases, you may be alleging copyright infringement in a full repository that is actively being forked. If at the time that you submitted your notice, you identified all existing forks of that repository as allegedly infringing, we would process a valid claim against all forks in that network at the time we process the notice. We would do this given the likelihood that all newly created forks would contain the same content. In addition, if the reported network that contains the allegedly infringing content is larger than one hundred (100) repositories and thus would be difficult to review in its entirety, we may consider disabling the entire network if you state in your notice that, "Based on the representative number of forks you have reviewed, I believe that all or most of the forks are infringing to the same extent as the parent repository." Your sworn statement would apply to this statement.
67+
6668
### C. What If I Inadvertently Missed the Window to Make Changes?
6769

6870
We recognize that there are many valid reasons that you may not be able to make changes within the window of approximately 1 business day we provide before your repository gets disabled. Maybe our message got flagged as spam, maybe you were on vacation, maybe you don't check that email account regularly, or maybe you were just busy. We get it. If you respond to let us know that you would have liked to make the changes, but somehow missed the first opportunity, we will re-enable the repository one additional time for approximately 1 business day to allow you to make the changes. Again, you must notify us that you have made the changes in order to keep the repository enabled after that window of approximately 1 business day, as noted above in [Step A.4](#a-how-does-this-actually-work). Please note that we will only provide this one additional chance.

content/github/site-policy/guide-to-submitting-a-dmca-takedown-notice.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ GitHub exercises little discretion in the process other than determining whether
5353

5454
2. **Identify the copyrighted work you believe has been infringed.** This information is important because it helps the affected user evaluate your claim and give them the ability to compare your work to theirs. The specificity of your identification will depend on the nature of the work you believe has been infringed. If you have published your work, you might be able to just link back to a web page where it lives. If it is proprietary and not published, you might describe it and explain that it is proprietary. If you have registered it with the Copyright Office, you should include the registration number. If you are alleging that the hosted content is a direct, literal copy of your work, you can also just explain that fact.
5555

56-
3. **Identify the material that you allege is infringing the copyrighted work listed in item #2, above.** It is important to be as specific as possible in your identification. This identification needs to be reasonably sufficient to permit GitHub to locate the material. At a minimum, this means that you should include the URL to the material allegedly infringing your copyright. If you allege that less than a whole repository infringes, identify the specific file(s) or line numbers within a file that you allege infringe. If you allege that all of the content at a URL infringes, please be explicit about that as well. Finally, please note that GitHub will *not* automatically disable [forks](/articles/dmca-takedown-policy#b-what-about-forks-or-whats-a-fork) when disabling a parent repository. If you have investigated and analyzed the forks of a repository and believe that they are also infringing, please explicitly identify each allegedly infringing fork. Please also confirm that you have investigated each individual case and that your sworn statements apply to each identified fork.
56+
3. **Identify the material that you allege is infringing the copyrighted work listed in item #2, above.** It is important to be as specific as possible in your identification. This identification needs to be reasonably sufficient to permit GitHub to locate the material. At a minimum, this means that you should include the URL to the material allegedly infringing your copyright. If you allege that less than a whole repository infringes, identify the specific file(s) or line numbers within a file that you allege infringe. If you allege that all of the content at a URL infringes, please be explicit about that as well.
57+
- Please note that GitHub will *not* automatically disable [forks](/articles/dmca-takedown-policy#b-what-about-forks-or-whats-a-fork) when disabling a parent repository. If you have investigated and analyzed the forks of a repository and believe that they are also infringing, please explicitly identify each allegedly infringing fork. Please also confirm that you have investigated each individual case and that your sworn statements apply to each identified fork. In rare cases, you may be alleging copyright infringement in a full repository that is actively being forked. If at the time that you submitted your notice, you identified all existing forks of that repository as allegedly infringing, we would process a valid claim against all forks in that network at the time we process the notice. We would do this given the likelihood that all newly created forks would contain the same content. In addition, if the reported network that contains the allegedly infringing content is larger than one hundred (100) repositories and thus would be difficult to review in its entirety, we may consider disabling the entire network if you state in your notice that, "Based on the representative number of forks you have reviewed, I believe that all or most of the forks are infringing to the same extent as the parent repository." Your sworn statement would apply to this statement.
5758

5859
4. **Explain what the affected user would need to do in order to remedy the infringement.** Again, specificity is important. When we pass your complaint along to the user, this will tell them what they need to do in order to avoid having the rest of their content disabled. Does the user just need to add a statement of attribution? Do they need to delete certain lines within their code, or entire files? Of course, we understand that in some cases, all of a user's content may be alleged to infringe and there's nothing they could do short of deleting it all. If that's the case, please make that clear as well.
5960

lib/enterprise-server-releases.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ const nextDeprecationDate = dates[oldestSupported].deprecationDate
4747
const isOldestReleaseDeprecated = new Date() > new Date(nextDeprecationDate)
4848
const deprecatedOnNewSite = deprecated.filter(version => versionSatisfiesRange(version, '>=2.13'))
4949
const firstVersionDeprecatedOnNewSite = '2.13'
50-
// starting from 2.18, we updated the archival script to create stubbed HTML redirect files
51-
const lastVersionWithoutStubbedRedirectFiles = '2.17'
50+
// starting from 2.18, we updated the archival script to create a redirects.json top-level file in the archived repo
51+
const lastVersionWithoutArchivedRedirectsFile = '2.17'
5252
// last version using paths like /enterprise/<release>/<user>/<product>/<category>/<article>
5353
// instead of /enterprise-server@<release>/<product>/<category>/<article>
5454
const lastReleaseWithLegacyFormat = '2.18'
@@ -68,7 +68,7 @@ module.exports = {
6868
deprecatedOnNewSite,
6969
dates,
7070
firstVersionDeprecatedOnNewSite,
71-
lastVersionWithoutStubbedRedirectFiles,
71+
lastVersionWithoutArchivedRedirectsFile,
7272
lastReleaseWithLegacyFormat,
7373
deprecatedReleasesWithLegacyFormat,
7474
deprecatedReleasesWithNewFormat,

lib/redis-accessor.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,14 @@ class RedisAccessor {
2626
? new Redis(REDIS_URL, {
2727
...redisBaseOptions,
2828
db: databaseNumber,
29-
tls: {
30-
// Required for production Heroku Redis
31-
rejectUnauthorized: false
29+
30+
// Only add this configuration for TLS-enabled REDIS_URL values.
31+
// Otherwise, it breaks for local Redis instances without TLS enabled.
32+
...REDIS_URL.startsWith('rediss://') && {
33+
tls: {
34+
// Required for production Heroku Redis
35+
rejectUnauthorized: false
36+
}
3237
}
3338
})
3439
: new InMemoryRedis()

lib/webhooks/static/dotcom/code_scanning_alert.reopened.payload.json

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -141,31 +141,20 @@
141141
"login": "github",
142142
"id": 9919,
143143
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
144-
"url": "https://api.github.com/orgs/github",
145-
"repos_url": "https://api.github.com/orgs/github/repos",
146-
"events_url": "https://api.github.com/orgs/github/events",
147-
"hooks_url": "https://api.github.com/orgs/github/hooks",
148-
"issues_url": "https://api.github.com/orgs/github/issues",
149-
"members_url": "https://api.github.com/orgs/github/members{/member}",
150-
"public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
151144
"avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
152-
"description": "How people build software.",
153-
"name": "GitHub",
154-
"company": null,
155-
"blog": "https://github.com/about",
156-
"location": "San Francisco, CA",
157-
"email": null,
158-
"twitter_username": null,
159-
"is_verified": true,
160-
"has_organization_projects": true,
161-
"has_repository_projects": true,
162-
"public_repos": 371,
163-
"public_gists": 0,
164-
"followers": 0,
165-
"following": 0,
145+
"gravatar_id": "",
146+
"url": "https://api.github.com/users/github",
166147
"html_url": "https://github.com/github",
167-
"created_at": "2008-05-11T04:37:31Z",
168-
"updated_at": "2020-09-28T06:15:10Z",
169-
"type": "Organization"
148+
"followers_url": "https://api.github.com/users/github/followers",
149+
"following_url": "https://api.github.com/users/github/following{/other_user}",
150+
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
151+
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
152+
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
153+
"organizations_url": "https://api.github.com/users/github/orgs",
154+
"repos_url": "https://api.github.com/users/github/repos",
155+
"events_url": "https://api.github.com/users/github/events{/privacy}",
156+
"received_events_url": "https://api.github.com/users/github/received_events",
157+
"type": "Organization",
158+
"site_admin": false
170159
}
171160
}

middleware/archived-enterprise-versions.js

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require('path')
22
const slash = require('slash')
3-
const { firstVersionDeprecatedOnNewSite, lastVersionWithoutStubbedRedirectFiles } = require('../lib/enterprise-server-releases')
3+
const { firstVersionDeprecatedOnNewSite, lastVersionWithoutArchivedRedirectsFile } = require('../lib/enterprise-server-releases')
44
const patterns = require('../lib/patterns')
55
const versionSatisfiesRange = require('../lib/version-satisfies-range')
66
const isArchivedVersion = require('../lib/is-archived-version')
@@ -25,21 +25,43 @@ module.exports = async (req, res, next) => {
2525
}
2626

2727
// find redirects for versions between 2.13 and 2.17
28-
// starting with 2.18, we updated the archival script to create stubbed HTML redirect files
28+
// starting with 2.18, we updated the archival script to create a redirects.json file
2929
if (versionSatisfiesRange(requestedVersion, `>=${firstVersionDeprecatedOnNewSite}`) &&
30-
versionSatisfiesRange(requestedVersion, `<=${lastVersionWithoutStubbedRedirectFiles}`)) {
30+
versionSatisfiesRange(requestedVersion, `<=${lastVersionWithoutArchivedRedirectsFile}`)) {
3131
const redirect = archvivedRedirects[req.path]
3232
if (redirect && redirect !== req.path) {
3333
return res.redirect(301, redirect)
3434
}
3535
}
3636

37+
let reqPath = req.path
38+
let isRedirect = false
39+
if (versionSatisfiesRange(requestedVersion, `>${lastVersionWithoutArchivedRedirectsFile}`)) {
40+
try {
41+
const res = await got(getProxyPath('redirects.json', requestedVersion))
42+
const redirectJson = JSON.parse(res.body)
43+
44+
if (redirectJson[req.path]) {
45+
isRedirect = true
46+
}
47+
reqPath = redirectJson[req.path] || req.path
48+
} catch (err) {
49+
// nooop
50+
}
51+
}
52+
3753
try {
38-
const r = await got(getProxyPath(req.path, requestedVersion))
54+
const r = await got(getProxyPath(reqPath, requestedVersion))
3955
res.set('content-type', r.headers['content-type'])
4056
res.set('x-robots-tag', 'noindex')
4157

42-
// make the stubbed redirect files added in >=2.18 return 301 instead of 200
58+
// make redirects found via redirects.json return 301 instead of 200
59+
if (isRedirect) {
60+
res.status(301)
61+
res.set('location', reqPath)
62+
}
63+
64+
// make stubbed redirect files (which exist in versions <2.13) return 301 instead of 200
4365
const staticRedirect = r.body.match(patterns.staticRedirect)
4466
if (staticRedirect) {
4567
res.status(301)
@@ -73,7 +95,7 @@ function getProxyPath (reqPath, requestedVersion) {
7395
// this workaround finds potentially relevant frontmatter redirects in currently supported pages
7496
function getFallbackRedirects (req, requestedVersion) {
7597
if (versionSatisfiesRange(requestedVersion, `<${firstVersionDeprecatedOnNewSite}`)) return
76-
if (versionSatisfiesRange(requestedVersion, `>${lastVersionWithoutStubbedRedirectFiles}`)) return
98+
if (versionSatisfiesRange(requestedVersion, `>${lastVersionWithoutArchivedRedirectsFile}`)) return
7799

78100
return archivedFrontmatterFallbacks.find(arrayOfFallbacks => arrayOfFallbacks.includes(req.path))
79101
}

middleware/rate-limit.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ module.exports = rateLimit({
1919
store: REDIS_URL && new RedisStore({
2020
client: new Redis(REDIS_URL, {
2121
db: rateLimitDatabaseNumber,
22-
tls: {
23-
// Required for production Heroku Redis
24-
rejectUnauthorized: false
22+
23+
// Only add this configuration for TLS-enabled REDIS_URL values.
24+
// Otherwise, it breaks for local Redis instances without TLS enabled.
25+
...REDIS_URL.startsWith('rediss://') && {
26+
tls: {
27+
// Required for production Heroku Redis
28+
rejectUnauthorized: false
29+
}
2530
}
2631
}),
2732
// 1 minute (or practically unlimited outside of production)

script/enterprise-server-deprecations/archive-version.js

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const host = `http://localhost:${port}`
99
const scrape = require('website-scraper')
1010
const program = require('commander')
1111
const rimraf = require('rimraf').sync
12-
const mkdirp = require('mkdirp').sync
1312
const version = require('../../lib/enterprise-server-releases').oldestSupported
1413
const archivalRepoName = 'help-docs-archived-enterprise-versions'
1514
const archivalRepoUrl = `https://github.com/github/${archivalRepoName}`
@@ -173,18 +172,20 @@ async function main () {
173172
console.log(`\n\ndone scraping! added files to ${path.relative(process.cwd(), finalDirectory)}\n`)
174173

175174
// create redirect html files to preserve frontmatter redirects
176-
await createRedirectPages(permalinksPerVersion, pageMap, finalDirectory)
175+
await createRedirectsFile(permalinksPerVersion, pageMap, finalDirectory)
177176

178177
console.log(`next step: deprecate ${version} in lib/enterprise-server-releases.js`)
179178

180179
process.exit()
181180
})
182181
}
183182

184-
async function createRedirectPages (permalinks, pageMap, finalDirectory) {
183+
async function createRedirectsFile (permalinks, pageMap, finalDirectory) {
185184
const pagesPerVersion = permalinks.map(permalink => pageMap[permalink])
186185
const redirects = await loadRedirects(pagesPerVersion, pageMap)
187186

187+
const redirectsPerVersion = {}
188+
188189
Object.entries(redirects).forEach(([oldPath, newPath]) => {
189190
// remove any liquid variables that sneak in
190191
oldPath = oldPath
@@ -193,31 +194,8 @@ async function createRedirectPages (permalinks, pageMap, finalDirectory) {
193194
// ignore any old paths that are not in this version
194195
if (!(oldPath.includes(`/enterprise-server@${version}`) || oldPath.includes(`/enterprise/${version}`))) return
195196

196-
const fullPath = path.join(finalDirectory, oldPath)
197-
const filename = `${fullPath}/index.html`
198-
const html = getRedirectHtml(newPath)
199-
200-
mkdirp(fullPath)
201-
fs.writeFileSync(filename, html)
197+
redirectsPerVersion[oldPath] = newPath
202198
})
203199

204-
console.log('done creating redirect files!\n')
205-
}
206-
207-
// redirect html files already exist in <=2.12 because these versions were deprecated on the old static site
208-
function getRedirectHtml (newPath) {
209-
return `<!DOCTYPE html>
210-
<html>
211-
<head>
212-
<meta charset="utf-8">
213-
<title>Redirecting...</title>
214-
<link rel="canonical" href="${newPath}">
215-
<meta http-equiv="refresh" content="0; url=${newPath}">
216-
</head>
217-
<body>
218-
<h1>Redirecting...</h1>
219-
<a href="${newPath}">Click here if you are not redirected.</a>
220-
<script>location='${newPath}'</script>
221-
</body>
222-
</html>`
200+
fs.writeFileSync(path.posix.join(finalDirectory, 'redirects.json'), JSON.stringify(redirectsPerVersion, null, 2))
223201
}

script/purge-redis-pages.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,14 @@ purgeRenderedPageCache()
4444
function purgeRenderedPageCache () {
4545
const redisClient = new Redis(REDIS_URL, {
4646
db: pageCacheDatabaseNumber,
47-
tls: {
48-
// Required for production Heroku Redis
49-
rejectUnauthorized: false
47+
48+
// Only add this configuration for TLS-enabled REDIS_URL values.
49+
// Otherwise, it breaks for local Redis instances without TLS enabled.
50+
...REDIS_URL.startsWith('rediss://') && {
51+
tls: {
52+
// Required for production Heroku Redis
53+
rejectUnauthorized: false
54+
}
5055
}
5156
})
5257
let totalKeyCount = 0

tests/routing/deprecated-enterprise-versions.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ describe('enterprise deprecation', () => {
3030
expect(res.headers.location).toBe('/en/enterprise/2.15/user/articles/viewing-contributions-on-your-profile')
3131
})
3232

33+
test('can access redirects from redirects.json in deprecated enterprise content >2.17', async () => {
34+
const res = await get('/enterprise/2.19/admin/categories/time')
35+
expect(res.statusCode).toBe(301)
36+
expect(res.headers.location).toBe('/en/enterprise-server@2.19/admin/configuration/configuring-time-synchronization')
37+
})
38+
3339
test('handles requests for deprecated Enterprise pages ( >=2.13 )', async () => {
3440
expect(enterpriseServerReleases.deprecated.includes('2.13')).toBe(true)
3541
const $ = await getDOM('/en/enterprise/2.13/user/articles/about-branches')

0 commit comments

Comments
 (0)