Skip to content

Commit e0d5ffb

Browse files
authored
block all unsafe ports (#5380)
* block all unsafe ports extracted from three browsers' sources: dotnet/runtime#76236 (comment). * fb * sort
1 parent f9dc2bb commit e0d5ffb

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/Macros/Config/GeneratePortNumberConfig.cs

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,31 @@ namespace Microsoft.TemplateEngine.Orchestrator.RunnableProjects.Macros.Config
1010
{
1111
internal class GeneratePortNumberConfig : IMacroConfig
1212
{
13+
// sources of unsafe ports:
14+
// * chrome: https://chromium.googlesource.com/chromium/src.git/+/refs/heads/master/net/base/port_util.cc#27
15+
// * firefox: https://www-archive.mozilla.org/projects/netlib/portbanning#portlist
16+
// * safari: https://github.com/WebKit/WebKit/blob/42f5a93823a7f087a800cd65c6bc0551dbeb55d3/Source/WTF/wtf/URL.cpp#L969
1317
private static readonly HashSet<int> UnsafePorts = new HashSet<int>()
1418
{
15-
2049, // nfs
16-
3659, // apple-sasl / PasswordServer
17-
4045, // lockd
18-
6000, // X11
19-
6665, // Alternate IRC [Apple addition]
20-
6666, // Alternate IRC [Apple addition]
21-
6667, // Standard IRC [Apple addition]
22-
6668, // Alternate IRC [Apple addition]
23-
6669, // Alternate IRC [Apple addition]
19+
1719, // H323 (RAS)
20+
1720, // H323 (Q931)
21+
1723, // H323 (H245)
22+
2049, // NFS
23+
3659, // apple-sasl / PasswordServer [Apple addition]
24+
4045, // lockd
25+
4190, // ManageSieve [Apple addition]
26+
5060, // SIP
27+
5061, // SIPS
28+
6000, // X11
29+
6566, // SANE
30+
6665, // Alternate IRC [Apple addition]
31+
6666, // Alternate IRC [Apple addition]
32+
6667, // Standard IRC [Apple addition]
33+
6668, // Alternate IRC [Apple addition]
34+
6669, // Alternate IRC [Apple addition]
35+
6679, // Alternate IRC SSL [Apple addition]
36+
6697, // IRC+SSL [Apple addition]
37+
10080, // amanda
2438
};
2539

2640
internal GeneratePortNumberConfig(string variableName, string? dataType, int fallback, int low, int high)

0 commit comments

Comments
 (0)