Fix logging formatting and update logs

This commit is contained in:
Michael Hohn
2024-02-21 11:59:32 -08:00
committed by =Michael Hohn
parent 26e2aa28e7
commit 22fba84261
6 changed files with 1712 additions and 1540 deletions

View File

@@ -135,10 +135,7 @@
3. Submit the mrva job
#+BEGIN_SRC sh
cd ~/local/gh-mrva
./gh-mrva submit --help
./gh-mrva submit --language cpp --session mirva-session-71 \
./gh-mrva submit --language cpp --session mirva-session-73 \
--list mirva-list \
--query /Users/hohn/local/gh-mrva/FlatBuffersFunc.ql
#+END_SRC
@@ -148,16 +145,16 @@
cd ~/local/gh-mrva
# Check the status
./gh-mrva status --session mirva-session-71
./gh-mrva status --session mirva-session-73
# Download the sarif files when finished
./gh-mrva download --session mirva-session-71 \
--output-dir mirva-session-71
./gh-mrva download --session mirva-session-73 \
--output-dir mirva-session-73
# Download the sarif files and CodeQL dbs when finished
./gh-mrva download --session mirva-session-71 \
./gh-mrva download --session mirva-session-73 \
--download-dbs \
--output-dir mirva-session-71
--output-dir mirva-session-73
#+END_SRC
* Miscellaneous Notes

File diff suppressed because it is too large Load Diff

169
log-status-71-1.log Normal file
View File

