Skip to content

Commit 4a69f09

Browse files
authored
Deployment instructions
1 parent 285bdc9 commit 4a69f09

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

FindingsDetails.gs

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,30 @@
33
* via GraphQL API and
44
* put them in a Google Sheet
55
*
6-
* NOTE: to change the number of results, manually change the values in "variables" on line 59
6+
* NOTE: to change the number of results,
7+
* change the values in "variables" on line 72 or
8+
* change the query on line 55
9+
*
10+
* DEPLOYMENT
11+
* 1. At https://docs.google.com/spreadsheets create a new Sheet
12+
* 2. In the Sheet, go to "Extensions" > "App Script"
13+
* 3. Create a new App Script using the contents of this file
14+
* 5. In Project Settings: Script Properties, click "Add script property"
15+
* 5.1. In https://app.boostsecurity.io/settings?tab=Application+Keys generate a key
16+
* 5.2. Set: Property = apiKey, Value = [key generate in previous step]
17+
* 6. Click "Deploy" > "New Deployment" and "Select type" > "Library". Click "Deploy"
18+
* 7. Click "Run"
19+
* To run automatically, create a trigger per https://developers.google.com/apps-script/guides/triggers/installable#managing_triggers_manually
720
*/
821

922
/**
1023
* Global Constants
1124
*/
25+
const SHEET_NAME = "BoostSecurity Finding Details";
26+
const HEADERS = ["Finding ID", "Rule Name", "Scanner", "Suppression(s)", "URL"];
1227
const API_URL = "https://api.boostsecurity.io/findings-view/graphql";
1328
const API_KEY = PropertiesService.getScriptProperties().getProperty("apiKey");
1429
const AUTHORIZATION_HEADER = "ApiKey " + API_KEY;
15-
const SHEET_NAME = "BoostSecurity Finding Details";
16-
const HEADERS = ["Finding ID", "Rule Name", "Scanner", "Suppression(s)", "URL"];
1730

1831
/**
1932
* Prepare the GraphQL query
@@ -63,6 +76,16 @@ function prepareQuery() {
6376
});
6477
}
6578

79+
/**
80+
* MAIN function to get all findings
81+
*/
82+
function getAllFindings() {
83+
let graphqlQuery = prepareQuery();
84+
let response = fetchData(graphqlQuery);
85+
let findings = parseResponse(response);
86+
displayFindings(findings);
87+
}
88+
6689
/**
6790
* Fetch data from the API
6891
* @param {string} query - The GraphQL query to send to the API
@@ -137,13 +160,3 @@ function displayFindings(boostSecurityFindings) {
137160
console.error("No findings to display");
138161
}
139162
}
140-
141-
/**
142-
* Main function to get all findings
143-
*/
144-
function getAllFindings() {
145-
let graphqlQuery = prepareQuery();
146-
let response = fetchData(graphqlQuery);
147-
let findings = parseResponse(response);
148-
displayFindings(findings);
149-
}

0 commit comments

Comments
 (0)