From 976b8c4cfea9662e4c2be8929e99182c6f361c4f Mon Sep 17 00:00:00 2001 From: Shaopeng <81775155+shaopeng-gh@users.noreply.github.com> Date: Thu, 21 Oct 2021 17:39:53 -0700 Subject: [PATCH 1/4] update version schema --- sarif/sarif.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sarif/sarif.go b/sarif/sarif.go index fdaf117..3e1edac 100644 --- a/sarif/sarif.go +++ b/sarif/sarif.go @@ -15,7 +15,7 @@ type Version string const Version210 Version = "2.1.0" var versions = map[Version]string{ - Version210: "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json", + Version210: "http://json.schemastore.org/sarif-2.1.0-rtm.5.json", } // Report is the encapsulating type representing a Sarif Report From 2c587985fb4e72fdf6ee564668f31c8bd4cd69ed Mon Sep 17 00:00:00 2001 From: Shaopeng <81775155+shaopeng-gh@users.noreply.github.com> Date: Thu, 21 Oct 2021 17:50:17 -0700 Subject: [PATCH 2/4] update path --- example/main.go | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/main.go b/example/main.go index ff87598..8c77588 100644 --- a/example/main.go +++ b/example/main.go @@ -6,7 +6,7 @@ import ( "os" "strings" - "github.com/owenrumney/go-sarif/sarif" + "github.com/shaopeng-gh/go-sarif/sarif" ) // simple structure for the output of tfsec diff --git a/go.mod b/go.mod index 7906eb1..0c3de00 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/owenrumney/go-sarif +module github.com/shaopeng-gh/go-sarif go 1.16 From 8abcdfec7d07bee31cf5f453eb71ee935a40bbda Mon Sep 17 00:00:00 2001 From: Shaopeng <81775155+shaopeng-gh@users.noreply.github.com> Date: Thu, 21 Oct 2021 21:54:18 -0700 Subject: [PATCH 3/4] update sarif schema --- README.md | 2 +- sarif/sarif.go | 2 +- test/report_test.go | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a979470..968e571 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This example is taken directly from the [Microsoft sarif pages](https://github.c ```json { "version": "2.1.0", - "$schema": "http://json.schemastore.org/sarif-2.1.0-rtm.4", + "$schema": "https://json.schemastore.org/sarif-2.1.0-rtm.5.json", "runs": [ { "tool": { diff --git a/sarif/sarif.go b/sarif/sarif.go index 3e1edac..fa8aa83 100644 --- a/sarif/sarif.go +++ b/sarif/sarif.go @@ -15,7 +15,7 @@ type Version string const Version210 Version = "2.1.0" var versions = map[Version]string{ - Version210: "http://json.schemastore.org/sarif-2.1.0-rtm.5.json", + Version210: "https://json.schemastore.org/sarif-2.1.0-rtm.5.json", } // Report is the encapsulating type representing a Sarif Report diff --git a/test/report_test.go b/test/report_test.go index 4dabead..5bd4ccb 100644 --- a/test/report_test.go +++ b/test/report_test.go @@ -13,7 +13,7 @@ func Test_new_simple_report_with_single_run(t *testing.T) { given.a_new_report(). with_a_run_added("tfsec", "https://tfsec.dev") - then.report_text_is(`{"version":"2.1.0","$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"results":[]}]}`) + then.report_text_is(`{"version":"2.1.0","$schema":"https://json.schemastore.org/sarif-2.1.0-rtm.5.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"results":[]}]}`) } func Test_new_report_with_empty_run(t *testing.T) { @@ -21,7 +21,7 @@ func Test_new_report_with_empty_run(t *testing.T) { given.a_new_report(). with_a_run_with_empty_result_added("tfsec", "https://tfsec.dev") - then.report_text_is(`{"version":"2.1.0","$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"results":[]}]}`) + then.report_text_is(`{"version":"2.1.0","$schema":"https://json.schemastore.org/sarif-2.1.0-rtm.5.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"results":[]}]}`) } func Test_new_simple_report_with_artifact(t *testing.T) { @@ -30,7 +30,7 @@ func Test_new_simple_report_with_artifact(t *testing.T) { run := given.a_new_report(). with_a_run_added("tfsec", "https://tfsec.dev") when.an_artifact_is_added_to_the_run(run, "file://broken.go") - then.report_text_is(`{"version":"2.1.0","$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"artifacts":[{"location":{"uri":"file://broken.go"},"length":-1}],"results":[]}]}`) + then.report_text_is(`{"version":"2.1.0","$schema":"https://json.schemastore.org/sarif-2.1.0-rtm.5.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"artifacts":[{"location":{"uri":"file://broken.go"},"length":-1}],"results":[]}]}`) } func Test_new_simple_report_with_propertybag(t *testing.T) { @@ -39,7 +39,7 @@ func Test_new_simple_report_with_propertybag(t *testing.T) { run := given.a_new_report(). with_a_run_added("tfsec", "https://tfsec.dev") when.some_properties_are_added_to_the_run(run) - then.report_text_is(`{"version":"2.1.0","$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"results":[],"properties":{"integer_property":10,"string_property":"this is a string"}}]}`) + then.report_text_is(`{"version":"2.1.0","$schema":"https://json.schemastore.org/sarif-2.1.0-rtm.5.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"results":[],"properties":{"integer_property":10,"string_property":"this is a string"}}]}`) } func Test_new_simple_report_with_duplicate_artifact(t *testing.T) { @@ -50,7 +50,7 @@ func Test_new_simple_report_with_duplicate_artifact(t *testing.T) { when.an_artifact_is_added_to_the_run(run, "file://broken.go"). and(). an_artifact_is_added_to_the_run(run, "file://broken.go") - then.report_text_is(`{"version":"2.1.0","$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"artifacts":[{"location":{"uri":"file://broken.go"},"length":-1},{"location":{"uri":"file://broken.go"},"length":-1}],"results":[]}]}`) + then.report_text_is(`{"version":"2.1.0","$schema":"https://json.schemastore.org/sarif-2.1.0-rtm.5.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"artifacts":[{"location":{"uri":"file://broken.go"},"length":-1},{"location":{"uri":"file://broken.go"},"length":-1}],"results":[]}]}`) } func Test_load_sarif_from_string(t *testing.T) { @@ -58,7 +58,7 @@ func Test_load_sarif_from_string(t *testing.T) { content := `{ "version": "2.1.0", - "$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json", + "$schema": "https://json.schemastore.org/sarif-2.1.0-rtm.5.json", "runs": [ { "tool": { @@ -80,7 +80,7 @@ func Test_load_sarif_report_from_file(t *testing.T) { content := `{ "version": "2.1.0", - "$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json", + "$schema": "https://json.schemastore.org/sarif-2.1.0-rtm.5.json", "runs": [ { "tool": { From fd54dd5e850a73c0c92f3183db21f1ce1e676149 Mon Sep 17 00:00:00 2001 From: Shaopeng <81775155+shaopeng-gh@users.noreply.github.com> Date: Thu, 21 Oct 2021 21:54:18 -0700 Subject: [PATCH 4/4] update sarif schema --- README.md | 2 +- example/main.go | 2 +- go.mod | 2 +- sarif/sarif.go | 2 +- test/report_test.go | 14 +++++++------- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index a979470..968e571 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This example is taken directly from the [Microsoft sarif pages](https://github.c ```json { "version": "2.1.0", - "$schema": "http://json.schemastore.org/sarif-2.1.0-rtm.4", + "$schema": "https://json.schemastore.org/sarif-2.1.0-rtm.5.json", "runs": [ { "tool": { diff --git a/example/main.go b/example/main.go index 8c77588..ff87598 100644 --- a/example/main.go +++ b/example/main.go @@ -6,7 +6,7 @@ import ( "os" "strings" - "github.com/shaopeng-gh/go-sarif/sarif" + "github.com/owenrumney/go-sarif/sarif" ) // simple structure for the output of tfsec diff --git a/go.mod b/go.mod index 0c3de00..7906eb1 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/shaopeng-gh/go-sarif +module github.com/owenrumney/go-sarif go 1.16 diff --git a/sarif/sarif.go b/sarif/sarif.go index 3e1edac..fa8aa83 100644 --- a/sarif/sarif.go +++ b/sarif/sarif.go @@ -15,7 +15,7 @@ type Version string const Version210 Version = "2.1.0" var versions = map[Version]string{ - Version210: "http://json.schemastore.org/sarif-2.1.0-rtm.5.json", + Version210: "https://json.schemastore.org/sarif-2.1.0-rtm.5.json", } // Report is the encapsulating type representing a Sarif Report diff --git a/test/report_test.go b/test/report_test.go index 4dabead..5bd4ccb 100644 --- a/test/report_test.go +++ b/test/report_test.go @@ -13,7 +13,7 @@ func Test_new_simple_report_with_single_run(t *testing.T) { given.a_new_report(). with_a_run_added("tfsec", "https://tfsec.dev") - then.report_text_is(`{"version":"2.1.0","$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"results":[]}]}`) + then.report_text_is(`{"version":"2.1.0","$schema":"https://json.schemastore.org/sarif-2.1.0-rtm.5.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"results":[]}]}`) } func Test_new_report_with_empty_run(t *testing.T) { @@ -21,7 +21,7 @@ func Test_new_report_with_empty_run(t *testing.T) { given.a_new_report(). with_a_run_with_empty_result_added("tfsec", "https://tfsec.dev") - then.report_text_is(`{"version":"2.1.0","$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"results":[]}]}`) + then.report_text_is(`{"version":"2.1.0","$schema":"https://json.schemastore.org/sarif-2.1.0-rtm.5.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"results":[]}]}`) } func Test_new_simple_report_with_artifact(t *testing.T) { @@ -30,7 +30,7 @@ func Test_new_simple_report_with_artifact(t *testing.T) { run := given.a_new_report(). with_a_run_added("tfsec", "https://tfsec.dev") when.an_artifact_is_added_to_the_run(run, "file://broken.go") - then.report_text_is(`{"version":"2.1.0","$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"artifacts":[{"location":{"uri":"file://broken.go"},"length":-1}],"results":[]}]}`) + then.report_text_is(`{"version":"2.1.0","$schema":"https://json.schemastore.org/sarif-2.1.0-rtm.5.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"artifacts":[{"location":{"uri":"file://broken.go"},"length":-1}],"results":[]}]}`) } func Test_new_simple_report_with_propertybag(t *testing.T) { @@ -39,7 +39,7 @@ func Test_new_simple_report_with_propertybag(t *testing.T) { run := given.a_new_report(). with_a_run_added("tfsec", "https://tfsec.dev") when.some_properties_are_added_to_the_run(run) - then.report_text_is(`{"version":"2.1.0","$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"results":[],"properties":{"integer_property":10,"string_property":"this is a string"}}]}`) + then.report_text_is(`{"version":"2.1.0","$schema":"https://json.schemastore.org/sarif-2.1.0-rtm.5.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"results":[],"properties":{"integer_property":10,"string_property":"this is a string"}}]}`) } func Test_new_simple_report_with_duplicate_artifact(t *testing.T) { @@ -50,7 +50,7 @@ func Test_new_simple_report_with_duplicate_artifact(t *testing.T) { when.an_artifact_is_added_to_the_run(run, "file://broken.go"). and(). an_artifact_is_added_to_the_run(run, "file://broken.go") - then.report_text_is(`{"version":"2.1.0","$schema":"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"artifacts":[{"location":{"uri":"file://broken.go"},"length":-1},{"location":{"uri":"file://broken.go"},"length":-1}],"results":[]}]}`) + then.report_text_is(`{"version":"2.1.0","$schema":"https://json.schemastore.org/sarif-2.1.0-rtm.5.json","runs":[{"tool":{"driver":{"name":"tfsec","informationUri":"https://tfsec.dev"}},"artifacts":[{"location":{"uri":"file://broken.go"},"length":-1},{"location":{"uri":"file://broken.go"},"length":-1}],"results":[]}]}`) } func Test_load_sarif_from_string(t *testing.T) { @@ -58,7 +58,7 @@ func Test_load_sarif_from_string(t *testing.T) { content := `{ "version": "2.1.0", - "$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json", + "$schema": "https://json.schemastore.org/sarif-2.1.0-rtm.5.json", "runs": [ { "tool": { @@ -80,7 +80,7 @@ func Test_load_sarif_report_from_file(t *testing.T) { content := `{ "version": "2.1.0", - "$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json", + "$schema": "https://json.schemastore.org/sarif-2.1.0-rtm.5.json", "runs": [ { "tool": {