Skip to content

Commit 36cdbf1

Browse files
authored
Enhance documentation by adding code formatting to directive descriptions in CSP builders (#241)
1 parent 48380c6 commit 36cdbf1

24 files changed

+57
-57
lines changed

src/NetEscapades.AspNetCore.SecurityHeaders/Headers/ContentSecurityPolicy/BaseUriDirectiveBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.ContentSecurityPolicy;
22

33
/// <summary>
4-
/// The base-uri directive restricts the URLs which can be used in a document's
4+
/// The <c>base-uri</c> directive restricts the URLs which can be used in a document's
55
/// &lt;base&gt; element. If this value is absent, then any URI is allowed. If this
66
/// directive is absent, the user agent will use the value in the &lt;base&gt; element.
77
/// </summary>

src/NetEscapades.AspNetCore.SecurityHeaders/Headers/ContentSecurityPolicy/BlockAllMixedContentDirectiveBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.ContentSecurityPolicy;
55

66
/// <summary>
7-
/// The block-all-mixed-content directive prevents loading any assets using
7+
/// The <c>block-all-mixed-content</c> directive prevents loading any assets using
88
/// HTTP when the page is loaded using HTTPS.
99
///
1010
/// All mixed content resource requests are blocked, including both active
1111
/// and passive mixed content. This also applies to &lt;iframe&gt; documents,
1212
/// ensuring the entire page is mixed content free.
1313
///
14-
/// The upgrade-insecure-requests directive is evaluated before block-all-mixed-content
14+
/// The <c>upgrade-insecure-requests</c> directive is evaluated before <c>block-all-mixed-content</c>
1515
/// and If the former is set, the latter is effectively a no-op.
1616
/// It is recommended to set one directive or the other – not both.
1717
/// </summary>

src/NetEscapades.AspNetCore.SecurityHeaders/Headers/ContentSecurityPolicy/ConnectSourceDirectiveBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.ContentSecurityPolicy;
22

33
/// <summary>
4-
/// The connect-src directive restricts the URLs which can be loaded using script interfaces
4+
/// The <c>connect-src</c> directive restricts the URLs which can be loaded using script interfaces
55
/// The APIs that are restricted are: &lt;a&gt; ping, Fetch, XMLHttpRequest, WebSocket, and EventSource.
66
/// </summary>
77
public class ConnectSourceDirectiveBuilder : CspDirectiveBuilder

src/NetEscapades.AspNetCore.SecurityHeaders/Headers/ContentSecurityPolicy/CspBuilder.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class CspBuilder
1717
new Dictionary<string, CspDirectiveBuilderBase>();
1818

1919
/// <summary>
20-
/// The default-src directive serves as a fallback for the other CSP fetch directives.
20+
/// The <c>default-src</c> directive serves as a fallback for the other CSP fetch directives.
2121
/// Valid sources include 'self', 'unsafe-inline', 'unsafe-eval', 'none', scheme such as http:,
2222
/// or internet hosts by name or IP address, as well as an optional URL scheme and/or port number.
2323
/// The site's address may include an optional leading wildcard (the asterisk character, '*'), and
@@ -27,116 +27,116 @@ public class CspBuilder
2727
public DefaultSourceDirectiveBuilder AddDefaultSrc() => AddDirective(new DefaultSourceDirectiveBuilder());
2828

2929
/// <summary>
30-
/// The connect-src directive restricts the URLs which can be loaded using script interfaces
30+
/// The <c>connect-src</c> directive restricts the URLs which can be loaded using script interfaces
3131
/// The APIs that are restricted are: &lt;a&gt; ping, Fetch, XMLHttpRequest, WebSocket, and EventSource.
3232
/// </summary>
3333
/// <returns>A configured <see cref="ConnectSourceDirectiveBuilder"/></returns>
3434
public ConnectSourceDirectiveBuilder AddConnectSrc() => AddDirective(new ConnectSourceDirectiveBuilder());
3535

3636
/// <summary>
37-
/// The font-src directive specifies valid sources for fonts loaded using @font-face.
37+
/// The <c>font-src</c> directive specifies valid sources for fonts loaded using <see href="https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face">@font-face</see>.
3838
/// </summary>
3939
/// <returns>A configured <see cref="FontSourceDirectiveBuilder"/></returns>
4040
public FontSourceDirectiveBuilder AddFontSrc() => AddDirective(new FontSourceDirectiveBuilder());
4141

4242
/// <summary>
43-
/// The object-src directive specifies valid sources for the &lt;object&gt;, &lt;embed&gt;, and &lt;applet&gt; elements
43+
/// The <c>object-src</c> directive specifies valid sources for the &lt;object&gt;, &lt;embed&gt;, and &lt;applet&gt; elements
4444
/// </summary>
4545
/// <returns>A configured <see cref="ObjectSourceDirectiveBuilder"/></returns>
4646
public ObjectSourceDirectiveBuilder AddObjectSrc() => AddDirective(new ObjectSourceDirectiveBuilder());
4747

4848
/// <summary>
49-
/// The form-action directive restricts the URLs which can be used as the target of a form submissions from a given context
49+
/// The <c>form-action</c> directive restricts the URLs which can be used as the target of a form submissions from a given context
5050
/// </summary>
5151
/// <returns>A configured <see cref="FormActionDirectiveBuilder"/></returns>
5252
public FormActionDirectiveBuilder AddFormAction() => AddDirective(new FormActionDirectiveBuilder());
5353

5454
/// <summary>
55-
/// The img-src directive specifies valid sources of images and favicons
55+
/// The <c>img-src</c> directive specifies valid sources of images and favicons>
5656
/// </summary>
5757
/// <returns>A configured <see cref="ImageSourceDirectiveBuilder"/></returns>
5858
public ImageSourceDirectiveBuilder AddImgSrc() => AddDirective(new ImageSourceDirectiveBuilder());
5959

6060
/// <summary>
61-
/// The script-src directive specifies valid sources for sources for JavaScript.
61+
/// The <c>script-src</c> directive specifies valid sources for sources for JavaScript.
6262
/// </summary>
6363
/// <returns>A configured <see cref="ScriptSourceDirectiveBuilder"/></returns>
6464
public ScriptSourceDirectiveBuilder AddScriptSrc() => AddDirective(new ScriptSourceDirectiveBuilder());
6565

6666
/// <summary>
67-
/// The script-src-attr directive specifies valid sources for JavaScript inline event handlers.
67+
/// The <c>script-src-attr</c> directive specifies valid sources for JavaScript inline event handlers.
6868
/// </summary>
6969
/// <returns>A configured <see cref="ScriptSourceAttrDirectiveBuilder"/></returns>
7070
public ScriptSourceAttrDirectiveBuilder AddScriptSrcAttr() => AddDirective(new ScriptSourceAttrDirectiveBuilder());
7171

7272
/// <summary>
73-
/// The script-src-elem directive specifies valid sources for JavaScript &lt;script&gt; elements.
73+
/// The <c>script-src-elem</c> directive specifies valid sources for JavaScript &lt;script&gt; elements.
7474
/// </summary>
7575
/// <returns>A configured <see cref="ScriptSourceAttrDirectiveBuilder"/></returns>
7676
public ScriptSourceElemDirectiveBuilder AddScriptSrcElem() => AddDirective(new ScriptSourceElemDirectiveBuilder());
7777

7878
/// <summary>
79-
/// The style-src directive specifies valid sources for sources for stylesheets.
79+
/// The <c>style-src</c> directive specifies valid sources for sources for stylesheets.
8080
/// </summary>
8181
/// <returns>A configured <see cref="StyleSourceDirectiveBuilder"/></returns>
8282
public StyleSourceDirectiveBuilder AddStyleSrc() => AddDirective(new StyleSourceDirectiveBuilder());
8383

8484
/// <summary>
85-
/// The style-src-attr directive specifies valid sources for inline styles applied to individual DOM elements.
85+
/// The <c>style-src-attr</c> directive specifies valid sources for inline styles applied to individual DOM elements.
8686
/// </summary>
8787
/// <returns>A configured <see cref="StyleSourceAttrDirectiveBuilder"/></returns>
8888
public StyleSourceAttrDirectiveBuilder AddStyleSrcAttr() => AddDirective(new StyleSourceAttrDirectiveBuilder());
8989

9090
/// <summary>
91-
/// The style-src-elem directive specifies valid sources for stylesheet &lt;style&gt; elements
91+
/// The <c>style-src-elem</c> directive specifies valid sources for stylesheet &lt;style&gt; elements
9292
/// and &lt;link&gt; elements with rel="stylesheet".
9393
/// </summary>
9494
/// <returns>A configured <see cref="StyleSourceAttrDirectiveBuilder"/></returns>
9595
public StyleSourceElemDirectiveBuilder AddStyleSrcElem() => AddDirective(new StyleSourceElemDirectiveBuilder());
9696

9797
/// <summary>
98-
/// The media-src directive specifies valid sources for loading media using the &lt;audio&gt; and &lt;video&gt; elements
98+
/// The <c>media-src</c> directive specifies valid sources for loading media using the &lt;audio&gt; and &lt;video&gt; elements
9999
/// </summary>
100100
/// <returns>A configured <see cref="MediaSourceDirectiveBuilder"/></returns>
101101
public MediaSourceDirectiveBuilder AddMediaSrc() => AddDirective(new MediaSourceDirectiveBuilder());
102102

103103
/// <summary>
104-
/// The manifest-src directive specifies which manifest can be applied to the resource.
104+
/// The <c>manifest-src</c> directive specifies which manifest can be applied to the resource.
105105
/// </summary>
106106
/// <returns>A configured <see cref="ManifestSourceDirectiveBuilder"/></returns>
107107
public ManifestSourceDirectiveBuilder AddManifestSrc() => AddDirective(new ManifestSourceDirectiveBuilder());
108108

109109
/// <summary>
110-
/// The frame-ancestors directive specifies valid parents that may embed a page using
110+
/// The <c>frame-ancestors</c> directive specifies valid parents that may embed a page using
111111
/// &lt;frame&gt;, &lt;iframe&gt;, &lt;object&gt;, &lt;embed&gt;, or &lt;applet&gt;.
112112
/// Setting this directive to 'none' is similar to X-Frame-Options: DENY (which is also supported in older browsers).
113113
/// </summary>
114114
/// <returns>A configured <see cref="FrameAncestorsDirectiveBuilder"/></returns>
115115
public FrameAncestorsDirectiveBuilder AddFrameAncestors() => AddDirective(new FrameAncestorsDirectiveBuilder());
116116

117117
/// <summary>
118-
/// The frame-src directive specifies valid sources for nested browsing contexts loading
118+
/// The <c>frame-src</c> directive specifies valid sources for nested browsing contexts loading
119119
/// using elements such as &lt;frame&gt; and &lt;iframe&gt;
120120
/// </summary>
121121
/// <returns>A configured <see cref="FrameSourceDirectiveBuilder"/></returns>
122122
public FrameSourceDirectiveBuilder AddFrameSrc() => AddDirective(new FrameSourceDirectiveBuilder());
123123

124124
/// <summary>
125-
/// The worker-src directive specifies valid sources for Worker, SharedWorker, or ServiceWorker scripts.
125+
/// The <c>worker-src</c> directive specifies valid sources for Worker, SharedWorker, or ServiceWorker scripts.
126126
/// </summary>
127127
/// <returns>A configured <see cref="WorkerSourceDirectiveBuilder"/></returns>
128128
public WorkerSourceDirectiveBuilder AddWorkerSrc() => AddDirective(new WorkerSourceDirectiveBuilder());
129129

130130
/// <summary>
131-
/// The base-uri directive restricts the URLs which can be used in a document's
131+
/// The <c>base-uri</c> directive restricts the URLs which can be used in a document's
132132
/// &lt;base&gt; element. If this value is absent, then any URI is allowed. If this
133133
/// directive is absent, the user agent will use the value in the &lt;base&gt; element.
134134
/// </summary>
135135
/// <returns>A configured <see cref="BaseUriDirectiveBuilder"/></returns>
136136
public BaseUriDirectiveBuilder AddBaseUri() => AddDirective(new BaseUriDirectiveBuilder());
137137

138138
/// <summary>
139-
/// The sandbox directive enables a sandbox for the requested resource similar
139+
/// The <c>sandbox</c> directive enables a sandbox for the requested resource similar
140140
/// to the &lt;script&gt; sandbox attribute. It applies restrictions to a
141141
/// page's actions including preventing popups, preventing the execution
142142
/// of plugins and scripts, and enforcing a same-origin policy.
@@ -145,7 +145,7 @@ public class CspBuilder
145145
public SandboxDirectiveBuilder AddSandbox() => AddDirective(new SandboxDirectiveBuilder());
146146

147147
/// <summary>
148-
/// The upgrade-insecure-requests directive instructs user agents to treat all of a
148+
/// The <c>upgrade-insecure-requests</c> directive instructs user agents to treat all of a
149149
/// site's insecure URLs (those served over HTTP) as though they have been
150150
/// replaced with secure URLs (those served over HTTPS). This directive is
151151
/// intended for web sites with large numbers of insecure legacy URLs that need to be rewritten.
@@ -154,32 +154,32 @@ public class CspBuilder
154154
public UpgradeInsecureRequestsDirectiveBuilder AddUpgradeInsecureRequests() => AddDirective(new UpgradeInsecureRequestsDirectiveBuilder());
155155

156156
/// <summary>
157-
/// The block-all-mixed-content directive prevents loading any assets using
157+
/// The <c>block-all-mixed-content</c> directive prevents loading any assets using
158158
/// HTTP when the page is loaded using HTTPS.
159159
///
160160
/// All mixed content resource requests are blocked, including both active
161161
/// and passive mixed content. This also applies to &lt;iframe&gt; documents,
162162
/// ensuring the entire page is mixed content free.
163163
///
164-
/// The upgrade-insecure-requests directive is evaluated before block-all-mixed-content
164+
/// The <c>upgrade-insecure-requests</c> directive is evaluated before <c>block-all-mixed-content</c>
165165
/// and If the former is set, the latter is effectively a no-op.
166166
/// It is recommended to set one directive or the other – not both.
167167
/// </summary>
168168
/// <returns>A configured <see cref="BlockAllMixedContentDirectiveBuilder"/></returns>
169169
public BlockAllMixedContentDirectiveBuilder AddBlockAllMixedContent() => AddDirective(new BlockAllMixedContentDirectiveBuilder());
170170

171171
/// <summary>
172-
/// The report-uri directive instructs the user agent to report attempts to
172+
/// The <c>report-uri</c> directive instructs the user agent to report attempts to
173173
/// violate the Content Security Policy. These violation reports consist of
174174
/// JSON documents sent via an HTTP POST request to the specified URI.
175175
/// </summary>
176176
/// <returns>A configured <see cref="ReportUriDirectiveBuilder"/></returns>
177-
/// /// <remarks>NOTE: this directive has been deprecated in favour of <c>Report-To</c>.
177+
/// <remarks>NOTE: this directive has been deprecated in favour of <c>Report-To</c>.
178178
/// Use <see cref="AddReportTo"/> instead.</remarks>
179179
public ReportUriDirectiveBuilder AddReportUri() => AddDirective(new ReportUriDirectiveBuilder());
180180

181181
/// <summary>
182-
/// The report-to directive instructs the user agent to send requests to
182+
/// The <c>report-to</c> directive instructs the user agent to send requests to
183183
/// an endpoint defined in a <c>Report-To</c> HTTP header. The directive
184184
/// has no effect in and of itself, but only gains meaning in
185185
/// combination with other reporting directives.
@@ -221,14 +221,14 @@ public class CspBuilder
221221
/// <summary>
222222
/// Create a custom CSP directive for an un-implemented directive
223223
/// </summary>
224-
/// <param name="directive">The directive name, e.g. default-src</param>
224+
/// <param name="directive">The directive name, e.g. <c>default-src</c></param>
225225
/// <returns>A configured <see cref="CustomDirective"/></returns>
226226
public CustomDirective AddCustomDirective(string directive) => AddDirective(new CustomDirective(directive));
227227

228228
/// <summary>
229229
/// Create a custom CSP directive for an un-implemented directive
230230
/// </summary>
231-
/// <param name="directive">The directive name, e.g. default-src</param>
231+
/// <param name="directive">The directive name, e.g. <c>default-src</c></param>
232232
/// <param name="value">The directive value</param>
233233
/// <returns>A configured <see cref="CustomDirective"/></returns>
234234
public CustomDirective AddCustomDirective(string directive, string value) => AddDirective(new CustomDirective(directive, value));
@@ -237,7 +237,7 @@ public class CspBuilder
237237
/// Create a custom CSP directive for an un-implemented directive that uses standard or per-request values such as nonce
238238
/// To create a custom CSP directive with a fixed value, use <see cref="AddCustomDirective(string)"/>
239239
/// </summary>
240-
/// <param name="directive">The directive name, e.g. default-src</param>
240+
/// <param name="directive">The directive name, e.g. <c>default-src</c></param>
241241
/// <remarks>If you need a directive without a value, use <see cref="AddCustomDirective(string)"/> instead</remarks>
242242
/// <returns>A configured <see cref="CspDirectiveBuilder"/></returns>
243243
public CspDirectiveBuilder AddCustomDirectiveBuilder(string directive) => AddDirective(new CspDirectiveBuilder(directive));

src/NetEscapades.AspNetCore.SecurityHeaders/Headers/ContentSecurityPolicy/DefaultSourceDirectiveBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.ContentSecurityPolicy;
22

33
/// <summary>
4-
/// The default-src directive serves as a fallback for the other CSP fetch directives.
4+
/// The <c>default-src</c> directive serves as a fallback for the other CSP fetch directives.
55
/// Valid sources include 'self', 'unsafe-inline', 'unsafe-eval', 'none', scheme such as http:,
66
/// or internet hosts by name or IP address, as well as an optional URL scheme and/or port number.
77
/// The site's address may include an optional leading wildcard (the asterisk character, '*'), and

src/NetEscapades.AspNetCore.SecurityHeaders/Headers/ContentSecurityPolicy/FontSourceDirectiveBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.ContentSecurityPolicy;
22

33
/// <summary>
4-
/// The font-src directive specifies valid sources for fonts loaded using @font-face.
4+
/// The <c>font-src</c> directive specifies valid sources for fonts loaded using @font-face.
55
/// </summary>
66
public class FontSourceDirectiveBuilder : CspDirectiveBuilder
77
{

src/NetEscapades.AspNetCore.SecurityHeaders/Headers/ContentSecurityPolicy/FormActionDirectiveBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.ContentSecurityPolicy;
22

33
/// <summary>
4-
/// The form-action directive restricts the URLs which can be used as the target of a form submissions from a given context.
4+
/// The <c>form-action</c> directive restricts the URLs which can be used as the target of a form submissions from a given context.
55
/// </summary>
66
public class FormActionDirectiveBuilder : CspDirectiveBuilder
77
{

src/NetEscapades.AspNetCore.SecurityHeaders/Headers/ContentSecurityPolicy/FrameAncestorsDirectiveBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.ContentSecurityPolicy;
66

77
/// <summary>
8-
/// The frame-ancestors directive specifies valid parents that may embed a page using
8+
/// The <c>frame-ancestors</c> directive specifies valid parents that may embed a page using
99
/// &lt;frame&gt;, &lt;iframe&gt;, &lt;object&gt;, &lt;embed&gt;, or &lt;applet&gt;.
1010
/// Setting this directive to 'none' is similar to X-Frame-Options: DENY (which is also supported in older browers).
1111
/// </summary>

src/NetEscapades.AspNetCore.SecurityHeaders/Headers/ContentSecurityPolicy/FrameSourceDirectiveBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.ContentSecurityPolicy;
22

33
/// <summary>
4-
/// The frame-src directive specifies valid sources for nested browsing contexts loading
4+
/// The <c>frame-src</c> directive specifies valid sources for nested browsing contexts loading
55
/// using elements such as &lt;frame&gt; and &lt;iframe&gt;
66
/// </summary>
77
public class FrameSourceDirectiveBuilder : CspDirectiveBuilder

src/NetEscapades.AspNetCore.SecurityHeaders/Headers/ContentSecurityPolicy/ImageSourceDirectiveBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace NetEscapades.AspNetCore.SecurityHeaders.Headers.ContentSecurityPolicy;
22

33
/// <summary>
4-
/// The img-src directive specifies valid sources of images and favicons.
4+
/// The <c>img-src</c> directive specifies valid sources of images and favicons.
55
/// </summary>
66
public class ImageSourceDirectiveBuilder : CspDirectiveBuilder
77
{

0 commit comments

Comments
 (0)