Skip to content

Commit 23b0b84

Browse files
authored
Add Code security landing and guides pages (github#19650)
1 parent 8082a6e commit 23b0b84

File tree

29 files changed

+467
-24
lines changed

29 files changed

+467
-24
lines changed

components/context/ProductLandingContext.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export type ProductLandingContextT = {
4848
viewAllHref?: string // If provided, adds a "View All ->" to the header
4949
articles: Array<FeaturedLink>
5050
}>
51-
changelog: { label: string; prefix: string }
5251
changelogUrl?: string
5352
whatsNewChangelog?: Array<{ href: string; title: string; date: string }>
5453
tocItems: Array<TocItem>
@@ -85,7 +84,6 @@ export const getProductLandingContextFromRequest = (req: any): ProductLandingCon
8584
'beta_product',
8685
'intro',
8786
'product_video',
88-
'changelog',
8987
]),
9088
product: {
9189
href: productTree.href,

components/landing/CodeExampleCard.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { RepoIcon } from '@primer/octicons-react'
22
import { CodeExample } from 'components/context/ProductLandingContext'
3+
import { TruncateLines } from 'components/TruncateLines'
34

45
type Props = {
56
example: CodeExample
@@ -28,7 +29,9 @@ export const CodeExampleCard = ({ example }: Props) => {
2829
</div>
2930
<footer className="border-top p-4 color-text-secondary d-flex flex-items-center">
3031
<RepoIcon className="flex-shrink-0" />
31-
<span className="ml-2 text-mono text-small color-text-link">{example.href}</span>
32+
<TruncateLines as="span" maxLines={1} className="ml-2 text-mono text-small color-text-link line-break-anywhere">
33+
{example.href}
34+
</TruncateLines>
3235
</footer>
3336
</a>
3437
)

components/landing/FeaturedArticles.tsx

+5-9
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ import { useTranslation } from 'components/hooks/useTranslation'
88
import { TruncateLines } from 'components/TruncateLines'
99

1010
export const FeaturedArticles = () => {
11-
const {
12-
featuredArticles = [],
13-
changelog,
14-
whatsNewChangelog,
15-
changelogUrl,
16-
} = useProductLandingContext()
11+
const { featuredArticles = [], whatsNewChangelog, changelogUrl } = useProductLandingContext()
12+
const hasWhatsNewChangelog = whatsNewChangelog && whatsNewChangelog.length > 0
1713
const { t } = useTranslation('toc')
1814

1915
return (
@@ -22,7 +18,7 @@ export const FeaturedArticles = () => {
2218
return (
2319
<div
2420
key={section.label + i}
25-
className={cx('col-12 mb-4 mb-lg-0', changelog ? 'col-lg-4' : 'col-lg-6')}
21+
className={cx('col-12 mb-4 mb-lg-0', hasWhatsNewChangelog ? 'col-lg-4' : 'col-lg-6')}
2622
>
2723
<ArticleList
2824
title={section.label}
@@ -33,8 +29,8 @@ export const FeaturedArticles = () => {
3329
)
3430
})}
3531

36-
{changelog && (
37-
<div className={cx('col-12 mb-4 mb-lg-0', changelog ? 'col-lg-4' : 'col-lg-6')}>
32+
{hasWhatsNewChangelog && (
33+
<div className={cx('col-12 mb-4 mb-lg-0 col-lg-4')}>
3834
<ArticleList
3935
title={t('whats_new')}
4036
viewAllHref={changelogUrl}

components/landing/ProductLanding.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const ProductLanding = () => {
6868
</div>
6969
)}
7070

71-
<LandingSection sectionLink="all-docs" title={`All ${shortTitle} Docs`}>
71+
<LandingSection sectionLink="all-docs" title={`All ${shortTitle} docs`}>
7272
<ProductArticlesList />
7373
</LandingSection>
7474
</DefaultLayout>

content/actions/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ featuredLinks:
2424
changelog:
2525
label: actions
2626
prefix: 'GitHub Actions: '
27+
examples_source: data/product-examples/actions/code-examples.yml
2728
product_video: 'https://www.youtube-nocookie.com/embed/cP0I9w2coGU'
2829
redirect_from:
2930
- /articles/automating-your-workflow-with-github-actions/
@@ -47,4 +48,3 @@ children:
4748
- /hosting-your-own-runners
4849
- /reference
4950
---
50-

content/code-security/guides.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
title: Guides for code security
3+
intro: 'Learn about the different ways that {% data variables.product.product_name %} can help you improve your code''s security.'
4+
allowTitleToDifferFromFilename: true
5+
layout: product-sublanding
6+
versions:
7+
free-pro-team: '*'
8+
enterprise-server: '>=3.0'
9+
github-ae: '*'
10+
11+
learningTracks:
12+
- security_advisories
13+
- dependabot_alerts
14+
- dependabot_security_updates
15+
- dependency_version_updates
16+
- security_alerts
17+
- secret_scanning
18+
- code_security_actions
19+
- code_security_ci
20+
- code_security_integration
21+
22+
includeGuides:
23+
- /code-security/getting-started/adding-a-security-policy-to-your-repository
24+
- /code-security/getting-started/github-security-features
25+
- /code-security/getting-started/securing-your-organization
26+
- /code-security/getting-started/securing-your-repository
27+
- /code-security/secret-security/about-secret-scanning
28+
- /code-security/secret-security/configuring-secret-scanning-for-your-repositories
29+
- /code-security/secret-security/managing-alerts-from-secret-scanning
30+
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning
31+
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning
32+
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages
33+
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository
34+
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/running-codeql-code-scanning-in-a-container
35+
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/setting-up-code-scanning-for-a-repository
36+
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/triaging-code-scanning-alerts-in-pull-requests
37+
- /code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/troubleshooting-the-codeql-workflow
38+
- /code-security/secure-coding/integrating-with-code-scanning/about-integration-with-code-scanning
39+
- /code-security/secure-coding/integrating-with-code-scanning/sarif-support-for-code-scanning
40+
- /code-security/secure-coding/integrating-with-code-scanning/uploading-a-sarif-file-to-github
41+
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/about-codeql-code-scanning-in-your-ci-system
42+
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-runner-in-your-ci-system
43+
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/running-codeql-cli-in-your-ci-system
44+
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/running-codeql-runner-in-your-ci-system
45+
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/troubleshooting-codeql-runner-in-your-ci-system
46+
- /code-security/security-advisories/about-coordinated-disclosure-of-security-vulnerabilities
47+
- /code-security/security-advisories/about-github-security-advisories
48+
- /code-security/security-advisories/adding-a-collaborator-to-a-security-advisory
49+
- /code-security/security-advisories/collaborating-in-a-temporary-private-fork-to-resolve-a-security-vulnerability
50+
- /code-security/security-advisories/creating-a-security-advisory
51+
- /code-security/security-advisories/editing-a-security-advisory
52+
- /code-security/security-advisories/permission-levels-for-security-advisories
53+
- /code-security/security-advisories/publishing-a-security-advisory
54+
- /code-security/security-advisories/removing-a-collaborator-from-a-security-advisory
55+
- /code-security/security-advisories/withdrawing-a-security-advisory
56+
- /code-security/security-overview/exploring-security-alerts
57+
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/about-dependabot-version-updates
58+
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
59+
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/customizing-dependency-updates
60+
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/enabling-and-disabling-version-updates
61+
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot
62+
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/listing-dependencies-configured-for-version-updates
63+
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/managing-encrypted-secrets-for-dependabot
64+
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/managing-pull-requests-for-dependency-updates
65+
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/upgrading-from-dependabotcom-to-github-native-dependabot
66+
- /code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-alerts-for-vulnerable-dependencies
67+
- /code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-dependabot-security-updates
68+
- /code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-managing-vulnerable-dependencies
69+
- /code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/browsing-security-vulnerabilities-in-the-github-advisory-database
70+
- /code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/configuring-dependabot-security-updates
71+
- /code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/configuring-notifications-for-vulnerable-dependencies
72+
- /code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/troubleshooting-dependabot-errors
73+
- /code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/troubleshooting-the-detection-of-vulnerable-dependencies
74+
- /code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/viewing-and-updating-vulnerable-dependencies-in-your-repository
75+
- /code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review
76+
- /code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph
77+
- /code-security/supply-chain-security/understanding-your-software-supply-chain/exploring-the-dependencies-of-a-repository
78+
---

content/code-security/index.md

+48-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,52 @@
11
---
22
title: Code security
33
shortTitle: Code security
4-
intro: Learn how to keep the code stored in your repositories secure.
4+
intro: 'Build security into your {% data variables.product.prodname_dotcom %} workflow with features to keep secrets and vulnerabilities out of your codebase{% if currentVersion != "github-ae@latest" %}, and to maintain your software supply chain{% endif %}.'
5+
6+
introLinks:
7+
overview: /code-security/getting-started/github-security-features
8+
9+
featuredLinks:
10+
guides:
11+
- /code-security/getting-started/securing-your-repository
12+
- /code-security/getting-started/securing-your-organization
13+
- '{% if currentVersion == "free-pro-team@latest" %}/code-security/security-advisories/creating-a-security-advisory{% endif %}'
14+
- '{% if enterpriseServerVersions contains currentVersion or currentVersion == "github-ae@latest" %}/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/setting-up-code-scanning-for-a-repository{% endif%}'
15+
16+
guideCards:
17+
- '{% if currentVersion == "free-pro-team@latest" %}/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/configuring-dependabot-security-updates{% endif %}'
18+
- '{% if currentVersion == "free-pro-team@latest" %}/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/enabling-and-disabling-version-updates{% endif %}'
19+
- '{% if currentVersion == "free-pro-team@latest" %}/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/setting-up-code-scanning-for-a-repository{% endif %}'
20+
21+
- '{% if enterpriseServerVersions contains currentVersion %}/code-security/supply-chain-security/understanding-your-software-supply-chain/exploring-the-dependencies-of-a-repository{% endif %}'
22+
- '{% if enterpriseServerVersions contains currentVersion %}/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/configuring-notifications-for-vulnerable-dependencies{% endif %}'
23+
24+
- '{% if enterpriseServerVersions contains currentVersion or currentVersion == "github-ae@latest" %}/code-security/secret-security/configuring-secret-scanning-for-your-repositories{% endif %}'
25+
- '{% if currentVersion == "github-ae@latest" %}/code-security/secure-coding/integrating-with-code-scanning/uploading-a-sarif-file-to-github{% endif %}'
26+
- '{% if currentVersion == "github-ae@latest" %}/code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system{% endif %}'
27+
28+
popular:
29+
- '{% if enterpriseServerVersions contains currentVersion %}/admin/release-notes{% endif %}'
30+
- /code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-alerts-for-vulnerable-dependencies
31+
- /code-security/security-advisories/about-coordinated-disclosure-of-security-vulnerabilities
32+
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot
33+
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
34+
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/managing-encrypted-secrets-for-dependabot
35+
- '{% if currentVersion == "github-ae@latest" %}/code-security/secret-security/about-secret-scanning{% endif %}'
36+
- /code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/troubleshooting-the-detection-of-vulnerable-dependencies
37+
- '{% if enterpriseServerVersions contains currentVersion or currentVersion == "github-ae@latest" %}/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-the-codeql-workflow-for-compiled-languages{% endif %}'
38+
- '{% if enterpriseServerVersions contains currentVersion or currentVersion == "github-ae@latest" %}/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/troubleshooting-the-codeql-workflow{% endif %}'
39+
- '{% if enterpriseServerVersions contains currentVersion or currentVersion == "github-ae@latest" %}/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/running-codeql-code-scanning-in-a-container{% endif %}'
40+
41+
changelog:
42+
label: 'security-and-compliance'
43+
versions:
44+
free-pro-team: '*'
45+
46+
examples_source: data/product-examples/code-security/code-examples.yml
47+
48+
layout: product-landing
49+
550
versions:
651
free-pro-team: '*'
752
enterprise-server: '>=3.0'
@@ -17,5 +62,6 @@ children:
1762
- /security-advisories
1863
- /supply-chain-security
1964
- /security-overview
20-
---
65+
- /guides
2166

67+
---

content/code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Using CodeQL code scanning with your existing CI system
33
shortTitle: CodeQL CI system support
4-
intro: 'The {% data variables.product.prodname_codeql_runner %} allows you to use your existing CI system to run {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %}.'
4+
intro: 'You can run {% data variables.product.prodname_codeql %} analysis in your existing CI system and upload the results to {% data variables.product.product_name %} for display as {% data variables.product.prodname_code_scanning %} alerts.'
55
product: '{% data reusables.gated-features.code-scanning %}'
66
redirect_from:
77
- /github/finding-security-vulnerabilities-and-errors-in-your-code/using-codeql-code-scanning-with-your-existing-ci-system

content/codespaces/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ redirect_from:
2828
- /github/developing-online-with-github-codespaces
2929
- /github/developing-online-with-codespaces
3030
layout: product-landing
31+
examples_source: data/product-examples/codespaces/code-examples.yml
3132
versions:
3233
free-pro-team: '*'
3334
children:

content/discussions/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ featuredLinks:
2424
- /discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository
2525
changelog:
2626
label: discussions
27+
examples_source: data/product-examples/discussions/community-examples.yml
2728
product_video: 'https://www.youtube-nocookie.com/embed/IpBw2SJkFyk'
2829
layout: product-landing
2930
versions:
@@ -34,4 +35,3 @@ children:
3435
- /collaborating-with-your-community-using-discussions
3536
- /managing-discussions-for-your-community
3637
---
37-

content/sponsors/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ redirect_from:
99
- /github/supporting-the-open-source-community-with-github-sponsors
1010
changelog:
1111
label: sponsors
12+
examples_source: data/product-examples/sponsors/user-examples.yml
1213
featuredLinks:
1314
guides:
1415
- /sponsors/sponsoring-open-source-contributors/managing-your-sponsorship

data/learning-tracks/README.md

+22
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Learning tracks are a collection of articles that help you master a particular subject. Learning tracks are defined on a per-product basis. For example, see https://docs.github.com/en/actions/guides.
44

5+
## How it works
6+
57
Learning track data for a product is defined in two places:
68

79
1. A simple array of learning track names is defined in the product sublanding index page frontmatter.
@@ -25,6 +27,26 @@ Learning track data for a product is defined in two places:
2527
2628
The `featured_track` property can be a simple boolean (i.e., `featured_track: true`) or it can be a string that includes versioning statements (e.g., `featured_track: '{% if currentVersion == "free-pro-team@latest" %}true{% else %}false{% endif %}'`). If you use versioning, you'll have multiple `featured_track`s per YML file, but make sure that only one will render in each currently supported version. A test will fail if there are more or less than one featured link for each version.
2729
30+
## Versioning
31+
2832
Versioning for learning tracks is processed at page render time. The code lives in [`lib/learning-tracks.js`](lib/learning-tracks.js), which is called by `page.render()`. The processed learning tracks are then rendered by `layouts/product-sublanding.html`.
2933
34+
Liquid conditionals do **not** have to be used for versioning in the YAML file for guides. Only the learning track guides that apply to the current version will be rendered automatically. If there aren't any tracks with guides that belong to the current version, the learning tracks section will not render at all.
35+
36+
Explicit versioning within a product's learning tracks YML data is supported as well. For example:
37+
```
38+
learning_track_name:
39+
title: 'Learning track title'
40+
description: 'Learning track description'
41+
featured_track: true
42+
versions:
43+
enterprise-server: '>=3.0'
44+
guides:
45+
- /path/to/guide1
46+
- /path/to/guide2
47+
```
48+
If the `versions` property is not included, it's assumed the track is available in all versions.
49+
50+
## Schema enforcement
51+
3052
The schema for validating the learning track YAML lives in [`tests/helpers/schemas/learning-tracks-schema.js`](tests/helpers/schemas/learning-tracks-schema.js) and is exercised by [`tests/content/lint-files.js`](tests/content/lint-files.js).

0 commit comments

Comments
 (0)