Skip to content

Commit 18d6b2b

Browse files
authored
Merge branch 'main' into elinor/add-kiota-workspace
2 parents 2a0db34 + 43f12f4 commit 18d6b2b

File tree

14 files changed

+109
-25
lines changed

14 files changed

+109
-25
lines changed

.github/policies/resourceManagement.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
id:
1+
id:
22
name: GitOps.PullRequestIssueManagement
33
description: GitOps.PullRequestIssueManagement primitive
4-
owner:
4+
owner:
55
resource: repository
66
disabled: false
7-
where:
7+
where:
88
configuration:
99
resourceManagementConfiguration:
1010
scheduledSearches:
11-
- description:
11+
- description:
1212
frequencies:
1313
- hourly:
1414
hour: 6
1515
filters:
1616
- isIssue
1717
- isOpen
1818
- hasLabel:
19-
label: 'Needs: Author Feedback'
19+
label: 'status:waiting-for-author-feedback'
2020
- hasLabel:
2121
label: 'Status: No Recent Activity'
2222
- noActivitySince:
2323
days: 3
2424
actions:
2525
- closeIssue
26-
- description:
26+
- description:
2727
frequencies:
2828
- hourly:
2929
hour: 6
3030
filters:
3131
- isIssue
3232
- isOpen
3333
- hasLabel:
34-
label: 'Needs: Author Feedback'
34+
label: 'status:waiting-for-author-feedback'
3535
- noActivitySince:
3636
days: 4
3737
- isNotLabeledWith:
@@ -41,7 +41,7 @@ configuration:
4141
label: 'Status: No Recent Activity'
4242
- addReply:
4343
reply: This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
44-
- description:
44+
- description:
4545
frequencies:
4646
- hourly:
4747
hour: 6
@@ -64,14 +64,14 @@ configuration:
6464
- isActivitySender:
6565
issueAuthor: True
6666
- hasLabel:
67-
label: 'Needs: Author Feedback'
67+
label: 'status:waiting-for-author-feedback'
6868
- isOpen
6969
then:
7070
- addLabel:
7171
label: 'Needs: Attention :wave:'
7272
- removeLabel:
73-
label: 'Needs: Author Feedback'
74-
description:
73+
label: 'status:waiting-for-author-feedback'
74+
description:
7575
- if:
7676
- payloadType: Issues
7777
- not:
@@ -82,20 +82,20 @@ configuration:
8282
then:
8383
- removeLabel:
8484
label: 'Status: No Recent Activity'
85-
description:
85+
description:
8686
- if:
8787
- payloadType: Issue_Comment
8888
- hasLabel:
8989
label: 'Status: No Recent Activity'
9090
then:
9191
- removeLabel:
9292
label: 'Status: No Recent Activity'
93-
description:
93+
description:
9494
- if:
9595
- payloadType: Pull_Request
9696
then:
9797
- inPrLabel:
9898
label: WIP
99-
description:
100-
onFailure:
101-
onSuccess:
99+
description:
100+
onFailure:
101+
onSuccess:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Added support for multipart form data request body in PHP. [#3029](https://github.com/microsoft/kiota/issues/3029)
1313
- Added uri-form encoded serialization for PHP. [#2074](https://github.com/microsoft/kiota/issues/2074)
1414
- Added information message with base URL in the CLI experience. [#4635](https://github.com/microsoft/kiota/issues/4635)
15+
- Added optional parameter --disable-ssl-validation for generate, show, and download commands. [#4176](https://github.com/microsoft/kiota/issues/4176)
1516

1617
### Changed
1718

it/python/requirements-dev.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-i https://pypi.org/simple
22

3-
astroid==3.2.1 ; python_full_version >= '3.7.2'
3+
astroid==3.2.2 ; python_full_version >= '3.7.2'
44

55
certifi==2024.2.2 ; python_version >= '3.6'
66

@@ -40,11 +40,11 @@ platformdirs==4.2.2 ; python_version >= '3.7'
4040

4141
pluggy==1.5.0 ; python_version >= '3.7'
4242

43-
pylint==3.2.0
43+
pylint==3.2.2
4444

45-
pytest==8.2.0
45+
pytest==8.2.1
4646

47-
pytest-asyncio==0.23.6
47+
pytest-asyncio==0.23.7
4848

4949
requests==2.31.0 ; python_version >= '3.7'
5050

src/Kiota.Builder/Configuration/DownloadConfiguration.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@ public bool CleanOutput
99
{
1010
get; set;
1111
}
12+
public bool DisableSSLValidation
13+
{
14+
get; set;
15+
}
1216

1317
public object Clone()
1418
{
1519
return new DownloadConfiguration
1620
{
1721
OutputPath = OutputPath,
1822
CleanOutput = CleanOutput,
19-
ClearCache = ClearCache
23+
ClearCache = ClearCache,
24+
DisableSSLValidation = DisableSSLValidation,
2025
};
2126
}
2227
}

src/Kiota.Builder/Configuration/GenerationConfiguration.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public object Clone()
151151
Operation = Operation,
152152
PatternsOverride = new(PatternsOverride ?? Enumerable.Empty<string>(), StringComparer.OrdinalIgnoreCase),
153153
PluginTypes = new(PluginTypes ?? Enumerable.Empty<PluginType>()),
154+
DisableSSLValidation = DisableSSLValidation,
154155
};
155156
}
156157
private static readonly StringIEnumerableDeepComparer comparer = new();
@@ -200,6 +201,11 @@ private string NormalizeDescriptionLocation(string targetDirectory)
200201
return OpenAPIFilePath;
201202
}
202203
public bool IsPluginConfiguration => PluginTypes.Count != 0;
204+
205+
public bool DisableSSLValidation
206+
{
207+
get; set;
208+
}
203209
}
204210
#pragma warning restore CA1056
205211
#pragma warning restore CA2227

