Skip to content

Commit d34fa26

Browse files
Merge branch 'main' into skill
2 parents 8c6585b + 8b20fb1 commit d34fa26

163 files changed

Lines changed: 7228 additions & 19 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353

5454
# Initializes the CodeQL tools for scanning.
5555
- name: Initialize CodeQL
56-
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
56+
uses: github/codeql-action/init@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2
5757
with:
5858
languages: ${{ matrix.language }}
5959
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -81,4 +81,4 @@ jobs:
8181
run: dotnet build --no-restore -c Release
8282

8383
- name: Perform CodeQL Analysis
84-
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
84+
uses: github/codeql-action/analyze@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v4.35.2

.github/workflows/create-release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
run: |
104104
$(Get-FileHash ./${{ env.release }}.zip -Algorithm SHA256).Hash
105105
- name: Upload release
106-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
106+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
107107
with:
108108
name: binaries-${{ env.release }}
109109
path: ./${{ env.release }}.zip
@@ -131,7 +131,7 @@ jobs:
131131
exclusions: '*.json'
132132
- name: Upload abstractions
133133
if: matrix.architecture == 'win-x64'
134-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
134+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
135135
with:
136136
name: binaries-dev-proxy-abstractions-${{ github.ref_name }}
137137
path: ./DevProxy.Abstractions-${{ github.ref_name }}.zip
@@ -185,7 +185,7 @@ jobs:
185185
--verbosity Debug
186186
- name: Upload Installer
187187
if: contains(matrix.architecture, 'win-')
188-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
188+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
189189
with:
190190
name: installer-dev-proxy-${{ github.ref_name }}-${{ matrix.architecture }}
191191
path: ./${{ env.release }}/dev-proxy-installer-${{ matrix.architecture }}-${{ github.ref_name }}.exe
@@ -262,7 +262,7 @@ jobs:
262262
- name: Build and push Docker image
263263
if: "!contains(github.ref_name, '-beta')"
264264
id: push
265-
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
265+
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
266266
with:
267267
context: .
268268
push: true
@@ -275,7 +275,7 @@ jobs:
275275
- name: Build and push beta Docker image
276276
if: contains(github.ref_name, '-beta')
277277
id: push_beta
278-
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
278+
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
279279
with:
280280
context: .
281281
file: ./Dockerfile_beta

DevProxy.Abstractions/Proxy/ProxyEvents.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class RequestLog
6161
public MessageType MessageType { get; set; }
6262
public string? Method { get; init; }
6363
public string? PluginName { get; set; }
64+
public DateTimeOffset Timestamp { get; init; } = DateTimeOffset.UtcNow;
6465
public string? Url { get; init; }
6566

6667
public RequestLog(string message, MessageType messageType, LoggingContext? context) :

DevProxy.Plugins/Generation/HarGeneratorPlugin.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,10 @@ private HarEntry CreateHarEntry(RequestLog log)
103103

104104
var request = log.Context.Session.HttpClient.Request;
105105
var response = log.Context.Session.HttpClient.Response;
106-
var currentTime = DateTime.UtcNow;
107106