@@ -0,0 +1,169 @@
# Check the status
./gh-mrva status --session mirva-session-73
hohn@gh-hohn:~/local/gh-mrva
0:$ 2024/02/21 11:56:46 >> GET https://api.github.com/repos/hohn/mirva-controller/code-scanning/codeql/variant-analyses/9165
2024/02/21 11:56:47 << 200 https://api.github.com/repos/hohn/mirva-controller/code-scanning/codeql/variant-analyses/9165
2024/02/21 11:56:47 >> response body: {
{
"id": 9165,
"controller_repo": {
"id": 747492529,
"node_id": "R_kgDOLI3UsQ",
"name": "mirva-controller",
"full_name": "hohn/mirva-controller",
"private": false,
"owner": {
"login": "hohn",
"id": 2253228,
"node_id": "MDQ6VXNlcjIyNTMyMjg=",
"avatar_url": "https://avatars.githubusercontent.com/u/2253228?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hohn",
"html_url": "https://github.com/hohn",
"followers_url": "https://api.github.com/users/hohn/followers",
"following_url": "https://api.github.com/users/hohn/following{/other_user}",
"gists_url": "https://api.github.com/users/hohn/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hohn/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hohn/subscriptions",
"organizations_url": "https://api.github.com/users/hohn/orgs",
"repos_url": "https://api.github.com/users/hohn/repos",
"events_url": "https://api.github.com/users/hohn/events{/privacy}",
"received_events_url": "https://api.github.com/users/hohn/received_events",
"type": "User",
"site_admin": true
},
"html_url": "https://github.com/hohn/mirva-controller",
"description": "Controller for MRVA",
"fork": false,
"url": "https://api.github.com/repos/hohn/mirva-controller",
"forks_url": "https://api.github.com/repos/hohn/mirva-controller/forks",
"keys_url": "https://api.github.com/repos/hohn/mirva-controller/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/hohn/mirva-controller/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/hohn/mirva-controller/teams",
"hooks_url": "https://api.github.com/repos/hohn/mirva-controller/hooks",
"issue_events_url": "https://api.github.com/repos/hohn/mirva-controller/issues/events{/number}",
"events_url": "https://api.github.com/repos/hohn/mirva-controller/events",
"assignees_url": "https://api.github.com/repos/hohn/mirva-controller/assignees{/user}",
"branches_url": "https://api.github.com/repos/hohn/mirva-controller/branches{/branch}",
"tags_url": "https://api.github.com/repos/hohn/mirva-controller/tags",
"blobs_url": "https://api.github.com/repos/hohn/mirva-controller/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/hohn/mirva-controller/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/hohn/mirva-controller/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/hohn/mirva-controller/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/hohn/mirva-controller/statuses/{sha}",
"languages_url": "https://api.github.com/repos/hohn/mirva-controller/languages",
"stargazers_url": "https://api.github.com/repos/hohn/mirva-controller/stargazers",
"contributors_url": "https://api.github.com/repos/hohn/mirva-controller/contributors",
"subscribers_url": "https://api.github.com/repos/hohn/mirva-controller/subscribers",
"subscription_url": "https://api.github.com/repos/hohn/mirva-controller/subscription",
"commits_url": "https://api.github.com/repos/hohn/mirva-controller/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/hohn/mirva-controller/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/hohn/mirva-controller/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/hohn/mirva-controller/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/hohn/mirva-controller/contents/{+path}",
"compare_url": "https://api.github.com/repos/hohn/mirva-controller/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/hohn/mirva-controller/merges",
"archive_url": "https://api.github.com/repos/hohn/mirva-controller/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/hohn/mirva-controller/downloads",
"issues_url": "https://api.github.com/repos/hohn/mirva-controller/issues{/number}",
"pulls_url": "https://api.github.com/repos/hohn/mirva-controller/pulls{/number}",
"milestones_url": "https://api.github.com/repos/hohn/mirva-controller/milestones{/number}",
"notifications_url": "https://api.github.com/repos/hohn/mirva-controller/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/hohn/mirva-controller/labels{/name}",
"releases_url": "https://api.github.com/repos/hohn/mirva-controller/releases{/id}",
"deployments_url": "https://api.github.com/repos/hohn/mirva-controller/deployments"
},
"actor": {
"login": "hohn",
"id": 2253228,
"node_id": "MDQ6VXNlcjIyNTMyMjg=",
"avatar_url": "https://avatars.githubusercontent.com/u/2253228?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hohn",
"html_url": "https://github.com/hohn",
"followers_url": "https://api.github.com/users/hohn/followers",
"following_url": "https://api.github.com/users/hohn/following{/other_user}",
"gists_url": "https://api.github.com/users/hohn/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hohn/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hohn/subscriptions",
"organizations_url": "https://api.github.com/users/hohn/orgs",
"repos_url": "https://api.github.com/users/hohn/repos",
"events_url": "https://api.github.com/users/hohn/events{/privacy}",
"received_events_url": "https://api.github.com/users/hohn/received_events",
"type": "User",
"site_admin": true
},
"query_language": "cpp",
"query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/9165/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20240221%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240221T195649Z&X-Amz-Expires=3600&X-Amz-Signature=5b903cef385dd07480226cfbf397fa36f9226d0e4f21e29aa5b2a66b5ed5c431&X-Amz-SignedHeaders=host",
"created_at": "2024-02-21T19:55:46Z",
"updated_at": "2024-02-21T19:55:47Z",
"actions_workflow_run_id": 7994786107,
"completed_at": "2024-02-21T19:56:31Z",
"status": "succeeded",
"scanned_repositories": [
{
"repository": {
"id": 7730829,
"name": "psycopg2",
"full_name": "psycopg/psycopg2",
"private": false,
"stargazers_count": 3153,
"updated_at": "2024-02-19T19:55:17Z"
},
"analysis_status": "succeeded",
"result_count": 1,
"artifact_size_in_bytes": 3703
},
{
"repository": {
"id": 19953044,
"name": "flatbuffers",
"full_name": "google/flatbuffers",
"private": false,
"stargazers_count": 21765,
"updated_at": "2024-02-21T18:58:59Z"
},
"analysis_status": "succeeded",
"result_count": 1,
"artifact_size_in_bytes": 1327
}
],
"skipped_repositories": {
"access_mismatch_repos": {
"repository_count": 0,
"repositories": []
},
"not_found_repos": {
"repository_count": 0,
"repository_full_names": []
},
"no_codeql_db_repos": {
"repository_count": 0,
"repositories": []
},
"over_limit_repos": {
"repository_count": 0,
"repositories": []
}
}
}
}
Run name: mirva-session-73
Status: succeeded
Total runs: 1
Total successful scans: 2
Total failed scans: 0
Total skipped repositories: 0
Total skipped repositories due to access mismatch: 0
Total skipped repositories due to not found: 0
Total skipped repositories due to no database: 0
Total skipped repositories due to over limit: 0
Total repositories with findings: 2
Total findings: 2
Repositories with findings:
psycopg/psycopg2 (cpp-flatbuffer-func): 1
google/flatbuffers (cpp-flatbuffer-func): 1
hohn@gh-hohn:~/local/gh-mrva
0:$ hohn@gh-hohn:~/local/gh-mrva
0:$

View File

