Skip to content

Commit

Permalink
[WIP] Link Project and System models; polish control page UI (#844)
Browse files Browse the repository at this point in the history
* New models to connect statements (controls) to elements (systems)...

...and move parser classes out of utilities and into separate file.

Create an abstract System model to represent a system. The System model
subclasses an Element and stores information about elements that are systems.

Create ElementControl model represent the selected control list for a system.
The model is called ElementControl because even systems are elements.
An ElementControl associates a control catalog id with an element. Some elements
are subclassed as systems. This allows us to apply statements to any element, including
elements that are subclassed as systems.

Create relationships between ElementControl and read-only oscal.Catalog model.
A unique "control" statement is identified by unique combination of Element, OSCAL
Control Id, and OSCAL Catalog Key.

Also put parser classes into separate file `parsers.py` and `parsers_i.py` with the
latter "*_i.py" representing a standalone version of the parser classes that do not
require GovReady Django models to run.

* WIP Get implementation statements associated with a system

* Bump version to 0.9.1.5

* Remove xlrd from controls.utilities

* Improve control index page with list of control groups

Create page listing controls in a group.

* Add Catalog index page

* Display mutiple catalogs and their controls

* Properly rread impl statements from database by system

Continue developing the editor by connecting a control to
a specific system and to a set of statements. When looking
up a system control, the existing implementation statements
for that system are read from database and displayed in editor.

Provide new routes for viewing system related controls.

Modify system model to not requie FISMA Id

TODO:
- manage save/create vs edit function on existing statement

* Add controls directory to Docker build

* Support statement updates in editor

Enhance control editor Ajax save process to
also handle updates to existing content.

* Rename statement-element relationships; Add del smt to editor

Rename relationship between statements and elements to be clearer.
Create statement-element relationships:

    * producer_element
    * consumer_element
    * mentioned_elements

Rules:

    * Every statement has exactly one producer_element
    * Every statement has exactly one consumer_element
    * Every statement has many menionted_elements
    * mentioned_elements should contain producer_element and consumer_element

Update statement editor page to support new relationship names

Update statement editor page to delete statements

* Combined implementation statement in editor

Display the combined implementatioin statement in the
control implementation statement editor.

Simplify the accordian header to just display component (element) name.

Move "Add component statement" to bottom of list of components.

Partially fix _smt_delete route.

* Implementation smt editor improvements

Enforce unique Name field on Element model.
Match Component (Producer Element) by unique name
to existing Producer Element in the database
when creating a new Statement.

Improve the combining of component statements.
Temporarily put result into a textarea to make easier
to copy manually. (TODO: Create a copy to clipboard javascript.)

* Fix branch tests, bump VERSION, CHANGELOG

* Add CSV export to Control models

* Change admin string of Statements

* Add guardian permission to editor page

Show users 404 page if they do not have view permissons
on a system

* Better admin string for Portfolios

* Add commented row to force debug_toolbar display

* Add custom 404 template

* WIP Initial version of migration compare controls page

Initial version of an editor page (editor/compare) that will
show controls from existing facility and a future facility to
make migrating controls eaiser.

* WIP Begin to add in 800-171 OSCAL control catalog

Start to author the 800-171 OSCAL catalog in JSON.

Make adjustments to family identification by control ID to
handle numeric format of 800-171 group ids.

* WIP Port 800-171 to spreadsheet

* Recognize 800-171 control ids in id lookup

* Link Project Model to System Model; Polish control page UI

Link Projects (e.g. questionnaires/apps to system).

Add System foreign key to Project Model.

Interface improvements:
* Improve comparison interface.
* Simplify URLs to system pages.
* Only display system information and controls if user has view permissions on system.
* Add acton button to controls from questionnaire.
* Create back links to questioonaire from controls.

* fix merge

Co-authored-by: Greg Elin <[email protected]>
Co-authored-by: Peter Kaminski <[email protected]>
  • Loading branch information
3 people authored May 6, 2020
2 parents 751f64d + 27519ea commit 1d363ce
Show file tree
Hide file tree
Showing 25 changed files with 17,280 additions and 273 deletions.
39 changes: 33 additions & 6 deletions controls/admin.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,51 @@
import csv
from django.contrib import admin
from django.http import HttpResponse
from .models import Statement, Element, ElementControl, System, CommonControlProvider, CommonControl
from guardian.admin import GuardedModelAdmin

class ExportCsvMixin:
# From https://books.agiliq.com/projects/django-admin-cookbook/en/latest/export.html
def export_as_csv(self, request, queryset):

class StatementAdmin(admin.ModelAdmin):
meta = self.model._meta
field_names = [field.name for field in meta.fields]

response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename={}.csv'.format(meta)
writer = csv.writer(response)

writer.writerow(field_names)
for obj in queryset:
row = writer.writerow([getattr(obj, field) for field in field_names])

return response

export_as_csv.short_description = "Export Selected as CSV"

class StatementAdmin(admin.ModelAdmin, ExportCsvMixin):
list_display = ('id', 'sid', 'sid_class', 'parent')
actions = ["export_as_csv"]

class ElementAdmin(admin.ModelAdmin):
class ElementAdmin(GuardedModelAdmin, ExportCsvMixin):
list_display = ('name', 'full_name', 'id')
actions = ["export_as_csv"]

class ElementControlAdmin(admin.ModelAdmin):
class ElementControlAdmin(admin.ModelAdmin, ExportCsvMixin):
list_display = ('id', 'element', 'oscal_ctl_id', 'oscal_catalog_key')
actions = ["export_as_csv"]

class SystemAdmin(admin.ModelAdmin):
class SystemAdmin(GuardedModelAdmin, ExportCsvMixin):
list_display = ('id', 'root_element')
actions = ["export_as_csv"]

class CommonControlProviderAdmin(admin.ModelAdmin):
class CommonControlProviderAdmin(admin.ModelAdmin, ExportCsvMixin):
list_display = ('name', 'id')
actions = ["export_as_csv"]

class CommonControlAdmin(admin.ModelAdmin):
class CommonControlAdmin(admin.ModelAdmin, ExportCsvMixin):
list_display = ('name', 'oscal_ctl_id', 'id')
actions = ["export_as_csv"]


admin.site.register(Statement, StatementAdmin)
Expand Down
110 changes: 110 additions & 0 deletions controls/data/catalogs/800-171-source.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
3.1.1 Limit system access to authorized users, processes acting on behalf of authorized users, and devices (including other systems).
3.1.2 Limit system access to the types of transactions and functions that authorized users are permitted to execute.
3.1.3 Control the flow of CUI in accordance with approved authorizations.
3.1.4 Separate the duties of individuals to reduce the risk of malevolent activity without collusion.
3.1.5 Employ the principle of least privilege, including for specific security functions and privileged accounts.
3.1.6 Use non-privileged accounts or roles when accessing nonsecurity functions.
3.1.7 Prevent non-privileged users from executing privileged functions and capture the execution of such functions in audit logs.
3.1.8 Limit unsuccessful logon attempts.
3.1.9 Provide privacy and security notices consistent with applicable CUI rules.
3.1.10 Use session lock with pattern-hiding displays to prevent access and viewing of data after a period of inactivity.
3.1.11 Terminate (automatically) a user session after a defined condition.
3.1.12 Monitor and control remote access sessions.
3.1.13 Employ cryptographic mechanisms to protect the confidentiality of remote access sessions.
3.1.14 Route remote access via managed access control points.
3.1.15 Authorize remote execution of privileged commands and remote access to security-relevant information.
3.1.16 Authorize wireless access prior to allowing such connections.
3.1.17 Protect wireless access using authentication and encryption.
3.1.18 Control connection of mobile devices.
3.1.19 Encrypt CUI on mobile devices and mobile computing platforms.21
3.1.20 Verify and control/limit connections to and use of external systems.
3.1.21 Limit use of portable storage devices on external systems.
3.1.22 Control CUI posted or processed on publicly accessible systems.
3.2.1 Ensure that managers, systems administrators, and users of organizational systems are made aware of the security risks associated with their activities and of the applicable policies, standards, and procedures related to the security of those systems.
3.2.2 Ensure that personnel are trained to carry out their assigned information security-related duties and responsibilities.
3.2.3 Provide security awareness training on recognizing and reporting potential indicators of insider threat.
3.3.1 Create and retain system audit logs and records to the extent needed to enable the monitoring, analysis, investigation, and reporting of unlawful or unauthorized system activity.
3.3.2 Ensure that the actions of individual system users can be uniquely traced to those users so they can be held accountable for their actions.
3.3.3 Review and update logged events.
3.3.4 Alert in the event of an audit logging process failure.
3.3.5 Correlate audit record review, analysis, and reporting processes for investigation and response to indications of unlawful, unauthorized, suspicious, or unusual activity.
3.3.6 Provide audit record reduction and report generation to support on-demand analysis and reporting.
3.3.7 Provide a system capability that compares and synchronizes internal system clocks with an authoritative source to generate time stamps for audit records.
3.3.8 Protect audit information and audit logging tools from unauthorized access, modification, and deletion.
3.3.9 Limit management of audit logging functionality to a subset of privileged users.
3.4.1 Establish and maintain baseline configurations and inventories of organizational systems (including hardware, software, firmware, and documentation) throughout the respective system development life cycles.
3.4.2 Establish and enforce security configuration settings for information technology products employed in organizational systems.
3.4.3 Track, review, approve or disapprove, and log changes to organizational systems.
3.4.4 Analyze the security impact of changes prior to implementation.
3.4.5 Define, document, approve, and enforce physical and logical access restrictions associated with changes to organizational systems.
3.4.6 Employ the principle of least functionality by configuring organizational systems to provide only essential capabilities.
3.4.7 Restrict, disable, or prevent the use of nonessential programs, functions, ports, protocols, and services.
3.4.8 Apply deny-by-exception (blacklisting) policy to prevent the use of unauthorized software or deny-all, permit-by-exception (whitelisting) policy to allow the execution of authorized software.
3.4.9 Control and monitor user-installed software.
3.5.1 Identify system users, processes acting on behalf of users, and devices.
3.5.2 Authenticate (or verify) the identities of users, processes, or devices, as a prerequisite to allowing access to organizational systems.
3.5.3 Use multifactor authentication22 for local and network access23 to privileged accounts and for network access to non-privileged accounts.
3.5.4 Employ replay-resistant authentication mechanisms for network access to privileged and non- privileged accounts.
3.5.5 Prevent reuse of identifiers for a defined period.
3.5.6 Disable identifiers after a defined period of inactivity.
3.5.7 Enforce a minimum password complexity and change of characters when new passwords are created.
3.5.8 Prohibit password reuse for a specified number of generations.
3.5.9 Allow temporary password use for system logons with an immediate change to a permanent password.
3.5.10 Store and transmit only cryptographically-protected passwords.
3.5.11 Obscure feedback of authentication information.
3.6.1 Establish an operational incident-handling capability for organizational systems that includes preparation, detection, analysis, containment, recovery, and user response activities.
3.6.2 Track, document, and report incidents to designated officials and/or authorities both internal and external to the organization.
3.6.3 Test the organizational incident response capability.
3.7.1 Perform maintenance on organizational systems. 24
3.7.2 Provide controls on the tools, techniques, mechanisms, and personnel used to conduct system maintenance.
3.7.3 Ensure equipment removed for off-site maintenance is sanitized of any CUI.
3.7.4 Check media containing diagnostic and test programs for malicious code before the media are used in organizational systems.
3.7.5 Require multifactor authentication to establish nonlocal maintenance sessions via external network connections and terminate such connections when nonlocal maintenance is complete.
3.7.6 Supervise the maintenance activities of maintenance personnel without required access authorization.
3.8.1 Protect (i.e., physically control and securely store) system media containing CUI, both paper and digital.
3.8.2 Limit access to CUI on system media to authorized users.
3.8.3 Sanitize or destroy system media containing CUI before disposal or release for reuse.
3.8.4 Mark media with necessary CUI markings and distribution limitations. 25
3.8.5 Control access to media containing CUI and maintain accountability for media during transport outside of controlled areas.
3.8.6 Implement cryptographic mechanisms to protect the confidentiality of CUI stored on digital media during transport unless otherwise protected by alternative physical safeguards.
3.8.7 Control the use of removable media on system components.
3.8.8 Prohibit the use of portable storage devices when such devices have no identifiable owner.
3.8.9 Protect the confidentiality of backup CUI at storage locations.
3.9.1 Screen individuals prior to authorizing access to organizational systems containing CUI.
3.9.2 Ensure that organizational systems containing CUI are protected during and after personnel actions such as terminations and transfers.
3.10.1 Limit physical access to organizational systems, equipment, and the respective operating environments to authorized individuals.
3.10.2 Protect and monitor the physical facility and support infrastructure for organizational systems.
3.10.3 Escort visitors and monitor visitor activity.
3.10.4 Maintain audit logs of physical access.
3.10.5 Control and manage physical access devices.
3.10.6 Enforce safeguarding measures for CUI at alternate work sites
3.11.1 Periodically assess the risk to organizational operations (including mission, functions, image, or reputation), organizational assets, and individuals, resulting from the operation of organizational systems and the associated processing, storage, or transmission of CUI.
3.11.2 Scan for vulnerabilities in organizational systems and applications periodically and when new vulnerabilities affecting those systems and applications are identified.
3.11.3 Remediate vulnerabilities in accordance with risk assessments.
3.12.1 Periodically assess the security controls in organizational systems to determine if the controls are effective in their application.
3.12.2 Develop and implement plans of action designed to correct deficiencies and reduce or eliminate vulnerabilities in organizational systems.
3.12.3 Monitor security controls on an ongoing basis to ensure the continued effectiveness of the controls.
3.12.4 Develop, document, and periodically update system security plans that describe system boundaries, system environments of operation, how security requirements are implemented, and the relationships with or connections to other systems.26
3.13.1 Monitor, control, and protect communications (i.e., information transmitted or received by organizational systems) at the external boundaries and key internal boundaries of organizational systems.
3.13.2 Employ architectural designs, software development techniques, and systems engineering principles that promote effective information security within organizational systems.
3.13.3 Separate user functionality from system management functionality.
3.13.4 Prevent unauthorized and unintended information transfer via shared system resources.
3.13.5 Implement subnetworks for publicly accessible system components that are physically or logically separated from internal networks.
3.13.6 Deny network communications traffic by default and allow network communications traffic by exception (i.e., deny all, permit by exception).
3.13.7 Prevent remote devices from simultaneously establishing non-remote connections with organizational systems and communicating via some other connection to resources in external networks (i.e., split tunneling).
3.13.8 Implement cryptographic mechanisms to prevent unauthorized disclosure of CUI during transmission unless otherwise protected by alternative physical safeguards.
3.13.9 Terminate network connections associated with communications sessions at the end of the sessions or after a defined period of inactivity.
3.13.10 Establish and manage cryptographic keys for cryptography employed in organizational systems.
3.13.11 Employ FIPS-validated cryptography when used to protect the confidentiality of CUI.
3.13.12 Prohibit remote activation 27 of collaborative computing devices and provide indication of devices in use to users present at the device.
3.13.13 Control and monitor the use of mobile code.
3.13.14 Control and monitor the use of Voice over Internet Protocol (VoIP) technologies.
3.13.15 Protect the authenticity of communications sessions.
3.13.16 Protect the confidentiality of CUI at rest.
3.14.1 Identify, report, and correct system flaws in a timely manner.
3.14.2 Provide protection from malicious code at designated locations within organizational systems.
3.14.3 Monitor system security alerts and advisories and take action in response.
3.14.4 Update malicious code protection mechanisms when new releases are available.
3.14.5 Perform periodic scans of organizational systems and real-time scans of files from external sources as files are downloaded, opened, or executed.
3.14.6 Monitor organizational systems, including inbound and outbound communications traffic, to detect attacks and indicators of potential attacks.
3.14.7 Identify unauthorized use of organizational systems.
Binary file added controls/data/catalogs/800-171-source.xlsx
Binary file not shown.
Loading

0 comments on commit 1d363ce

Please sign in to comment.