108107
var entry = new HarEntry
109108
{
110-
StartedDateTime = currentTime.ToString("o"),
109+
StartedDateTime = log.Timestamp.UtcDateTime.ToString("o"),
111110
Time = 0, // We don't have actual timing data in RequestLog
112111
Request = new HarRequest
113112
{

DevProxy.Plugins/Inspection/DevToolsPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ private void InitInspector()
900900
_webSocket.ClientConnected += OnWebSocketClientConnected;
901901
_ = _webSocket.StartAsync();
902902

903-
var inspectionUrl = $"http://localhost:9222/devtools/inspector.html?ws=localhost:{port}";
903+
var inspectionUrl = $"http://localhost:9222/devtools/inspector.html?ws=127.0.0.1:{port}";
904904
var profilePath = Path.Combine(Path.GetTempPath(), "devtools-devproxy");
905905
var args = $"{inspectionUrl} --remote-debugging-port=9222 --user-data-dir=\"{profilePath}\"";
906906

DevProxy.Plugins/Inspection/WebSocketServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public sealed class WebSocketServer(int port, ILogger logger) : IDisposable
3131
public async Task StartAsync()
3232
{
3333
_listener = new();
34-
_listener.Prefixes.Add($"http://localhost:{_port}/");
34+
_listener.Prefixes.Add($"http://127.0.0.1:{_port}/");
3535
_listener.Start();
3636

3737
while (true)

DevProxy.Plugins/Mocking/EntraMockResponsePlugin.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.Extensions.Logging;
1010
using System.Security.Cryptography.X509Certificates;
1111
using System.Text;
12+
using Microsoft.Extensions.DependencyInjection;
1213
using System.Text.Json;
1314
using System.Text.Json.Serialization;
1415
using System.Text.RegularExpressions;
@@ -39,7 +40,7 @@ public sealed class EntraMockResponsePlugin(
3940
HttpClient httpClient,
4041
ILogger<EntraMockResponsePlugin> logger,
4142
ISet<UrlToWatch> urlsToWatch,
42-
X509Certificate2 certificate,
43+
IServiceProvider serviceProvider,
4344
IProxyConfiguration proxyConfiguration,
4445
IConfigurationSection pluginConfigurationSection) :
4546
MockResponsePlugin(
@@ -147,18 +148,14 @@ private void UpdateIdToken(ref string body, ref bool changed)
147148
changed = true;
148149
}
149150

150-
private string GetKeyId() => certificate.Thumbprint ?? "";
151+
private string GetKeyId() => serviceProvider.GetRequiredService<X509Certificate2>().Thumbprint ?? "";
151152

152153
private List<string> GetCertificateChain()
153154
{
154-
if (certificate is null)
155-
{
156-
return [];
157-
}
158-
155+
var cert = serviceProvider.GetRequiredService<X509Certificate2>();
159156
var collection = new X509Certificate2Collection
160157
{
161-
certificate
158+
cert
162159
};
163160

164161
var certificateChain = new List<string>();
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Dev Proxy ApiCenterMinimalPermissionsPlugin config schema",
4+
"type": "object",
5+
"properties": {
6+
"$schema": {
7+
"type": "string",
8+
"description": "The JSON schema reference for validation."
9+
},
10+
"resourceGroupName": {
11+
"type": "string",
12+
"description": "Name of the resource group where the Azure API Center is located."
13+
},
14+
"serviceName": {
15+
"type": "string",
16+
"description": "Name of the Azure API Center instance that Dev Proxy should use to check if the APIs used in the app are registered."
17+
},
18+
"subscriptionId": {
19+
"type": "string",
20+
"description": "ID of the Azure subscription where the Azure API Center instance is located."
21+
},
22+
"workspace": {
23+
"type": "string",
24+
"description": "Name of the Azure API Center workspace to use. Default is 'default'.",
25+
"default": "default"
26+
},
27+
"schemeName": {
28+
"type": "string",
29+
"description": "The name of the security scheme definition. Used to determine minimal permissions required for API calls."
30+
}
31+
},
32+
"required": [
33+
"resourceGroupName",
34+
"serviceName",
35+
"subscriptionId"
36+
],
37+
"additionalProperties": false
38+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Dev Proxy ApiCenterOnboardingPlugin config schema",
4+
"type": "object",
5+
"properties": {
6+
"$schema": {
7+
"type": "string",
8+
"description": "The JSON schema reference for validation."
9+
},
10+
"createApicEntryForNewApis": {
11+
"type": "boolean",
12+
"description": "Set to true to have Dev Proxy create new API entries for APIs detected but not yet registered in API Center. When false, Dev Proxy only lists unregistered APIs. Default is true."
13+
},
14+
"resourceGroupName": {
15+
"type": "string",
16+
"description": "Name of the resource group where the Azure API Center is located."
17+
},
18+
"serviceName": {
19+
"type": "string",
20+
"description": "Name of the Azure API Center instance that Dev Proxy should use to check if the APIs used in the app are registered."
21+
},
22+
"subscriptionId": {
23+
"type": "string",
24+
"description": "ID of the Azure subscription where the Azure API Center instance is located."
25+
},
26+
"workspace": {
27+
"type": "string",
28+
"description": "Name of the Azure API Center workspace to use. Default is 'default'."
29+
}
30+
},
31+
"required": [
32+
"resourceGroupName",
33+
"serviceName",
34+
"subscriptionId"
35+
],
36+
"additionalProperties": false
37+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Dev Proxy ApiCenterProductionVersionPlugin config schema",
4+
"type": "object",
5+
"properties": {
6+
"$schema": {
7+
"type": "string",
8+
"description": "The JSON schema reference for validation."
9+
},
10+
"resourceGroupName": {
11+
"type": "string",
12+
"description": "Name of the resource group where the Azure API Center is located."
13+
},
14+
"serviceName": {
15+
"type": "string",
16+
"description": "Name of the Azure API Center instance that Dev Proxy should use to check if the APIs used in the app are registered."
17+
},
18+
"subscriptionId": {
19+
"type": "string",
20+
"description": "ID of the Azure subscription where the Azure API Center instance is located."
21+
},
22+
"workspace": {
23+
"type": "string",
24+
"description": "Name of the Azure API Center workspace to use. Default is 'default'."
25+
}
26+
},
27+
"required": [
28+
"resourceGroupName",
29+
"serviceName",
30+
"subscriptionId"
31+
],
32+
"additionalProperties": false
33+
}

0 commit comments

Comments
 (0)