Skip to content

Commit 1107fc6

Browse files
committed
Merge branch 'main' into ciraconfig
2 parents f040eb1 + 3f87990 commit 1107fc6

18 files changed

+479
-17
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Harden Runner
15-
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
15+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
1616
with:
1717
egress-policy: audit
1818

@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ubuntu-latest
2929
steps:
3030
- name: Harden Runner
31-
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
31+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
3232
with:
3333
egress-policy: audit
3434

@@ -45,7 +45,7 @@ jobs:
4545
runs-on: ubuntu-latest
4646
steps:
4747
- name: Harden Runner
48-
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
48+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
4949
with:
5050
egress-policy: audit
5151

@@ -61,7 +61,7 @@ jobs:
6161
runs-on: ubuntu-latest
6262
steps:
6363
- name: Harden Runner
64-
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
64+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
6565
with:
6666
egress-policy: audit
6767

@@ -78,7 +78,7 @@ jobs:
7878
os: [windows-2019, windows-2022, ubuntu-22.04, ubuntu-20.04]
7979
steps:
8080
- name: Harden Runner
81-
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
81+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
8282
with:
8383
egress-policy: audit
8484

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
steps:
4848
- name: Harden Runner
49-
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
49+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
5050
with:
5151
egress-policy: audit
5252

@@ -55,7 +55,7 @@ jobs:
5555

5656
# Initializes the CodeQL tools for scanning.
5757
- name: Initialize CodeQL
58-
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
58+
uses: github/codeql-action/init@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
5959
with:
6060
languages: ${{ matrix.language }}
6161
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -66,7 +66,7 @@ jobs:
6666
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
6767
# If this step fails, then you should remove it and run the build manually (see below)
6868
- name: Autobuild
69-
uses: github/codeql-action/autobuild@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
69+
uses: github/codeql-action/autobuild@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
7070

7171
# ℹ️ Command-line programs to run using the OS shell.
7272
# 📚 https://git.io/JvXDl
@@ -80,7 +80,7 @@ jobs:
8080
# make release
8181

8282
- name: Perform CodeQL Analysis
83-
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
83+
uses: github/codeql-action/analyze@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
8484
- name: Generate Security Report
8585
uses: rsdmike/github-security-report-action@a149b24539044c92786ec39af8ba38c93496495d # v3.0.4
8686
continue-on-error: true

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Harden Runner
20-
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
20+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
2121
with:
2222
egress-policy: audit
2323

.github/workflows/integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
steps:
2626
- name: Harden Runner
27-
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
27+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
2828
with:
2929
egress-policy: audit
3030

.github/workflows/projectsSync.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Harden Runner
15-
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
15+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
1616
with:
1717
egress-policy: audit
1818

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
steps:
2828
- name: Harden Runner
29-
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
29+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
3030
with:
3131
egress-policy: audit
3232

.github/workflows/scorecard.yml

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

3333
steps:
3434
- name: Harden Runner
35-
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
35+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
3636
with:
3737
egress-policy: audit
3838

@@ -72,6 +72,6 @@ jobs:
7272

7373
# Upload the results to GitHub's code scanning dashboard.
7474
- name: "Upload to code-scanning"
75-
uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
75+
uses: github/codeql-action/upload-sarif@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
7676
with:
7777
sarif_file: results.sarif

.github/workflows/semantic.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Harden Runner
14-
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
14+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
1515
with:
1616
egress-policy: audit
1717

@@ -23,6 +23,6 @@ jobs:
2323
configFile: .github/commitlint.config.cjs
2424
- name: Install Dependencies
2525
run: npm install @commitlint/config-conventional@18.5
26-
- uses: JulienKode/pull-request-name-linter-action@8c05fb989d9f156ce61e33754f9802c9d3cffa58 # v0.5.0
26+
- uses: JulienKode/pull-request-name-linter-action@7770f2e08bd3761842f0c889601c5237dec6080c # v19.0.0
2727
with:
2828
configuration-path: ./.github/commitlint.config.cjs

