Skip to content

Commit ef0b1bb

Browse files
authored
Merge pull request #254 from OpenPathfinder/feat/remove-ops
1 parent 6fdf982 commit ef0b1bb

File tree

3 files changed

+2
-58
lines changed

3 files changed

+2
-58
lines changed

__tests__/cli/__snapshots__/workflows.test.js.snap

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,27 @@ exports[`list - Non-Interactive Mode Should provide a list of available workflow
77
"isEnabled": true,
88
"isRequiredAdditionalData": false,
99
"name": "update-github-orgs",
10-
"operations": null,
1110
"workflow": [Function],
1211
},
1312
{
1413
"description": "Check the organizations stored and update/create the information related to the repositories with the GitHub API.",
1514
"isEnabled": true,
1615
"isRequiredAdditionalData": false,
1716
"name": "upsert-github-repositories",
18-
"operations": null,
1917
"workflow": [Function],
2018
},
2119
{
2220
"description": "Run all the compliance checks for the stored data.",
2321
"isEnabled": true,
2422
"isRequiredAdditionalData": false,
2523
"name": "run-all-checks",
26-
"operations": null,
2724
"workflow": [Function],
2825
},
2926
{
3027
"description": "Run a specific compliance check for the stored data.",
3128
"isEnabled": true,
3229
"isRequiredAdditionalData": true,
3330
"name": "run-one-check",
34-
"operations": null,
3531
"schema": {
3632
"$schema": "http://json-schema.org/draft-07/schema#",
3733
"additionalProperties": false,
@@ -53,7 +49,6 @@ exports[`list - Non-Interactive Mode Should provide a list of available workflow
5349
"isEnabled": false,
5450
"isRequiredAdditionalData": false,
5551
"name": "upsert-ossf-scorecard",
56-
"operations": null,
5752
"schema": {
5853
"$schema": "http://json-schema.org/draft-07/schema#",
5954
"additionalProperties": false,
@@ -75,21 +70,6 @@ exports[`list - Non-Interactive Mode Should provide a list of available workflow
7570
"isEnabled": true,
7671
"isRequiredAdditionalData": false,
7772
"name": "generate-reports",
78-
"operations": null,
79-
"workflow": [Function],
80-
},
81-
{
82-
"description": "Bulk import data into visionBoard",
83-
"isEnabled": false,
84-
"isRequiredAdditionalData": true,
85-
"name": "bulk-import",
86-
"operations": [
87-
{
88-
"description": "Load manual checks from project policies",
89-
"id": "load-manual-checks",
90-
"schema": "{"$schema":"http://json-schema.org/draft-07/schema#","title":"Bulk Import","description":"Schema for the bulk import of projects","type":"array","minItems":1,"items":{"type":"object","properties":{"type":{"type":"string","enum":["softwareDesignTraining","owaspTop10Training","defineFunctionalRoles","orgToolingMFA","softwareArchitectureDocs","MFAImpersonationDefense","includeCVEInReleaseNotes","assignCVEForKnownVulns","incidentResponsePlan","regressionTestsForVulns","vulnResponse14Days","useCVDToolForVulns","securityMdMeetsOpenJSCVD","consistentBuildProcessDocs","machineReadableDependencies","identifyModifiedDependencies","ciAndCdPipelineAsCode","npmOrgMFA","npmPublicationMFA","upgradePathDocs","patchNonCriticalVulns90Days","patchCriticalVulns30Days","twoOrMoreOwnersForAccess","injectedSecretsAtRuntime","preventScriptInjection","resolveLinterWarnings","annualDependencyRefresh"],"examples":["softwareDesignTraining"]},"project_id":{"description":"The project id","type":"integer","minimum":1,"examples":[123]},"is_subscribed":{"description":"Flag to indicate if the project is already subscribed to the policy","type":"boolean"},"description":{"description":"Project's description","type":"string","examples":["Course on software design principles done by the team"]},"implementation_status":{"description":"Implementation status of the project","type":"string","enum":["unknown","pending","completed"],"examples":["completed"]},"training_date":{"description":"Date of the training in ISO 8601 format","type":"string","format":"date-time","nullable":true,"examples":["2021-01-01T00:00:00Z"]}},"oneOf":[{"required":["type","project_id","is_subscribed"]},{"required":["type","project_id","description","implementation_status"]}],"additionalProperties":false}}",
91-
},
92-
],
9373
"workflow": [Function],
9474
},
9575
]

src/cli/workflows.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,32 @@ const _ = require('lodash')
33
const debug = require('debug')('cli:workflows')
44
const { updateGithubOrgs, upsertGithubRepositories, runAllTheComplianceChecks, runOneComplianceCheck, upsertOSSFScorecardAnalysis } = require('../workflows')
55
const { generateStaticReports } = require('../reports')
6-
const { bulkImport } = require('../importers')
76
const { logger } = require('../utils')
8-
const { executeOneCheckSchema, executeOptionalProjectSchema, bulkImportSchema } = require('../schemas')
7+
const { executeOneCheckSchema, executeOptionalProjectSchema } = require('../schemas')
98

109
const commandList = [{
1110
name: 'update-github-orgs',
1211
isRequiredAdditionalData: false,
1312
isEnabled: true,
1413
description: 'Check the organizations stored and update the information with the GitHub API.',
15-
operations: null,
1614
workflow: updateGithubOrgs
1715
}, {
1816
name: 'upsert-github-repositories',
1917
isRequiredAdditionalData: false,
2018
isEnabled: true,
2119
description: 'Check the organizations stored and update/create the information related to the repositories with the GitHub API.',
22-
operations: null,
2320
workflow: upsertGithubRepositories
2421
}, {
2522
name: 'run-all-checks',
2623
isRequiredAdditionalData: false,
2724
isEnabled: true,
2825
description: 'Run all the compliance checks for the stored data.',
29-
operations: null,
3026
workflow: runAllTheComplianceChecks
3127
}, {
3228
name: 'run-one-check',
3329
isRequiredAdditionalData: true,
3430
isEnabled: true,
3531
description: 'Run a specific compliance check for the stored data.',
36-
operations: null,
3732
schema: executeOneCheckSchema,
3833
workflow: runOneComplianceCheck
3934
}, {
@@ -42,27 +37,13 @@ const commandList = [{
4237
schema: executeOptionalProjectSchema,
4338
isEnabled: false,
4439
description: 'Upsert the OSSF Scorecard scoring by running and checking every repository in the database.',
45-
operations: null,
4640
workflow: upsertOSSFScorecardAnalysis
4741
}, {
4842
name: 'generate-reports',
4943
isRequiredAdditionalData: false,
5044
isEnabled: true,
5145
description: 'Generate the reports for the stored data.',
52-
operations: null,
5346
workflow: generateStaticReports
54-
}, {
55-
// @TODO: Move this workflow to a separate endpoint
56-
name: 'bulk-import',
57-
isRequiredAdditionalData: true,
58-
isEnabled: false,
59-
operations: [{
60-
id: 'load-manual-checks',
61-
description: 'Load manual checks from project policies',
62-
schema: JSON.stringify(bulkImportSchema)
63-
}],
64-
description: 'Bulk import data into visionBoard',
65-
workflow: bulkImport
6647
}]
6748

6849
const validCommandNames = commandList.map(({ name }) => name)
@@ -73,13 +54,12 @@ const getWorkflowsDetails = () => {
7354

7455
commandList.forEach((workflow) => {
7556
const workflowName = _.kebabCase(workflow.name)
76-
workflowsList.push({ id: workflowName, description: workflow.description, isEnabled: workflow.isEnabled, isRequiredAdditionalData: workflow.isRequiredAdditionalData, operations: workflow.operations, schema: JSON.stringify(workflow.schema) })
57+
workflowsList.push({ id: workflowName, description: workflow.description, isEnabled: workflow.isEnabled, isRequiredAdditionalData: workflow.isRequiredAdditionalData, schema: JSON.stringify(workflow.schema) })
7758
workflows[workflowName] = {
7859
description: workflow.description,
7960
workflow: workflow.workflow,
8061
isEnabled: workflow.isEnabled,
8162
isRequiredAdditionalData: workflow.isRequiredAdditionalData,
82-
operations: workflow.operations,
8363
schema: JSON.stringify(workflow.schema)
8464
}
8565
})

src/httpServer/swagger/api-v1.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -507,22 +507,6 @@ components:
507507
schema:
508508
type: string
509509
description: JSO Schema for the data required for the workflow
510-
operations:
511-
type: array
512-
nullable: true
513-
items:
514-
type: object
515-
additionalProperties: false
516-
properties:
517-
id:
518-
type: string
519-
example: example-operation
520-
description:
521-
type: string
522-
example: This is an example operation
523-
schema:
524-
type: string
525-
description: JSON Schema for the operation
526510
required:
527511
- id
528512
- description

0 commit comments

Comments
 (0)