You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -9,19 +9,45 @@ productName: GroupDocs.Conversion for .NET
9
9
hideChildren: False
10
10
toc: True
11
11
---
12
+
12
13
## What are external resources?
14
+
13
15
*External resources* refer to various types of content or files that are not directly embedded within the document but are instead referenced and loaded from external locations. These resources enhance the functionality, appearance, and interactivity of the document. Common external resources include images, audio, video, fonts, CSS, scripts, frameworks, and so on. **GroupDocs.Conversion** considers external any resource that a document is trying to load from an external URL.
14
16
15
17
Utilizing external resources optimizes the performance, maintainability, and scalability of web pages and other documents. These resources are typically cached by browsers, which can reduce the load time of subsequent visits to a website. However, relying too heavily on external resources can also introduce dependencies and potential points of failure if the external sources become unavailable.
16
18
17
-
## Restricting all external resources
18
-
While loading [web]({{< ref "conversion/net/developer-guide/advanced-usage/loading/load-options-for-different-document-types/load-markup-document-with-options.md" >}}), [presentations]({{< ref "conversion/net/developer-guide/advanced-usage/loading/load-options-for-different-document-types/load-presentation-document-with-options.md" >}}) and [word-processing]({{< ref "conversion/net/developer-guide/advanced-usage/loading/load-options-for-different-document-types/load-wordprocessing-document-with-options.md" >}}) documents, the [**GroupDocs.Conversion**](https://products.groupdocs.com/conversion/net) allows skipping of loading the external resources.
19
+
## Security considerations
20
+
21
+
Loading external resources from untrusted documents can pose security risks:
22
+
23
+
***Server-Side Request Forgery (SSRF)**: A malicious document could contain references to internal network resources, potentially allowing attackers to probe or access internal services.
24
+
***NTLM credential leaks**: Documents with UNC paths (e.g., `\\server\share`) could trigger automatic NTLM authentication, potentially leaking credentials.
25
+
***Data exfiltration**: External resources could be used to track document access or exfiltrate data.
26
+
27
+
To mitigate these risks, [**GroupDocs.Conversion**](https://products.groupdocs.com/conversion/net) implements a **secure by default** approach - the `SkipExternalResources` property is set to `true` by default in all supporting load options classes.
28
+
29
+
## Supported document types
19
30
20
-
To restrict the loading of external resources during the conversion, use the `SkipExternalResources` boolean property of the respective [WebLoadOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.load/webloadoptions), [PresentationLoadOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.load/presentationloadoptions), or [WordProcessingLoadOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.load/wordprocessingloadoptions) class.
31
+
The external resource loading control is available for the following document types:
21
32
22
-
The following code snippet shows how to skip loading of external resources while loading an HTML document:
| Word Processing |[WordProcessingLoadOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.load/wordprocessingloadoptions)|
All these classes implement the [IResourceLoadingOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.load/iresourceloadingoptions) interface, which defines the `SkipExternalResources` and `WhitelistedResources` properties.
43
+
44
+
## Restricting external resources
45
+
46
+
By default, `SkipExternalResources` is set to `true`, which means external resources are already blocked. If you have previously enabled external resource loading and want to restrict it again, set the `SkipExternalResources` property to `true`.
47
+
48
+
The following code snippets show how to skip loading of external resources for different document types:
49
+
50
+
### Web/HTML documents
25
51
26
52
```csharp
27
53
usingGroupDocs.Conversion;
@@ -39,32 +65,103 @@ using (var converter = new Converter("sample.html", (LoadContext loadContext) =>
39
65
}
40
66
```
41
67
68
+
### Word processing documents
69
+
70
+
```csharp
71
+
usingGroupDocs.Conversion;
72
+
usingGroupDocs.Conversion.Options.Convert;
73
+
usingGroupDocs.Conversion.Options.Load;
74
+
75
+
varloadOptions=newWordProcessingLoadOptions
76
+
{
77
+
SkipExternalResources=true
78
+
};
79
+
using (varconverter=newConverter("sample.docx", (LoadContextloadContext) =>loadOptions))
80
+
{
81
+
varoptions=newPdfConvertOptions();
82
+
converter.Convert("converted.pdf", options);
83
+
}
84
+
```
85
+
86
+
### Presentation documents
87
+
88
+
```csharp
89
+
usingGroupDocs.Conversion;
90
+
usingGroupDocs.Conversion.Options.Convert;
91
+
usingGroupDocs.Conversion.Options.Load;
92
+
93
+
varloadOptions=newPresentationLoadOptions
94
+
{
95
+
SkipExternalResources=true
96
+
};
97
+
using (varconverter=newConverter("sample.pptx", (LoadContextloadContext) =>loadOptions))
98
+
{
99
+
varoptions=newPdfConvertOptions();
100
+
converter.Convert("converted.pdf", options);
101
+
}
102
+
```
42
103
43
-
Before v24.10:
104
+
### Spreadsheet documents
44
105
45
106
```csharp
46
107
usingGroupDocs.Conversion;
47
108
usingGroupDocs.Conversion.Options.Convert;
48
109
usingGroupDocs.Conversion.Options.Load;
49
110
50
-
varloadOptions=newWebLoadOptions
111
+
varloadOptions=newSpreadsheetLoadOptions
112
+
{
113
+
SkipExternalResources=true
114
+
};
115
+
using (varconverter=newConverter("sample.xlsx", (LoadContextloadContext) =>loadOptions))
116
+
{
117
+
varoptions=newPdfConvertOptions();
118
+
converter.Convert("converted.pdf", options);
119
+
}
120
+
```
121
+
122
+
### Email documents
123
+
124
+
```csharp
125
+
usingGroupDocs.Conversion;
126
+
usingGroupDocs.Conversion.Options.Convert;
127
+
usingGroupDocs.Conversion.Options.Load;
128
+
129
+
varloadOptions=newEmailLoadOptions
130
+
{
131
+
SkipExternalResources=true
132
+
};
133
+
using (varconverter=newConverter("sample.eml", (LoadContextloadContext) =>loadOptions))
134
+
{
135
+
varoptions=newPdfConvertOptions();
136
+
converter.Convert("converted.pdf", options);
137
+
}
138
+
```
139
+
140
+
### SVG documents
141
+
142
+
```csharp
143
+
usingGroupDocs.Conversion;
144
+
usingGroupDocs.Conversion.Options.Convert;
145
+
usingGroupDocs.Conversion.Options.Load;
146
+
147
+
varloadOptions=newSvgLoadOptions
51
148
{
52
149
SkipExternalResources=true
53
150
};
54
-
using (varconverter=newConverter("sample.html", () =>loadOptions))
151
+
using (varconverter=newConverter("sample.svg", (LoadContextloadContext) =>loadOptions))
55
152
{
56
153
varoptions=newPdfConvertOptions();
57
154
converter.Convert("converted.pdf", options);
58
155
}
59
156
```
60
157
61
-
## Allowlisting some of the external resources
62
-
Sometimes you may want to skip loading most of the external resources, but still load some particular resources.
63
-
To allow-list specific resources during the conversion, use the `WhitelistedResources` property of the respective [WebLoadOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.load/webloadoptions), [PresentationLoadOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.load/presentationloadoptions), or [WordProcessingLoadOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.load/wordprocessingloadoptions) class. The property is effective when the `SkipExternalResources` property is enabled. The `WhitelistedResources` property accepts the string list containing the portions of URLs to be loaded while restricting the loading of other external resources.
158
+
## Allowlisting specific external resources
159
+
160
+
Sometimes you may want to skip loading most of the external resources, but still load some particular resources from trusted sources.
64
161
65
-
The following code snippet shows how to load the JPG and JPEG images and any resources from the `example.com` domain while restricting any other external resources:
162
+
To allow-list specific resources during the conversion, use the `WhitelistedResources` property. This property accepts a list of strings containing portions of URLs to be allowed. The `WhitelistedResources` property is effective only when the `SkipExternalResources` property is set to `true`.
66
163
67
-
With v24.10 and later:
164
+
The following code snippet shows how to load JPG and JPEG images and any resources from the `example.com` domain while restricting all other external resources:
68
165
69
166
```csharp
70
167
usingGroupDocs.Conversion;
@@ -73,8 +170,8 @@ using GroupDocs.Conversion.Options.Load;
0 commit comments