pkg/wsman/ips/http/decoder.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*********************************************************************
2+
* Copyright (c) Intel Corporation 2023
3+
* SPDX-License-Identifier: Apache-2.0
4+
**********************************************************************/
5+
6+
package http
7+
8+
const (
9+
ValueNotFound = "Value not found in map"
10+
IPSHTTPProxyService = "IPS_HTTPProxyService"
11+
12+
AddProxyAccessPoint = "AddProxyAccessPoint"
13+
)
14+
15+
// InfoFormatToString is a map for converting InfoFormat values to their string representations.
16+
var InfoFormatToString = map[InfoFormat]string{
17+
InfoFormatIPv4: "IPv4 Address",
18+
InfoFormatIPv6: "IPv6 Address",
19+
InfoFormatFQDN: "FQDN",
20+
}
21+
22+
// String returns a human-readable string representation of the InfoFormat enumeration.
23+
func (i InfoFormat) String() string {
24+
if value, exists := InfoFormatToString[i]; exists {
25+
return value
26+
}
27+
28+
return ValueNotFound
29+
}
30+
31+
// ReturnValueToString is a map for converting return values to their string representations.
32+
var ReturnValueToString = map[int]string{
33+
PTStatusSuccess: "PT_STATUS_SUCCESS",
34+
PTStatusInternalError: "PT_STATUS_INTERNAL_ERROR",
35+
PTStatusNotPermitted: "PT_STATUS_NOT_PERMITTED",
36+
PTStatusMaxLimitReached: "PT_STATUS_MAX_LIMIT_REACHED",
37+
PTStatusInvalidParameter: "PT_STATUS_INVALID_PARAMETER",
38+
PTStatusDuplicate: "PT_STATUS_DUPLICATE",
39+
}
40+
41+
// GetReturnValueString returns a human-readable string representation of the return value.
42+
func GetReturnValueString(returnValue int) string {
43+
if value, exists := ReturnValueToString[returnValue]; exists {
44+
return value
45+
}
46+
47+
return ValueNotFound
48+
}

pkg/wsman/ips/http/decoder_test.go

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*********************************************************************
2+
* Copyright (c) Intel Corporation 2023
3+
* SPDX-License-Identifier: Apache-2.0
4+
**********************************************************************/
5+
6+
package http
7+
8+
import (
9+
"testing"
10+
)
11+
12+
func TestInfoFormat_String(t *testing.T) {
13+
tests := []struct {
14+
state InfoFormat
15+
expected string
16+
}{
17+
{InfoFormatIPv4, "IPv4 Address"},
18+
{InfoFormatIPv6, "IPv6 Address"},
19+
{InfoFormatFQDN, "FQDN"},
20+
{InfoFormat(999), "Value not found in map"},
21+
}
22+
23+
for _, test := range tests {
24+
result := test.state.String()
25+
if result != test.expected {
26+
t.Errorf("Expected %s, but got %s", test.expected, result)
27+
}
28+
}
29+
}
30+
31+
func TestGetReturnValueString(t *testing.T) {
32+
tests := []struct {
33+
returnValue int
34+
expected string
35+
}{
36+
{PTStatusSuccess, "PT_STATUS_SUCCESS"},
37+
{PTStatusInternalError, "PT_STATUS_INTERNAL_ERROR"},
38+
{PTStatusNotPermitted, "PT_STATUS_NOT_PERMITTED"},
39+
{PTStatusMaxLimitReached, "PT_STATUS_MAX_LIMIT_REACHED"},
40+
{PTStatusInvalidParameter, "PT_STATUS_INVALID_PARAMETER"},
41+
{PTStatusDuplicate, "PT_STATUS_DUPLICATE"},
42+
{999, "Value not found in map"},
43+
}
44+
45+
for _, test := range tests {
46+
result := GetReturnValueString(test.returnValue)
47+
if result != test.expected {
48+
t.Errorf("Expected %s, but got %s", test.expected, result)
49+
}
50+
}
51+
}

0 commit comments

Comments
 (0)