Repository navigation
Expand file tree
/
Copy pathSystemInfoForm.jsx
More file actions
318 lines (291 loc) · 11.4 KB
/
Copy pathSystemInfoForm.jsx
File metadata and controls
318 lines (291 loc) · 11.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
/**
* Copyright 2025 Adobe. All rights reserved.
* Copyright (c) 2025 Mukesh Kesharwani
*
* Licensed under the MIT License. See LICENSE file for details.
*/
import React, { useState, useMemo } from 'react';
import { useAuth } from '../contexts/AuthContext';
import { CLASSIFICATION_LEVELS, detectFramework } from '../constants/classifications.js';
import { SYSTEM_STATUS_OPTIONS, DEFAULT_SYSTEM_STATUS } from '../constants/systemStatus.js';
import './SystemInfoForm.css';
function SystemInfoForm({ onSubmit, onBack, catalogueUrl, initialClassification, initialValues }) {
const { canEditAssessorDetails, canEditSystemInfo } = useAuth();
// Detect framework type from catalogue URL (rules live in the shared constants).
const frameworkType = useMemo(() => detectFramework(catalogueUrl), [catalogueUrl]);
const classificationLevels = CLASSIFICATION_LEVELS[frameworkType] || CLASSIFICATION_LEVELS['default'];
// Use initialClassification if provided, otherwise use first option
const defaultLevel = initialClassification || classificationLevels[0].value;
const [formData, setFormData] = useState({
systemName: initialValues?.systemName || '',
systemId: initialValues?.systemId || '',
description: initialValues?.description || '',
authorizationBoundary: initialValues?.authorizationBoundary || '',
organization: initialValues?.organization || '',
assessorDetails: initialValues?.assessorDetails || '',
systemOwner: initialValues?.systemOwner || '',
cspIaaS: initialValues?.cspIaaS || '',
cspPaaS: initialValues?.cspPaaS || '',
cspSaaS: initialValues?.cspSaaS || '',
securityLevel: initialValues?.securityLevel || defaultLevel,
confidentiality: initialValues?.confidentiality || 'moderate',
integrity: initialValues?.integrity || 'moderate',
availability: initialValues?.availability || 'moderate',
status: initialValues?.status || DEFAULT_SYSTEM_STATUS,
systemType: initialValues?.systemType || '',
authorizationDate: initialValues?.authorizationDate || ''
});
const handleChange = (e) => {
const { name, value } = e.target;
setFormData({ ...formData, [name]: value });
};
const handleSubmit = (e) => {
e.preventDefault();
onSubmit(formData);
};
return (
<div className="system-info-container">
<div className="card">
<h2>System Information</h2>
<p className="card-description">
Provide details about the system you're documenting
</p>
<form onSubmit={handleSubmit} className="system-form">
<div className="form-row">
<div className="form-group">
<label htmlFor="systemName">System Name *</label>
<input
id="systemName"
name="systemName"
type="text"
className="form-control"
placeholder="e.g., Customer Portal"
value={formData.systemName}
onChange={handleChange}
required
/>
</div>
<div className="form-group">
<label htmlFor="systemId">System ID</label>
<input
id="systemId"
name="systemId"
type="text"
className="form-control"
placeholder="e.g., SYS-001"
value={formData.systemId}
onChange={handleChange}
/>
</div>
</div>
<div className="form-group">
<label htmlFor="description">System Description *</label>
<textarea
id="description"
name="description"
className="form-control"
rows="4"
placeholder="Describe the purpose and functionality of this system..."
value={formData.description}
onChange={handleChange}
required
/>
</div>
<div className="form-group">
<label htmlFor="authorizationBoundary">Authorization Boundary *</label>
<textarea
id="authorizationBoundary"
name="authorizationBoundary"
className="form-control"
rows="4"
placeholder="Describe what is included/excluded in the system authorization boundary (network, physical, logical boundaries)..."
value={formData.authorizationBoundary}
onChange={handleChange}
required
/>
<small className="form-hint">
Define the scope of authorization including components, infrastructure, and service dependencies within/outside the boundary.
</small>
</div>
<div className="form-row">
<div className="form-group">
<label htmlFor="organization">Organisation</label>
<input
id="organization"
name="organization"
type="text"
className="form-control"
placeholder="e.g., Adobe Inc."
value={formData.organization}
onChange={handleChange}
/>
</div>
<div className="form-group">
<label htmlFor="systemOwner">System Owner</label>
<input
id="systemOwner"
name="systemOwner"
type="text"
className="form-control"
placeholder="e.g., John Doe"
value={formData.systemOwner}
onChange={handleChange}
/>
</div>
</div>
<div className="form-group">
<label htmlFor="assessorDetails">
Assessor Details
{!canEditAssessorDetails() && <span style={{ marginLeft: '0.5rem', color: '#d97706', fontSize: '0.85em' }}>🔒 Assessor Role Required</span>}
</label>
<textarea
id="assessorDetails"
name="assessorDetails"
className="form-control"
rows="3"
placeholder="Enter assessor name, organization, and contact details..."
value={formData.assessorDetails}
onChange={handleChange}
disabled={!canEditAssessorDetails()}
/>
</div>
<div className="security-objectives">
<h3>CSP Providers</h3>
<p className="section-description">
Specify the Cloud Service Providers for each service model
</p>
<div className="form-row">
<div className="form-group">
<label htmlFor="cspIaaS">IaaS Provider</label>
<input
id="cspIaaS"
name="cspIaaS"
type="text"
className="form-control"
placeholder="e.g., AWS, Azure, GCP"
value={formData.cspIaaS}
onChange={handleChange}
/>
</div>
<div className="form-group">
<label htmlFor="cspPaaS">PaaS Provider</label>
<input
id="cspPaaS"
name="cspPaaS"
type="text"
className="form-control"
placeholder="e.g., Heroku, Cloud Foundry"
value={formData.cspPaaS}
onChange={handleChange}
/>
</div>
<div className="form-group">
<label htmlFor="cspSaaS">SaaS Provider</label>
<input
id="cspSaaS"
name="cspSaaS"
type="text"
className="form-control"
placeholder="e.g., Salesforce, Microsoft 365"
value={formData.cspSaaS}
onChange={handleChange}
/>
</div>
</div>
</div>
<div className="form-row">
<div className="form-group">
<label htmlFor="securityLevel">Data/System Sensitivity/Classification Level</label>
<select
id="securityLevel"
name="securityLevel"
className="form-control"
value={formData.securityLevel}
onChange={handleChange}
>
{classificationLevels.map(level => (
<option key={level.value} value={level.value}>
{level.label}
</option>
))}
</select>
</div>
<div className="form-group">
<label htmlFor="status">System Status</label>
<select
id="status"
name="status"
className="form-control"
value={formData.status}
onChange={handleChange}
>
{SYSTEM_STATUS_OPTIONS.map((o) => (
<option key={o.value} value={o.value}>{o.label}</option>
))}
</select>
</div>
</div>
<div className="security-objectives">
<h3>Security Impact Level</h3>
<p className="section-description">
Define the security objectives for confidentiality, integrity, and availability
</p>
<div className="form-row">
<div className="form-group">
<label htmlFor="confidentiality">Confidentiality</label>
<select
id="confidentiality"
name="confidentiality"
className="form-control"
value={formData.confidentiality}
onChange={handleChange}
>
<option value="low">Low</option>
<option value="moderate">Moderate</option>
<option value="high">High</option>
</select>
</div>
<div className="form-group">
<label htmlFor="integrity">Integrity</label>
<select
id="integrity"
name="integrity"
className="form-control"
value={formData.integrity}
onChange={handleChange}
>
<option value="low">Low</option>
<option value="moderate">Moderate</option>
<option value="high">High</option>
</select>
</div>
<div className="form-group">
<label htmlFor="availability">Availability</label>
<select
id="availability"
name="availability"
className="form-control"
value={formData.availability}
onChange={handleChange}
>
<option value="low">Low</option>
<option value="moderate">Moderate</option>
<option value="high">High</option>
</select>
</div>
</div>
</div>
<div className="form-actions">
<button type="button" className="btn btn-secondary" onClick={onBack}>
Back
</button>
<button type="submit" className="btn btn-primary">
Continue to Controls
</button>
</div>
</form>
</div>
</div>
);
}
export default SystemInfoForm;