Skip to content

Commit 2569299

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents afd9b78 + 22bf25c commit 2569299

19 files changed

+166
-4
lines changed

.github/dependabot.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
# default location of `.github/workflows`
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
9+
- package-ecosystem: "nuget"
10+
# location of package manifests
11+
directory: "/"
12+
schedule:
13+
interval: "daily"
14+
15+
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)

.github/workflows/codeql-analysis.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CodeQL Analysis
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
schedule:
8+
- cron: '0 8 * * *'
9+
10+
jobs:
11+
analyze:
12+
name: codeql-analysis
13+
runs-on: windows-latest
14+
steps:
15+
# Due to the insufficient memory allocated by default, CodeQL sometimes requires more to be manually allocated
16+
- name: Configure Pagefile
17+
id: config_pagefile
18+
uses: al-cheb/configure-pagefile-action@v1.2
19+
with:
20+
minimum-size: 8GB
21+
maximum-size: 32GB
22+
disk-root: "D:"
23+
24+
- name: Checkout repository
25+
id: checkout_repo
26+
uses: actions/checkout@v2
27+
28+
- name: Initialize CodeQL
29+
id: init_codeql
30+
uses: github/codeql-action/init@v1
31+
with:
32+
queries: security-and-quality
33+
34+
- name: Build project
35+
id: build_project
36+
shell: pwsh
37+
run: |
38+
dotnet build ./src/RestSharp/RestSharp.csproj -c Release
39+
40+
- name: Perform CodeQL Analysis
41+
id: analyze_codeql
42+
uses: github/codeql-action/analyze@v1
43+
44+
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)

.github/workflows/pull-request.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
steps:
1010
- uses: actions/checkout@v1
11-
- uses: actions/setup-dotnet@v1
11+
- uses: actions/setup-dotnet@v1.8.0
1212
with:
1313
dotnet-version: '3.1.201'
1414

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# RestSharp CI/CD documentation
2+
3+
## 1. Set up Dependabot
4+
5+
Dependabot is a GitHub native security tool that goes through the dependencies in the project and creates alerts, and PRs with updates when a new and/or non-vulnerable version is found.
6+
7+
- for PRs with version updates, this pipeline comes pre-configured for all current dependency sources in the project, so at "Insights" tab -> "Dependency graph" -> "Dependabot", you should be able to see all tracked sources of dependencies, when they have been checked last and view a full log of the last check
8+
9+
![Dependabot_tab](/docs/CI-CD_DOCUMENTATION/Dependabot_tab.png)
10+
11+
![Dependabot_log_page](/docs/CI-CD_DOCUMENTATION/Dependabot_log_page.png)
12+
13+
### Set up security alerts and updates
14+
##### - GitHub, through Dependabot, also natively offers a security check for vulnerable dependencies
15+
16+
1. Go to the project's GitHub repository and click on the **Settings** tab
17+
18+
2. Go to **Security & analysis** section
19+
20+
3. Click "Enable" for both "Dependabot alerts" and "Dependabot security updates"
21+
22+
- By enabling "Dependabot alerts", you would be notified for any vulnerable dependencies in the project. At "Security" tab -> "Dependabot alerts", you can manage all alerts. By clicking on an alert, you would be able to see a detailed explanation of the vulnerability and a viable solution.
23+
24+
![Dependabot_alerts_page](/docs/CI-CD_DOCUMENTATION/Dependabot_alerts_page.png)
25+
26+
![Dependabot_alert_page](/docs/CI-CD_DOCUMENTATION/Dependabot_alert_page.png)
27+
28+
- By enabling "Dependabot security updates", you authorize Dependabot to create PRs specifically for **security updates**
29+
30+
![Dependabot_PRs](/docs/CI-CD_DOCUMENTATION/Dependabot_PRs.png)
31+
32+
### Set up Dependency graph
33+
##### - The "Dependency graph" option should be enabled by default for all public repos, but in case it isn't:
34+
35+
1. Go to the project's GitHub repository and click on the **Settings** tab
36+
37+
2. Go to **Security & analysis** section
38+
39+
3. Click "Enable" for the "Dependency graph" option
40+
41+
- this option enables the "Insights" tab -> "Dependency graph" section -> "Dependencies" tab, in which all the dependencies for the project are listed, under the different manifests they are included in
42+
43+
![Dependabot_dependency_graph](/docs/CI-CD_DOCUMENTATION/Dependabot_dependency_graph.png)
44+
45+
NOTE: **screenshots are only exemplary**
46+
47+
<br>
48+
49+
## 2. CodeQL
50+
51+
CodeQL is GitHub's own industry-leading semantic code analysis engine. CodeQL requires no setup, because it comes fully pre-configured by us.
52+
53+
To activate it and see its results, only a push commit or a merge of a PR to the default branch of your repository, is required.
54+
55+
We've also configured CodeQL to run on schedule, so every day at 8:00AM UTC, it automatically tests the code.
56+
57+
- you can see the results here at **Security** tab -> **Code scanning alerts** -> **CodeQL**:
58+
59+
![CodeQL_results](/docs/CI-CD_DOCUMENTATION/CodeQL_results.png)
60+
61+
- on the page of each result, you can see an explanation of what the problem is and also one or more solutions:
62+
63+
![CodeQL_alert_page](/docs/CI-CD_DOCUMENTATION/CodeQL_alert_page.png)
64+
65+
#
66+
67+
Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)
54.1 KB
Loading
55.3 KB
Loading
63 KB
Loading
Loading
Loading
Loading
48.4 KB
Loading
41.9 KB
Loading