@@ -1,12 +1,12 @@
# Check the status
./gh-mrva status --session mirva-session-71
./gh-mrva status --session mirva-session-73
hohn@gh-hohn:~/local/gh-mrva
0:$ 2024/02/21 11:26:12 >> GET https://api.github.com/repos/hohn/mirva-controller/code-scanning/codeql/variant-analyses/9163
2024/02/21 11:26:12 << 200 https://api.github.com/repos/hohn/mirva-controller/code-scanning/codeql/variant-analyses/9163
2024/02/21 11:26:12 >> response body: {
0:$ 2024/02/21 11:56:21 >> GET https://api.github.com/repos/hohn/mirva-controller/code-scanning/codeql/variant-analyses/9165
2024/02/21 11:56:21 << 200 https://api.github.com/repos/hohn/mirva-controller/code-scanning/codeql/variant-analyses/9165
2024/02/21 11:56:21 >> response body: {
{
"id": 9163,
"id": 9165,
"controller_repo": {
"id": 747492529,
"node_id": "R_kgDOLI3UsQ",
@@ -95,12 +95,11 @@ hohn@gh-hohn:~/local/gh-mrva
"site_admin": true
},
"query_language": "cpp",
"query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/9163/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20240221%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240221T192614Z&X-Amz-Expires=3600&X-Amz-Signature=d617edda4abf688ac965e241824e8aa20e3ac9e315ce4f98909a13f79760b3eb&X-Amz-SignedHeaders=host",
"created_at": "2024-02-21T19:24:40Z",
"updated_at": "2024-02-21T19:24:41Z",
"actions_workflow_run_id": 7994456372,
"completed_at": "2024-02-21T19:25:20Z",
"status": "succeeded",
"query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/9165/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20240221%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240221T195623Z&X-Amz-Expires=3600&X-Amz-Signature=f536a871818d8204ec12bb100c3a9cdbb06727b6da529e456d1e0d10dc468099&X-Amz-SignedHeaders=host",
"created_at": "2024-02-21T19:55:46Z",
"updated_at": "2024-02-21T19:55:47Z",
"actions_workflow_run_id": 7994786107,
"status": "in_progress",
"scanned_repositories": [
{
"repository": {
@@ -124,9 +123,7 @@ hohn@gh-hohn:~/local/gh-mrva
"stargazers_count": 21765,
"updated_at": "2024-02-21T18:58:59Z"
},
"analysis_status": "succeeded",
"result_count": 1,
"artifact_size_in_bytes": 1326
"analysis_status": "in_progress"
}
],
"skipped_repositories": {
@@ -149,21 +146,20 @@ hohn@gh-hohn:~/local/gh-mrva
}
}
}
Run name: mirva-session-71
Status: succeeded
Run name: mirva-session-73
Status: in_progress
Total runs: 1
Total successful scans: 2
Total successful scans: 1
Total failed scans: 0
Total skipped repositories: 0
Total skipped repositories due to access mismatch: 0
Total skipped repositories due to not found: 0
Total skipped repositories due to no database: 0
Total skipped repositories due to over limit: 0
Total repositories with findings: 2
Total findings: 2
Total repositories with findings: 1
Total findings: 1
Repositories with findings:
psycopg/psycopg2 (cpp-flatbuffer-func): 1
google/flatbuffers (cpp-flatbuffer-func): 1
hohn@gh-hohn:~/local/gh-mrva
0:$ hohn@gh-hohn:~/local/gh-mrva
0:$

File diff suppressed because it is too large Load Diff

12
main.go
View File

@@ -153,10 +153,15 @@ func LogBody(body io.ReadCloser, from string) io.ReadCloser {
// Print index for encoded query packs in the json <value>:
// {..."query_pack": <value>,...}
log.Printf(">> %s body:\n", from)
log.Printf(">> %s body: {\n", from)
log.Printf(" \"%s\": \"%s\"\n", "action_repo_ref", m.ActionRepoRef)
log.Printf(" \"%s\": \"%s\"\n", "language", m.Language)
log.Printf(" \"%s\": \"%s\"\n", "repositories", m.Repositories[:])
pjson, err := json.MarshalIndent(m.Repositories, "", " ")
if err != nil {
log.Printf(" \"%s\": \"%s\"\n", "repositories", m.Repositories[:])
} else {
log.Printf(" \"%s\": %s\n", "repositories", pjson)
}
// Provide custom logging for encoded, compressed tar file
if IsBase64Gzip([]byte(m.QueryPack)) {
@@ -164,6 +169,9 @@ func LogBody(body io.ReadCloser, from string) io.ReadCloser {
} else {
log.Printf(" \"%s\": \"%s\"\n", "query_pack", m.QueryPack)
}
log.Printf("\n}")
} else {
log.Printf(">> %s body: %v", from, string(buf))
}