src/Kiota.Builder/Lock/KiotaLock.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ public bool IncludeAdditionalData
5959
{
6060
get; set;
6161
}
62+
/// <summary>
63+
/// Whether SSL Validation was disabled for this client.
64+
/// </summary>
65+
public bool DisableSSLValidation
66+
{
67+
get; set;
68+
}
6269
#pragma warning disable CA2227
6370
/// <summary>
6471
/// The serializers used for this client.
@@ -108,6 +115,7 @@ public void UpdateGenerationConfigurationFromLock(GenerationConfiguration config
108115
config.ExcludePatterns = ExcludePatterns;
109116
config.OpenAPIFilePath = DescriptionLocation;
110117
config.DisabledValidationRules = DisabledValidationRules;
118+
config.DisableSSLValidation = DisableSSLValidation;
111119
}
112120
/// <summary>
113121
/// Initializes a new instance of the <see cref="KiotaLock"/> class.
@@ -135,5 +143,6 @@ public KiotaLock(GenerationConfiguration config)
135143
ExcludePatterns = config.ExcludePatterns;
136144
DescriptionLocation = config.OpenAPIFilePath;
137145
DisabledValidationRules = config.DisabledValidationRules;
146+
DisableSSLValidation = config.DisableSSLValidation;
138147
}
139148
}

src/Kiota.Builder/Lock/KiotaLockComparer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public int GetHashCode([DisallowNull] KiotaLock obj)
2121
{
2222
if (obj == null) return 0;
2323
return
24+
obj.DisableSSLValidation.GetHashCode() * 59 +
2425
_stringIEnumerableDeepComparer.GetHashCode(obj.DisabledValidationRules?.Order(StringComparer.OrdinalIgnoreCase) ?? Enumerable.Empty<string>()) * 53 +
2526
obj.KiotaVersion.GetHashCode(StringComparison.OrdinalIgnoreCase) * 47 +
2627
obj.LockFileVersion.GetHashCode(StringComparison.OrdinalIgnoreCase) * 43 +

src/Kiota.Builder/SearchProviders/GitHub/GitHubClient/kiota-lock.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@
3737
"**/generate",
3838
"**/repos/**/topics"
3939
],
40-
"disabledValidationRules": []
41-
}
40+
"disabledValidationRules": [],
41+
"disableSSLValidation": false
42+
}

src/kiota/Handlers/BaseKiotaCommandHandler.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,16 @@ protected static void DefaultSerializersAndDeserializers(GenerationConfiguration
3131
Logger = logger,
3232
FileName = "pat-api.github.com"
3333
};
34-
internal static readonly HttpClient httpClient = new();
34+
35+
private HttpClient? _httpClient;
36+
protected HttpClient httpClient
37+
{
38+
get
39+
{
40+
_httpClient ??= GetHttpClient();
41+
return _httpClient;
42+
}
43+
}
3544
public required Option<LogLevel> LogLevelOption
3645
{
3746
get; init;
@@ -52,6 +61,21 @@ protected KiotaConfiguration Configuration
5261
configObject.BindConfiguration(configuration);
5362
return configObject;
5463
});
64+
65+
protected HttpClient GetHttpClient()
66+
{
67+
var httpClientHandler = new HttpClientHandler();
68+
if (Configuration.Generation.DisableSSLValidation)
69+
httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
70+
71+
var httpClient = new HttpClient(httpClientHandler);
72+
73+
disposables.Add(httpClientHandler);
74+
disposables.Add(httpClient);
75+
76+
return httpClient;
77+
}
78+
5579
private const string GitHubScope = "repo";
5680
private Func<CancellationToken, Task<bool>> GetIsGitHubDeviceSignedInCallback(ILogger logger) => (cancellationToken) =>
5781
{

src/kiota/Handlers/KiotaDownloadCommandHandler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,22 @@ public required Option<bool> CleanOutputOption
3131
{
3232
get; init;
3333
}
34+
public required Option<bool> DisableSSLValidationOption
35+
{
36+
get; init;
37+
}
3438
public override async Task<int> InvokeAsync(InvocationContext context)
3539
{
3640
string searchTerm = context.ParseResult.GetValueForArgument(SearchTermArgument);
3741
string version = context.ParseResult.GetValueForOption(VersionOption) ?? string.Empty;
3842
string outputPath = context.ParseResult.GetValueForOption(OutputPathOption) ?? string.Empty;
3943
bool cleanOutput = context.ParseResult.GetValueForOption(CleanOutputOption);
4044
bool clearCache = context.ParseResult.GetValueForOption(ClearCacheOption);
45+
bool disableSSLValidation = context.ParseResult.GetValueForOption(DisableSSLValidationOption);
4146
CancellationToken cancellationToken = context.BindingContext.GetService(typeof(CancellationToken)) is CancellationToken token ? token : CancellationToken.None;
4247

4348
Configuration.Download.ClearCache = clearCache;
49+
Configuration.Download.DisableSSLValidation = disableSSLValidation;
4450
Configuration.Download.CleanOutput = cleanOutput;
4551
Configuration.Download.OutputPath = NormalizeSlashesInPath(outputPath);
4652

0 commit comments

Comments
 (0)