docs/getting-started/getting-started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ RestSharp supports sending XML or JSON body as part of the request. To add a bod
6262

6363
There is no need to set the `Content-Type` or add the `DataFormat` parameter to the request when using those methods, RestSharp will do it for you.
6464

65-
RestSharp will also handle both XML and JSON responses and perform all necessary deserialization tasks, depending on th server response type. Therefore, you only need to add the `Accept` header if you want to deserialize the response manually.
65+
RestSharp will also handle both XML and JSON responses and perform all necessary deserialization tasks, depending on the server response type. Therefore, you only need to add the `Accept` header if you want to deserialize the response manually.
6666

6767
For example, only you'd only need these lines to make a request with JSON body:
6868

docs/usage/parameters.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ It will send a `GET` request to `https://search.me/search?foo=bar")`.
9898
You can also specify the query string parameter type explicitly:
9999

100100
```csharp
101-
request.AddParameter("foo", "bar", RequestType.QueryString);
101+
request.AddParameter("foo", "bar", ParameterType.QueryString);
102102
```
103103

104104
In some cases you might need to prevent RestSharp from encoding the query string parameter. To do so, use the `QueryStringWithoutEncode` parameter type.

src/RestSharp/Extensions/StringExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace RestSharp.Extensions
2525
public static class StringExtensions
2626
{
2727
static readonly Regex DateRegex = new Regex(@"\\?/Date\((-?\d+)(-|\+)?([0-9]{4})?\)\\?/");
28-
static readonly Regex NewDateRegex = new Regex(@"newDate\((-?\d+)*\)");
28+
static readonly Regex NewDateRegex = new Regex(@"newDate\((-?\d+)\)");
2929

3030
static readonly Regex IsUpperCaseRegex = new Regex(@"^[A-Z]+$");
3131

test/RestSharp.Tests/JsonTests.cs

+22
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,28 @@ public void Can_Deserialize_DateTimeOffset()
116116
);
117117
}
118118

119+
[Test]
120+
public void Can_Deserialize_NewDateTime()
121+
{
122+
var payload = GetPayLoad<NewDateTimeTestStructure>("newdatetimes.json");
123+
124+
Assert.AreEqual(
125+
new DateTime(2011, 6, 30, 8, 15, 46, 929, DateTimeKind.Utc),
126+
payload.DateTime
127+
);
128+
}
129+
130+
[Test]
131+
public void Can_Deserialize_Negative_NewDateTime()
132+
{
133+
var payload = GetPayLoad<NewDateTimeTestStructure>("newdatetimes.json");
134+
135+
Assert.AreEqual(
136+
new DateTime(1969, 12, 31, 23, 59, 59, 999, DateTimeKind.Utc),
137+
payload.DateTimeNegative
138+
);
139+
}
140+
119141
[Test]
120142
public void Can_Deserialize_Decimal_With_Four_Zeros_After_Floating_Point()
121143
{

test/RestSharp.Tests/RestSharp.Tests.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
<None Update="SampleData\NestedListSample.xml">
8585
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
8686
</None>
87+
<None Update="SampleData\newdatetimes.json">
88+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
89+
</None>
8790
<None Update="SampleData\objectproperty.json">
8891
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
8992
</None>

test/RestSharp.Tests/SampleClasses/misc.cs

+7
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,13 @@ public class Iso8601DateTimeTestStructure
222222
public DateTime DateTimeWithOffset { get; set; }
223223
}
224224

225+
public class NewDateTimeTestStructure
226+
{
227+
public DateTime DateTime { get; set; }
228+
229+
public DateTime DateTimeNegative { get; set; }
230+
}
231+
225232
public class TimeSpanTestStructure
226233
{
227234
public TimeSpan Tick { get; set; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"DateTime": "new Date(1309421746929)",
3+
"DateTimeNegative": "new Date(-1)"
4+
}

0 commit comments

Comments
 (0)