Skip to content

Commit 432edf7

Browse files
amcolinangelcaamaliennae
authored
fix(securitycenter): Update list findings to use the new Filter implementation (#4332)
Co-authored-by: Angel Caamal <acaamalcanul@google.com> Co-authored-by: Jennifer Davis <sigje@google.com>
1 parent 5cfc28f commit 432edf7

2 files changed

Lines changed: 2 additions & 10 deletions

File tree

security-center/snippets/system-test/v1/findings.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,7 @@ describe('Client with SourcesAndFindings', async () => {
163163
const output = exec(`node v1/listFindingsAtTime.js ${data.sourceName}`);
164164
// Nothing was created for the source more then a few minutes ago, so
165165
// days ago should return nothing.
166-
//commented below assert and added new assert as source is created in before block
167-
// assert.equal(output, '');
168-
assert.include(output, data.sourceName);
166+
assert.equal(output, '');
169167
});
170168

171169
it('client can add security marks to finding', () => {

security-center/snippets/v1/listFindingsAtTime.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,8 @@ function main(sourceName = 'FULL RESOURCE PATH TO PARENT SOURCE') {
3737

3838
async function listFindingsAtTime() {
3939
const [response] = await client.listFindings({
40-
// List findings across all sources.
4140
parent: sourceName,
42-
//commented readTime as it is not supported, refer below link
43-
//https://cloud.google.com/security-command-center/docs/release-notes#April_15_2024
44-
// readTime: {
45-
// seconds: Math.floor(fiveDaysAgo.getTime() / 1000),
46-
// nanos: (fiveDaysAgo.getTime() % 1000) * 1e6,
47-
// },
41+
filter: `event_time < "${fiveDaysAgo.toISOString()}"`,
4842
});
4943
let count = 0;
5044
Array.from(response).forEach(result =>

0 commit comments

Comments
 (0)