-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add: Kerberos to Credential and Target #4335
base: main
Are you sure you want to change the base?
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. OpenSSF Scorecard
Scanned Files |
Conventional Commits Report
🚀 Conventional commits found. |
🔍 Vulnerabilities of
|
digest | sha256:50998c1bc8141afedd5748d839d0cd3d138d0e530f05451f102d2618e93baa9f |
vulnerabilities | |
size | 71 MB |
packages | 206 |
📦 Base Image debian:stable-20250113-slim
also known as |
|
digest | sha256:9dfddad9f09eadd2541a567e0865bd223387cf490b1c8d9d1f08d3b413766841 |
vulnerabilities |
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
Description
Description
Description
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Description
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4335 +/- ##
==========================================
+ Coverage 63.09% 63.19% +0.10%
==========================================
Files 1122 1122
Lines 99812 99829 +17
Branches 6659 6665 +6
==========================================
+ Hits 62974 63090 +116
+ Misses 36821 36722 -99
Partials 17 17 ☔ View full report in Codecov by Sentry. |
/* SPDX-FileCopyrightText: 2025 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import {describe, test, expect} from '@gsa/testing'; | ||
import Model from 'gmp/model'; | ||
import Credential from 'gmp/models/credential'; | ||
import {parseDate, NO_VALUE, YES_VALUE} from 'gmp/parser'; | ||
|
||
describe('Credential Model tests', () => { | ||
test('should parse certificate_info', () => { | ||
const elem = { | ||
certificate_info: { | ||
activation_time: '2025-02-10T11:41:23.022Z', | ||
expiration_time: '2025-10-10T11:41:23.022Z', | ||
}, | ||
}; | ||
const credential = Credential.fromElement(elem); | ||
|
||
expect(credential.certificate_info.activationTime).toEqual( | ||
parseDate('2025-02-10T11:41:23.022Z'), | ||
); | ||
expect(credential.certificate_info.expirationTime).toEqual( | ||
parseDate('2025-10-10T11:41:23.022Z'), | ||
); | ||
expect(credential.certificate_info.activation_time).toBeUndefined(); | ||
expect(credential.certificate_info.expiration_time).toBeUndefined(); | ||
}); | ||
|
||
test('should parse type', () => { | ||
const credential = Credential.fromElement({type: 'foo'}); | ||
|
||
expect(credential.credential_type).toEqual('foo'); | ||
}); | ||
|
||
test('should parse allow_insecure as Yes/No', () => { | ||
const elem1 = {allow_insecure: '1'}; | ||
const elem2 = {allow_insecure: '0'}; | ||
const cred1 = Credential.fromElement(elem1); | ||
const cred2 = Credential.fromElement(elem2); | ||
|
||
expect(cred1.allow_insecure).toEqual(YES_VALUE); | ||
expect(cred2.allow_insecure).toEqual(NO_VALUE); | ||
}); | ||
|
||
test('isAllowInsecure() should return correct true/false', () => { | ||
const cred1 = Credential.fromElement({allow_insecure: '0'}); | ||
const cred2 = Credential.fromElement({allow_insecure: '1'}); | ||
|
||
expect(cred1.isAllowInsecure()).toBe(false); | ||
expect(cred2.isAllowInsecure()).toBe(true); | ||
}); | ||
|
||
test('should parse targets as array of instances of target model', () => { | ||
const elem = { | ||
targets: { | ||
target: {_id: 't1'}, | ||
}, | ||
}; | ||
const credential = Credential.fromElement(elem); | ||
|
||
expect(credential.targets.length).toEqual(1); | ||
|
||
const [target] = credential.targets; | ||
expect(target).toBeInstanceOf(Model); | ||
expect(target.id).toEqual('t1'); | ||
expect(target.entityType).toEqual('target'); | ||
}); | ||
|
||
test('should return empty array if no targets are given', () => { | ||
const credential = Credential.fromElement({}); | ||
|
||
expect(credential.targets.length).toEqual(0); | ||
expect(credential.targets).toEqual([]); | ||
}); | ||
|
||
test('should parse scanners as array of instances of scanner model', () => { | ||
const elem = { | ||
scanners: { | ||
scanner: {_id: 's1'}, | ||
}, | ||
}; | ||
const credential = Credential.fromElement(elem); | ||
|
||
expect(credential.scanners.length).toEqual(1); | ||
|
||
const [scanner] = credential.scanners; | ||
expect(scanner).toBeInstanceOf(Model); | ||
expect(scanner.id).toEqual('s1'); | ||
expect(scanner.entityType).toEqual('scanner'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be put into the model test at gmp/models/__tests__/credential.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides moving the credential model into the correct file it looks very good 👍🏻
What
Why
References
GEA-777
Checklist