diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..7f46568 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,76 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "develop", master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "develop" ] + schedule: + - cron: '33 11 * * 3' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Use only 'java' to analyze code written in Java, Kotlin or both + # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/Dockerfile b/Dockerfile index dfbd5c2..2f7c087 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,8 @@ COPY docker /app/docker # FROM alpine:3.15 +MAINTAINER CZERTAINLY + # add non root user czertainly RUN addgroup --system --gid 10001 czertainly && adduser --system --home /opt/czertainly --uid 10001 --ingroup czertainly czertainly @@ -30,6 +32,9 @@ COPY --from=builder /app /opt/czertainly WORKDIR /opt/czertainly +ENV SERVER_PORT=8080 +ENV LOG_LEVEL=INFO + USER 10001 ENTRYPOINT ["/opt/czertainly/entry.sh"] diff --git a/cmd/attributes/attributes.go b/cmd/attributes/attributes.go index 4358437..4e1314e 100644 --- a/cmd/attributes/attributes.go +++ b/cmd/attributes/attributes.go @@ -22,7 +22,7 @@ type ( UUID string `json:"uuid,omitempty"` Name string `json:"name,omitempty"` Type AttributeType `json:"type,omitempty"` - ContentType AttributeContentType `json:"content_type,omitempty"` + ContentType AttributeContentType `json:"contentType,omitempty"` Description string `json:"description,omitempty"` Properties AttributeProperties `json:"properties,omitempty"` Content []BaseAttributeContent `json:"content,omitempty"` diff --git a/cmd/utils/attributedefinition_test.go b/cmd/utils/attributedefinition_test.go index 2fc382b..ca402c2 100644 --- a/cmd/utils/attributedefinition_test.go +++ b/cmd/utils/attributedefinition_test.go @@ -25,9 +25,10 @@ func TestGetAttributeValue(t *testing.T) { attrValue := []attributes.BaseAttributeContent{{Data: "testing"}} attrs := []attributes.Attributes{ attributes.Attributes{ - UUID: "df52f720-f239-11ec-b939-0242ac120002", - Name: "Test", - Type: "STRING", + UUID: "df52f720-f239-11ec-b939-0242ac120002", + Name: "Test", + Type: "data", + ContentType: "string", Properties: attributes.AttributeProperties{ Label: "Test", Required: false, diff --git a/go.mod b/go.mod index e2b7bf1..8de7bfb 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.7.0 // indirect golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect - golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect - golang.org/x/text v0.3.7 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/text v0.7.0 // indirect gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 6e349a4..f456fcf 100644 --- a/go.sum +++ b/go.sum @@ -65,8 +65,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -81,8 +81,8 @@ golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXR golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= diff --git a/rules.json b/rules.json index c08d5b5..b5828b0 100644 --- a/rules.json +++ b/rules.json @@ -2592,8 +2592,8 @@ { "name":"condition", "uuid":"166b5cf52-63f2-11ec-90d6-0242ac120013", - "type":"DATA", - "contentType":"STRING", + "type":"data", + "contentType":"string", "properties":{ "label":"Condition", "required":true, @@ -2618,8 +2618,8 @@ { "name":"algorithm", "uuid":"166b5cf52-63f2-11ec-90d6-0242ac120003", - "type":"DATA", - "contentType":"STRING", + "type":"data", + "contentType":"string", "properties":{ "label":"Public Key Algorithm", "required":true, @@ -2657,8 +2657,8 @@ { "name":"condition", "uuid":"b44d3f44-e65a-11ec-8fea-0242ac120002", - "type":"DATA", - "contentType":"STRING", + "type":"data", + "contentType":"string", "properties":{ "label":"Condition", "required":true, @@ -2683,8 +2683,8 @@ { "name":"algorithm", "uuid":"b44d408e-e65a-11ec-8fea-0242ac120002", - "type":"DATA", - "contentType":"STRING", + "type":"data", + "contentType":"string", "properties":{ "label":"Signature Algorithm", "required":true, @@ -2754,8 +2754,8 @@ { "name":"condition", "uuid":"5f6bad5e-e663-11ec-8fea-0242ac120002", - "type":"DATA", - "contentType":"STRING", + "type":"data", + "contentType":"string", "properties":{ "label":"Condition", "required":true, @@ -2780,8 +2780,8 @@ { "name":"curve", "uuid":"5f6bb196-e663-11ec-8fea-0242ac120002", - "type":"DATA", - "contentType":"STRING", + "type":"data", + "contentType":"string", "properties":{ "label":"Curve", "required":true, @@ -2823,8 +2823,8 @@ { "name":"condition", "uuid":"7ed00782-e706-11ec-8fea-0242ac120002", - "type":"DATA", - "contentType":"STRING", + "type":"data", + "contentType":"string", "properties":{ "label":"Condition", "required":true, @@ -2857,8 +2857,8 @@ { "name":"length", "uuid":"7ed00886-e706-11ec-8fea-0242ac120002", - "type":"DATA", - "contentType":"INTEGER", + "type":"data", + "contentType":"integer", "properties":{ "label":"Key Length", "required":true,