Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3cbb66b
Remove abstract metric providers, left only openssf metric provider a…
alizard0 Feb 10, 2026
4c4db46
fixed calculateMetric signature to receive entity as expected by the …
alizard0 Feb 10, 2026
b621e10
Merge branch 'main' into RHIDP-12106
alizard0 Feb 10, 2026
8d0afbd
add component for testing the new baseUrl annotation for openssf scor…
alizard0 Feb 11, 2026
2f23269
add exclude metric for openssf
alizard0 Feb 17, 2026
d8eaa6f
Merge branch 'main' into RHIDP-12183
alizard0 Feb 25, 2026
0152c57
renamed baseUrl to scorecard-location
alizard0 Feb 25, 2026
aea0d64
rename annotation excludeChecks to exclude-checks
alizard0 Feb 25, 2026
7a7647a
Merge branch 'main' into RHIDP-12183
alizard0 Feb 25, 2026
b3b73b4
rollback component name to openssf-scorecard-only
alizard0 Feb 25, 2026
80a7a99
fix unit tests
alizard0 Feb 25, 2026
84b2172
fix the issue where the exclude-checks is compsoed by a string instea…
alizard0 Feb 25, 2026
dcf4d50
Merge branch 'main' into RHIDP-12183
alizard0 Feb 25, 2026
8da97ef
Merge branch 'main' into RHIDP-12183
alizard0 Feb 27, 2026
b2b7cb4
Merge branch 'main' into RHIDP-12183
alizard0 Mar 2, 2026
56c6abc
exclude metrics in PullMetricsByProviderTask instead
alizard0 Mar 2, 2026
de32169
Merge branch 'main' into RHIDP-12183
alizard0 Mar 2, 2026
5552d49
Merge branch 'main' into RHIDP-12183
alizard0 Mar 2, 2026
9ad2312
review work cicd
alizard0 Mar 2, 2026
69b6f05
Merge branch 'main' into RHIDP-12183
alizard0 Mar 3, 2026
9c2996a
Merge branch 'main' into RHIDP-12183
alizard0 Mar 4, 2026
c9afc8d
implemented exclude/include metrics using app-config and exclude usin…
alizard0 Mar 4, 2026
4dfeaa3
Merge branch 'main' into RHIDP-12183
alizard0 Mar 5, 2026
ad03413
Merge branch 'main' into RHIDP-12183
alizard0 Mar 6, 2026
2251333
Merge branch 'main' into RHIDP-12183
alizard0 Mar 6, 2026
05e836f
review work
alizard0 Mar 6, 2026
e72289a
review work
alizard0 Mar 6, 2026
c26593f
review work
alizard0 Mar 6, 2026
44897a8
Merge branch 'main' into RHIDP-12183
alizard0 Mar 9, 2026
9a6cd78
review work; moved isMetricIdExcluded to utils file instead
alizard0 Mar 9, 2026
05d221a
Merge branch 'main' into RHIDP-12183
alizard0 Mar 9, 2026
bcf8f38
Merge branch 'main' into RHIDP-12183
alizard0 Mar 10, 2026
f4f1407
review work
alizard0 Mar 12, 2026
edb19b6
Merge branch 'main' into RHIDP-12183
alizard0 Mar 12, 2026
2d077fb
add docs
alizard0 Mar 13, 2026
656ac13
Merge branch 'main' into RHIDP-12183
alizard0 Mar 13, 2026
0258d83
rename entityOverrides to entityAnnotations
alizard0 Mar 13, 2026
1031941
reviewed the isMetricIdDisabled rules
alizard0 Mar 13, 2026
5398602
review work
alizard0 Mar 13, 2026
973f9e2
Update workspaces/scorecard/plugins/scorecard-backend/config.d.ts
alizard0 Mar 13, 2026
a9a4759
review readme.md
alizard0 Mar 13, 2026
31fc075
added changesets
alizard0 Mar 13, 2026
779e2ca
moved docs/disabled-metrics-logic.md to scorecard-backend/docs
alizard0 Mar 13, 2026
3cab394
Merge branch 'main' into RHIDP-12183
alizard0 Mar 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
name: openssf-scorecard-only
annotations:
openssf/scorecard-location: https://api.securityscorecards.dev/projects/github.com/alizard0/rhdh-plugins
exclude/metrics: openssf.maintained,openssf.code_review
Comment thread
alizard0 marked this conversation as resolved.
Outdated
spec:
type: service
owner: group:development/guests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ const mockOpenSSFResponse: OpenSSFResponse = {
details: null,
documentation: { short: '', url: '' },
},
{
name: 'Code-Review',
score: 9,
reason: null,
details: null,
documentation: { short: '', url: '' },
},
],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export class OpenSSFClient {
);
}

const data: OpenSSFResponse = await response.json();

return data;
return await response.json();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,51 @@ describe('PullMetricsByProviderTask', () => {
await (task as any).pullProviderMetrics(mockProvider, mockLogger);

expect(mockLogger.info).toHaveBeenNthCalledWith(
2,
4,
`Completed metric pull for github.test_metric: processed 2 entities`,
);
});

it('should skip entities when exclude/metrics annotation contains the provider id', async () => {
const entityExcluded = {
apiVersion: '1.0.0',
kind: 'Component',
metadata: {
name: 'excluded-entity',
annotations: { 'exclude/metrics': 'github.test_metric' },
},
};
const entityIncluded = {
apiVersion: '1.0.0',
kind: 'Component',
metadata: { name: 'included-entity' },
};
mockCatalog.queryEntities.mockReset().mockResolvedValueOnce({
items: [entityExcluded, entityIncluded],
pageInfo: { nextCursor: undefined },
totalItems: 2,
});

const calculateMetricSpy = jest.spyOn(mockProvider, 'calculateMetric');
const createMetricValuesSpy = jest.spyOn(
mockDatabaseMetricValues,
'createMetricValues',
);
await (task as any).pullProviderMetrics(mockProvider, mockLogger);

expect(calculateMetricSpy).toHaveBeenCalledTimes(1);
expect(calculateMetricSpy).toHaveBeenCalledWith(entityIncluded);
expect(createMetricValuesSpy).toHaveBeenCalledTimes(1);
expect(createMetricValuesSpy).toHaveBeenCalledWith([
expect.objectContaining({
catalog_entity_ref: 'component:default/included-entity',
metric_id: 'github.test_metric',
value: 42,
status: 'success',
}),
]);
});

it('should throw error if pullProviderMetrics fails', async () => {
(task as any).pullProviderMetrics = jest
.fn()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,20 @@ export class PullMetricsByProviderTask implements SchedulerTask {
let value: MetricValue | undefined;

try {
const excludedMetrics =
Comment thread
alizard0 marked this conversation as resolved.
Outdated
entity.metadata.annotations?.['exclude/metrics'];
logger.info(
`Loaded excluded/metrics annotation: ${excludedMetrics}`,
);
if (excludedMetrics) {
const excludedMetricsList = excludedMetrics
.split(',')
.map(s => s.trim());
if (excludedMetricsList.includes(provider.getProviderId())) {
logger.info(`Excluded metric: ${provider.getProviderId()}`);
return undefined;
}
}
value = await provider.calculateMetric(entity);

const thresholds = mergeEntityAndProviderThresholds(
Expand Down Expand Up @@ -175,7 +189,7 @@ export class PullMetricsByProviderTask implements SchedulerTask {
}),
).then(promises =>
promises.reduce((acc, curr) => {
if (curr.status === 'fulfilled') {
if (curr.status === 'fulfilled' && curr.value !== undefined) {
return [...acc, curr.value];
}
return acc;
Expand Down