From 2207165b68a9da78fc1e42567143f99d6f6ac56b Mon Sep 17 00:00:00 2001 From: Carsten Hoffmann Date: Sun, 10 Oct 2021 17:54:13 +0200 Subject: [PATCH] feat: adds a query parameter to load a file from an url on startup --- README.adoc | 6 ++--- src/components/DataInput.vue | 30 +++++++++++++++++----- src/components/ReportUrlFetcher.vue | 40 +++++++++++++++++++---------- src/router/index.ts | 1 + src/views/Home.vue | 8 ++++-- 5 files changed, 59 insertions(+), 26 deletions(-) diff --git a/README.adoc b/README.adoc index 22888ca3..0aec4972 100644 --- a/README.adoc +++ b/README.adoc @@ -23,13 +23,13 @@ The data never leaves your browser, because all processing is handled inside you If you are using a GitLab Job to generate the Trivy report, you can supply a direct URL to the json file. The app will fetch the report and display the results without the hassle to first download the file. You might need to provide a token for authentication, you can do that by clicking the shield symbol next to the URL field. Make sure to create a personal access token with the scope `read_api`. The token will be persisted in the local storage, so that you can reuse it the next time you want to load a report from the same GitLab instance. -It is a good idea to print the URL of the artifact at the end of the job log, so that it can be grabbed easily. If the name of the report is `trivy-results.json`, the url schema would look like this: +You can pass a query parameter `url` to the app, and it will load a file from this url on startup. It is a good idea to print the URL of the vulnerability explorer at the end of the job log, so that the user can jump directly to the vulnerability report. If the name of the report is `trivy-results.json`, the url schema would look like this: ---- -https://$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/jobs/$CI_JOB_ID/artifacts/trivy-results.json +https://dbsystel.github.io/trivy-vulnerability-explorer?url=https://$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/jobs/$CI_JOB_ID/artifacts/trivy-results.json ---- -NOTE: While the feature was built having GitLab in mind, it should work for every artifact storage, where the json can be downloaded with a GET http request that needs at most a single HTTP header for authentication. +NOTE: While the feature was built having GitLab in mind, it should work for every artifact storage, where the json can be downloaded with a GET HTTP request that needs at most a single HTTP header for authentication. == Contribute diff --git a/src/components/DataInput.vue b/src/components/DataInput.vue index 8cfe8104..2f8bb3cb 100644 --- a/src/components/DataInput.vue +++ b/src/components/DataInput.vue @@ -1,13 +1,13 @@