Skip to content

Commit

Permalink
Remove: Removed the logic for client certificates credential type.
Browse files Browse the repository at this point in the history
This credential type was once used for (custom) OSP scanners, a
functionality that was removed with GOS 22.04.0.
  • Loading branch information
jhelmold authored and timopollmeier committed Dec 8, 2023
1 parent a765583 commit 069a2ba
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 57 deletions.
2 changes: 0 additions & 2 deletions src/gmp/models/credential.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {parseYesNo, NO_VALUE, parseDate} from 'gmp/parser';

export const USERNAME_PASSWORD_CREDENTIAL_TYPE = 'up';
export const USERNAME_SSH_KEY_CREDENTIAL_TYPE = 'usk';
export const CLIENT_CERTIFICATE_CREDENTIAL_TYPE = 'cc';
export const SNMP_CREDENTIAL_TYPE = 'snmp';
export const SMIME_CREDENTIAL_TYPE = 'smime';
export const PGP_CREDENTIAL_TYPE = 'pgp';
Expand Down Expand Up @@ -55,7 +54,6 @@ export const VFIRE_CREDENTIAL_TYPES = [USERNAME_PASSWORD_CREDENTIAL_TYPE];
export const ALL_CREDENTIAL_TYPES = [
USERNAME_PASSWORD_CREDENTIAL_TYPE,
USERNAME_SSH_KEY_CREDENTIAL_TYPE,
CLIENT_CERTIFICATE_CREDENTIAL_TYPE,
SNMP_CREDENTIAL_TYPE,
SMIME_CREDENTIAL_TYPE,
PGP_CREDENTIAL_TYPE,
Expand Down
11 changes: 4 additions & 7 deletions src/web/pages/credentials/details.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import React from 'react';
import _ from 'gmp/locale';

import {
CLIENT_CERTIFICATE_CREDENTIAL_TYPE,
SNMP_CREDENTIAL_TYPE,
SNMP_PRIVACY_ALOGRITHM_NONE,
getCredentialTypeName,
Expand Down Expand Up @@ -86,12 +85,10 @@ const CredentialDetails = ({entity}) => {
</TableData>
</TableRow>

{credential_type !== CLIENT_CERTIFICATE_CREDENTIAL_TYPE && (
<TableRow>
<TableData>{_('Login')}</TableData>
<TableData>{login}</TableData>
</TableRow>
)}
<TableRow>
- <TableData>{_('Login')}</TableData>-{' '}
<TableData>{login}</TableData>-{' '}
</TableRow>
{credential_type === SNMP_CREDENTIAL_TYPE && (
<TableRow>
<TableData>{_('Auth Algorithm')}</TableData>
Expand Down
15 changes: 2 additions & 13 deletions src/web/pages/credentials/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {isDefined} from 'gmp/utils/identity';
import {first, map} from 'gmp/utils/array';

import {
CLIENT_CERTIFICATE_CREDENTIAL_TYPE,
SNMP_CREDENTIAL_TYPE,
USERNAME_PASSWORD_CREDENTIAL_TYPE,
USERNAME_SSH_KEY_CREDENTIAL_TYPE,
Expand Down Expand Up @@ -332,9 +331,7 @@ class CredentialsDialog extends React.Component {
</FormGroup>
)}

{(state.credential_type === USERNAME_SSH_KEY_CREDENTIAL_TYPE ||
state.credential_type ===
CLIENT_CERTIFICATE_CREDENTIAL_TYPE) && (
{state.credential_type === USERNAME_SSH_KEY_CREDENTIAL_TYPE && (
<FormGroup title={_('Passphrase')}>
<Divider>
{is_edit && (
Expand Down Expand Up @@ -381,15 +378,7 @@ class CredentialsDialog extends React.Component {
</FormGroup>
)}

{state.credential_type === CLIENT_CERTIFICATE_CREDENTIAL_TYPE && (
<FormGroup title={_('Certificate')}>
<FileField name="certificate" onChange={onValueChange} />
</FormGroup>
)}

{(state.credential_type === USERNAME_SSH_KEY_CREDENTIAL_TYPE ||
state.credential_type ===
CLIENT_CERTIFICATE_CREDENTIAL_TYPE) && (
{state.credential_type === USERNAME_SSH_KEY_CREDENTIAL_TYPE && (
<FormGroup title={_('Private Key')}>
<FileField name="private_key" onChange={onValueChange} />
</FormGroup>
Expand Down
8 changes: 0 additions & 8 deletions src/web/pages/credentials/downloadicon.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import _ from 'gmp/locale';
import {
USERNAME_PASSWORD_CREDENTIAL_TYPE,
USERNAME_SSH_KEY_CREDENTIAL_TYPE,
CLIENT_CERTIFICATE_CREDENTIAL_TYPE,
} from 'gmp/models/credential';

import IconDivider from 'web/components/layout/icondivider';
Expand Down Expand Up @@ -66,13 +65,6 @@ const CredentialDownloadIcon = ({credential, onDownload}) => {
onClick={cred => onDownload(cred, 'exe')}
/>
)}
{type === CLIENT_CERTIFICATE_CREDENTIAL_TYPE && (
<DownloadKeyIcon
title={_('Download Certificate (.pem)')}
value={credential}
onClick={cred => onDownload(cred, 'pem')}
/>
)}
</IconDivider>
);
};
Expand Down
8 changes: 0 additions & 8 deletions src/web/pages/scanners/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import {isDefined} from 'gmp/utils/identity';
import {shorten} from 'gmp/utils/string';
import {hasId} from 'gmp/utils/id';

import {CLIENT_CERTIFICATE_CREDENTIAL_TYPE} from 'gmp/models/credential';

import {renewSessionTimeout} from 'web/store/usersettings/actions';
import {loadUserSettingDefaults} from 'web/store/usersettings/defaults/actions';
import {getUserSettingsDefaults} from 'web/store/usersettings/defaults/selectors';
Expand Down Expand Up @@ -134,12 +132,6 @@ class ScannerComponent extends React.Component {

openCredentialsDialog() {
this.handleInteraction();

this.setState({
base: CLIENT_CERTIFICATE_CREDENTIAL_TYPE,
credentialDialogVisible: true,
credentialTypes: [CLIENT_CERTIFICATE_CREDENTIAL_TYPE],
});
}

closeCredentialsDialog() {
Expand Down
7 changes: 6 additions & 1 deletion src/web/pages/scanners/detailspage.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ import PropTypes from 'web/utils/proptypes';
import ScannerComponent from './component';
import ScannerDetails from './details';

import useGmp from 'web/utils/useGmp';

const ToolBarIcons = ({
entity,
onScannerCertificateDownloadClick,
Expand All @@ -79,6 +81,7 @@ const ToolBarIcons = ({
onScannerEditClick,
onScannerVerifyClick,
}) => {
const gmp = useGmp();
return (
<Divider margin="10px">
<IconDivider>
Expand All @@ -90,7 +93,9 @@ const ToolBarIcons = ({
<ListIcon title={_('Scanner List')} page="scanners" />
</IconDivider>
<IconDivider>
<CreateIcon entity={entity} onClick={onScannerCreateClick} />
{gmp.settings.enableGreenboneSensor && (
<CreateIcon entity={entity} onClick={onScannerCreateClick} />
)}
<CloneIcon
entity={entity}
mayClone={entity.scannerType !== CVE_SCANNER_TYPE}
Expand Down
21 changes: 3 additions & 18 deletions src/web/pages/scanners/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,8 @@ import {
scannerTypeName,
} from 'gmp/models/scanner';

import {CLIENT_CERTIFICATE_CREDENTIAL_TYPE} from 'gmp/models/credential';

const AVAILABLE_SCANNER_TYPES = [GREENBONE_SENSOR_SCANNER_TYPE];

const client_cert_credentials_filter = credential => {
return credential.credential_type === CLIENT_CERTIFICATE_CREDENTIAL_TYPE;
};

const render_certificate_info = (info, tz) => {
if (!isDefined(info)) {
return null;
Expand Down Expand Up @@ -125,10 +119,7 @@ const ScannerDialog = ({
const handleTypeChange = (value, name) => {
if (onScannerTypeChange) {
value = parseInt(value);
const scan_credentials = filter(
credentials,
client_cert_credentials_filter,
);
const scan_credentials = filter(credentials);

onScannerTypeChange(value, name);
onScannerTypeChange(
Expand Down Expand Up @@ -167,15 +158,9 @@ const ScannerDialog = ({
value: scannerType,
}));

const scanner_credentials = filter(
credentials,
client_cert_credentials_filter,
);
const scanner_credentials = filter(credentials);
const isInUse = isDefined(scanner) && scanner.isInUse();
const show_cred_info =
isDefined(scanner) &&
isDefined(scanner.credential) &&
scanner.credential.credential_type === CLIENT_CERTIFICATE_CREDENTIAL_TYPE;
const show_cred_info = isDefined(scanner) && isDefined(scanner.credential);

const isGreenboneSensorType = type === GREENBONE_SENSOR_SCANNER_TYPE;

Expand Down

0 comments on commit 069a2ba

Please sign in to comment.