@backstage-community/plugin-blackduck-backend 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/service/router.cjs.js +49 -0
- package/dist/service/router.cjs.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @backstage-community/plugin-blackduck-backend
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 25fa4bf: Implemented BlackDuckAllVersionPage to support multiple versions in Blackduck page
|
|
8
|
+
- Updated dependencies [25fa4bf]
|
|
9
|
+
- @backstage-community/plugin-blackduck-node@0.2.1
|
|
10
|
+
|
|
3
11
|
## 0.5.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -131,6 +131,55 @@ async function createRouter(options) {
|
|
|
131
131
|
response.json(vulns);
|
|
132
132
|
}
|
|
133
133
|
);
|
|
134
|
+
router.post(
|
|
135
|
+
"/project-versions/:hostKey/:projectName",
|
|
136
|
+
async (_request, response) => {
|
|
137
|
+
const { hostKey, projectName } = _request.params;
|
|
138
|
+
const credentials = await httpAuth.credentials(_request);
|
|
139
|
+
const entityRef = _request.body.entityRef;
|
|
140
|
+
logger.info(`getting versions for the project: ${projectName}`);
|
|
141
|
+
if (typeof entityRef !== "string") {
|
|
142
|
+
throw new errors.InputError("Invalid entityRef, not a string");
|
|
143
|
+
}
|
|
144
|
+
if (!hostKey || !projectName) {
|
|
145
|
+
response.status(400).json({
|
|
146
|
+
message: "The hostKey, projectName and projectVersion are required"
|
|
147
|
+
});
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
let host;
|
|
151
|
+
let token;
|
|
152
|
+
try {
|
|
153
|
+
const hostConfig = blackDuckConfig.getHostConfigByName(hostKey);
|
|
154
|
+
host = hostConfig.host;
|
|
155
|
+
token = hostConfig.token;
|
|
156
|
+
} catch (error) {
|
|
157
|
+
response.status(400).json({
|
|
158
|
+
message: "The hostKey is not valid."
|
|
159
|
+
});
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const decision = (await permissions.authorize(
|
|
163
|
+
[
|
|
164
|
+
{
|
|
165
|
+
permission: pluginBlackduckCommon.blackduckVulnerabilitiesReadPermission,
|
|
166
|
+
resourceRef: entityRef
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
{
|
|
170
|
+
credentials
|
|
171
|
+
}
|
|
172
|
+
))[0];
|
|
173
|
+
logger.info("decision", decision);
|
|
174
|
+
if (decision.result !== pluginPermissionCommon.AuthorizeResult.ALLOW) {
|
|
175
|
+
throw new errors.NotAllowedError("Unauthorized");
|
|
176
|
+
}
|
|
177
|
+
const blackDuck = new pluginBlackduckNode.BlackDuckRestApi(logger, host, token);
|
|
178
|
+
await blackDuck.auth();
|
|
179
|
+
const versions = await blackDuck.getProjectVersions(projectName);
|
|
180
|
+
response.json(versions);
|
|
181
|
+
}
|
|
182
|
+
);
|
|
134
183
|
router.use(middleware.error());
|
|
135
184
|
return router;
|
|
136
185
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.cjs.js","sources":["../../src/service/router.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter';\nimport {\n DiscoveryService,\n HttpAuthService,\n LoggerService,\n PermissionsService,\n} from '@backstage/backend-plugin-api';\nimport { Config } from '@backstage/config';\nimport express from 'express';\nimport Router from 'express-promise-router';\nimport { createPermissionIntegrationRouter } from '@backstage/plugin-permission-node';\nimport { InputError, NotAllowedError } from '@backstage/errors';\nimport { AuthorizeResult } from '@backstage/plugin-permission-common';\nimport {\n blackduckPermissions,\n blackduckRiskProfileReadPermission,\n blackduckVulnerabilitiesReadPermission,\n} from '@backstage-community/plugin-blackduck-common';\nimport {\n BlackDuckRestApi,\n BlackDuckConfig,\n} from '@backstage-community/plugin-blackduck-node';\n\n/** @internal */\nexport interface RouterOptions {\n logger: LoggerService;\n config: Config;\n permissions: PermissionsService;\n discovery: DiscoveryService;\n httpAuth: HttpAuthService;\n blackDuckConfig: BlackDuckConfig;\n}\n\n/** @internal */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const { logger, permissions, config, blackDuckConfig, httpAuth } = options;\n const permissionIntegrationRouter = createPermissionIntegrationRouter({\n permissions: blackduckPermissions,\n });\n\n const router = Router();\n router.use(express.json());\n router.use(permissionIntegrationRouter);\n\n router.get('/health', (_, response) => {\n logger.info('PONG!');\n response.json({ status: 'ok' });\n });\n\n const middleware = MiddlewareFactory.create({ logger, config });\n\n router.post(\n '/risk-profile/:hostKey/:projectName/:projectVersion',\n async (_request, response) => {\n logger.debug('getting vulnarabilities..');\n const { hostKey, projectName, projectVersion } = _request.params;\n\n if (!hostKey || !projectName || !projectVersion) {\n response.status(400).json({\n message: 'The hostKey, projectName and projectVersion are required',\n });\n return;\n }\n\n let host: string;\n let token: string;\n\n try {\n const hostConfig = blackDuckConfig.getHostConfigByName(hostKey);\n host = hostConfig.host;\n token = hostConfig.token;\n } catch (error) {\n response.status(400).json({\n message: 'The hostKey is not valid.',\n });\n return;\n }\n\n const credentials = await httpAuth.credentials(_request);\n const entityRef = _request.body.entityRef;\n logger.info('getting risk profile for project: ', entityRef);\n if (typeof entityRef !== 'string') {\n throw new InputError('Invalid entityRef, not a string');\n }\n\n const decision = (\n await permissions.authorize(\n [\n {\n permission: blackduckRiskProfileReadPermission,\n resourceRef: entityRef,\n },\n ],\n {\n credentials,\n },\n )\n )[0];\n\n if (decision.result !== AuthorizeResult.ALLOW) {\n throw new NotAllowedError('Unauthorized');\n }\n\n const blackDuck = new BlackDuckRestApi(logger, host, token);\n\n await blackDuck.auth();\n const risk_profile = await blackDuck.getRiskProfile(\n projectName,\n projectVersion,\n );\n response.json(risk_profile);\n },\n );\n\n router.post(\n '/vulns/:hostKey/:projectName/:projectVersion',\n async (_request, response) => {\n const { hostKey, projectName, projectVersion } = _request.params;\n const credentials = await httpAuth.credentials(_request);\n const entityRef = _request.body.entityRef;\n logger.info('getting vulnarabilities for project: ', entityRef);\n if (typeof entityRef !== 'string') {\n throw new InputError('Invalid entityRef, not a string');\n }\n\n if (!hostKey || !projectName || !projectVersion) {\n response.status(400).json({\n message: 'The hostKey, projectName and projectVersion are required',\n });\n return;\n }\n\n let host: string;\n let token: string;\n\n try {\n const hostConfig = blackDuckConfig.getHostConfigByName(hostKey);\n host = hostConfig.host;\n token = hostConfig.token;\n } catch (error) {\n response.status(400).json({\n message: 'The hostKey is not valid.',\n });\n return;\n }\n\n const decision = (\n await permissions.authorize(\n [\n {\n permission: blackduckVulnerabilitiesReadPermission,\n resourceRef: entityRef,\n },\n ],\n {\n credentials,\n },\n )\n )[0];\n logger.info('decision', decision);\n if (decision.result !== AuthorizeResult.ALLOW) {\n throw new NotAllowedError('Unauthorized');\n }\n\n const blackDuck = new BlackDuckRestApi(logger, host, token);\n\n await blackDuck.auth();\n const vulns = await blackDuck.getVulnerableComponents(\n projectName,\n projectVersion,\n );\n response.json(vulns);\n },\n );\n\n router.use(middleware.error());\n return router;\n}\n"],"names":["createPermissionIntegrationRouter","blackduckPermissions","Router","express","MiddlewareFactory","InputError","blackduckRiskProfileReadPermission","AuthorizeResult","NotAllowedError","BlackDuckRestApi","blackduckVulnerabilitiesReadPermission"],"mappings":";;;;;;;;;;;;;;;;AAiDA,eAAsB,aACpB,OACyB,EAA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AA,MAAM,SAAY,GAAA,IAAIC,oCAAiB,CAAA,MAAA,EAAQ,MAAM,KAAK,CAAA;AAE1D,MAAA,MAAM,UAAU,IAAK,EAAA;AACrB,MAAM,MAAA,KAAA,GAAQ,MAAM,SAAU,CAAA,uBAAA;AAAA,QAC5B,WAAA;AAAA,QACA;AAAA,OACF;AACA,MAAA,QAAA,CAAS,KAAK,KAAK,CAAA;AAAA;AACrB,GACF;AAEA,EAAO,MAAA,CAAA,GAAA,CAAI,UAAW,CAAA,KAAA,EAAO,CAAA;AAC7B,EAAO,OAAA,MAAA;AACT;;;;"}
|
|
1
|
+
{"version":3,"file":"router.cjs.js","sources":["../../src/service/router.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter';\nimport {\n DiscoveryService,\n HttpAuthService,\n LoggerService,\n PermissionsService,\n} from '@backstage/backend-plugin-api';\nimport { Config } from '@backstage/config';\nimport express from 'express';\nimport Router from 'express-promise-router';\nimport { createPermissionIntegrationRouter } from '@backstage/plugin-permission-node';\nimport { InputError, NotAllowedError } from '@backstage/errors';\nimport { AuthorizeResult } from '@backstage/plugin-permission-common';\nimport {\n blackduckPermissions,\n blackduckRiskProfileReadPermission,\n blackduckVulnerabilitiesReadPermission,\n} from '@backstage-community/plugin-blackduck-common';\nimport {\n BlackDuckRestApi,\n BlackDuckConfig,\n} from '@backstage-community/plugin-blackduck-node';\n\n/** @internal */\nexport interface RouterOptions {\n logger: LoggerService;\n config: Config;\n permissions: PermissionsService;\n discovery: DiscoveryService;\n httpAuth: HttpAuthService;\n blackDuckConfig: BlackDuckConfig;\n}\n\n/** @internal */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const { logger, permissions, config, blackDuckConfig, httpAuth } = options;\n const permissionIntegrationRouter = createPermissionIntegrationRouter({\n permissions: blackduckPermissions,\n });\n\n const router = Router();\n router.use(express.json());\n router.use(permissionIntegrationRouter);\n\n router.get('/health', (_, response) => {\n logger.info('PONG!');\n response.json({ status: 'ok' });\n });\n\n const middleware = MiddlewareFactory.create({ logger, config });\n\n router.post(\n '/risk-profile/:hostKey/:projectName/:projectVersion',\n async (_request, response) => {\n logger.debug('getting vulnarabilities..');\n const { hostKey, projectName, projectVersion } = _request.params;\n\n if (!hostKey || !projectName || !projectVersion) {\n response.status(400).json({\n message: 'The hostKey, projectName and projectVersion are required',\n });\n return;\n }\n\n let host: string;\n let token: string;\n\n try {\n const hostConfig = blackDuckConfig.getHostConfigByName(hostKey);\n host = hostConfig.host;\n token = hostConfig.token;\n } catch (error) {\n response.status(400).json({\n message: 'The hostKey is not valid.',\n });\n return;\n }\n\n const credentials = await httpAuth.credentials(_request);\n const entityRef = _request.body.entityRef;\n logger.info('getting risk profile for project: ', entityRef);\n if (typeof entityRef !== 'string') {\n throw new InputError('Invalid entityRef, not a string');\n }\n\n const decision = (\n await permissions.authorize(\n [\n {\n permission: blackduckRiskProfileReadPermission,\n resourceRef: entityRef,\n },\n ],\n {\n credentials,\n },\n )\n )[0];\n\n if (decision.result !== AuthorizeResult.ALLOW) {\n throw new NotAllowedError('Unauthorized');\n }\n\n const blackDuck = new BlackDuckRestApi(logger, host, token);\n\n await blackDuck.auth();\n const risk_profile = await blackDuck.getRiskProfile(\n projectName,\n projectVersion,\n );\n response.json(risk_profile);\n },\n );\n\n router.post(\n '/vulns/:hostKey/:projectName/:projectVersion',\n async (_request, response) => {\n const { hostKey, projectName, projectVersion } = _request.params;\n const credentials = await httpAuth.credentials(_request);\n const entityRef = _request.body.entityRef;\n logger.info('getting vulnarabilities for project: ', entityRef);\n if (typeof entityRef !== 'string') {\n throw new InputError('Invalid entityRef, not a string');\n }\n\n if (!hostKey || !projectName || !projectVersion) {\n response.status(400).json({\n message: 'The hostKey, projectName and projectVersion are required',\n });\n return;\n }\n\n let host: string;\n let token: string;\n\n try {\n const hostConfig = blackDuckConfig.getHostConfigByName(hostKey);\n host = hostConfig.host;\n token = hostConfig.token;\n } catch (error) {\n response.status(400).json({\n message: 'The hostKey is not valid.',\n });\n return;\n }\n\n const decision = (\n await permissions.authorize(\n [\n {\n permission: blackduckVulnerabilitiesReadPermission,\n resourceRef: entityRef,\n },\n ],\n {\n credentials,\n },\n )\n )[0];\n logger.info('decision', decision);\n if (decision.result !== AuthorizeResult.ALLOW) {\n throw new NotAllowedError('Unauthorized');\n }\n\n const blackDuck = new BlackDuckRestApi(logger, host, token);\n\n await blackDuck.auth();\n const vulns = await blackDuck.getVulnerableComponents(\n projectName,\n projectVersion,\n );\n response.json(vulns);\n },\n );\n\n router.post(\n '/project-versions/:hostKey/:projectName',\n async (_request, response) => {\n const { hostKey, projectName } = _request.params;\n const credentials = await httpAuth.credentials(_request);\n const entityRef = _request.body.entityRef;\n logger.info(`getting versions for the project: ${projectName}`);\n if (typeof entityRef !== 'string') {\n throw new InputError('Invalid entityRef, not a string');\n }\n\n if (!hostKey || !projectName) {\n response.status(400).json({\n message: 'The hostKey, projectName and projectVersion are required',\n });\n return;\n }\n\n let host: string;\n let token: string;\n\n try {\n const hostConfig = blackDuckConfig.getHostConfigByName(hostKey);\n host = hostConfig.host;\n token = hostConfig.token;\n } catch (error) {\n response.status(400).json({\n message: 'The hostKey is not valid.',\n });\n return;\n }\n\n const decision = (\n await permissions.authorize(\n [\n {\n permission: blackduckVulnerabilitiesReadPermission,\n resourceRef: entityRef,\n },\n ],\n {\n credentials,\n },\n )\n )[0];\n logger.info('decision', decision);\n if (decision.result !== AuthorizeResult.ALLOW) {\n throw new NotAllowedError('Unauthorized');\n }\n\n const blackDuck = new BlackDuckRestApi(logger, host, token);\n\n await blackDuck.auth();\n const versions = await blackDuck.getProjectVersions(projectName);\n response.json(versions);\n },\n );\n\n router.use(middleware.error());\n return router;\n}\n"],"names":["createPermissionIntegrationRouter","blackduckPermissions","Router","express","MiddlewareFactory","InputError","blackduckRiskProfileReadPermission","AuthorizeResult","NotAllowedError","BlackDuckRestApi","blackduckVulnerabilitiesReadPermission"],"mappings":";;;;;;;;;;;;;;;;AAiDA,eAAsB,aACpB,OACyB,EAAA;AACzB,EAAA,MAAM,EAAE,MAAQ,EAAA,WAAA,EAAa,MAAQ,EAAA,eAAA,EAAiB,UAAa,GAAA,OAAA;AACnE,EAAA,MAAM,8BAA8BA,sDAAkC,CAAA;AAAA,IACpE,WAAa,EAAAC;AAAA,GACd,CAAA;AAED,EAAA,MAAM,SAASC,uBAAO,EAAA;AACtB,EAAO,MAAA,CAAA,GAAA,CAAIC,wBAAQ,CAAA,IAAA,EAAM,CAAA;AACzB,EAAA,MAAA,CAAO,IAAI,2BAA2B,CAAA;AAEtC,EAAA,MAAA,CAAO,GAAI,CAAA,SAAA,EAAW,CAAC,CAAA,EAAG,QAAa,KAAA;AACrC,IAAA,MAAA,CAAO,KAAK,OAAO,CAAA;AACnB,IAAA,QAAA,CAAS,IAAK,CAAA,EAAE,MAAQ,EAAA,IAAA,EAAM,CAAA;AAAA,GAC/B,CAAA;AAED,EAAA,MAAM,aAAaC,gCAAkB,CAAA,MAAA,CAAO,EAAE,MAAA,EAAQ,QAAQ,CAAA;AAE9D,EAAO,MAAA,CAAA,IAAA;AAAA,IACL,qDAAA;AAAA,IACA,OAAO,UAAU,QAAa,KAAA;AAC5B,MAAA,MAAA,CAAO,MAAM,2BAA2B,CAAA;AACxC,MAAA,MAAM,EAAE,OAAA,EAAS,WAAa,EAAA,cAAA,KAAmB,QAAS,CAAA,MAAA;AAE1D,MAAA,IAAI,CAAC,OAAA,IAAW,CAAC,WAAA,IAAe,CAAC,cAAgB,EAAA;AAC/C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
+
"version": "0.5.1",
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@backstage-community/plugin-blackduck-common": "^0.4.0",
|
|
41
|
-
"@backstage-community/plugin-blackduck-node": "^0.2.
|
|
41
|
+
"@backstage-community/plugin-blackduck-node": "^0.2.1",
|
|
42
42
|
"@backstage/backend-defaults": "^0.9.0",
|
|
43
43
|
"@backstage/backend-plugin-api": "^1.3.0",
|
|
44
44
|
"@backstage/config": "^1.3.2",
|