From 9f8dcda889ffd0db4ccfa0489cc8bced37d475c7 Mon Sep 17 00:00:00 2001 From: Brian Mesick Date: Wed, 20 Nov 2024 15:21:11 -0500 Subject: [PATCH] style: Cleaning up PII annotations Adding some missing annotations, fixing typo'd annotation, removing what seem like unnecessary annotations from the safe list. This work is in preparation for getting the annotation checker running on edx-platform again. --- .annotation_safe_list.yml | 56 +++++++++---------- .pii_annotations.yml | 23 ++++---- enterprise/models.py | 4 ++ integrated_channels/blackboard/models.py | 2 + integrated_channels/canvas/models.py | 2 + .../integrated_channel/models.py | 8 ++- 6 files changed, 54 insertions(+), 41 deletions(-) diff --git a/.annotation_safe_list.yml b/.annotation_safe_list.yml index c41bde6af8..9c33651132 100644 --- a/.annotation_safe_list.yml +++ b/.annotation_safe_list.yml @@ -8,52 +8,52 @@ # ".. choice_annotation:": foo, bar, baz canvas.HistoricalCanvasEnterpriseCustomerConfiguration: - ".. no_pii:": "" + ".. no_pii:": "" consent.HistoricalDataSharingConsent: - ".. pii:": "The username field inherited from DataSharingConsent contains PII" - ".. pii_types:": username - ".. pii_retirement:": consumer_api + ".. pii:": "The username field inherited from DataSharingConsent contains PII" + ".. pii_types:": username + ".. pii_retirement:": consumer_api degreed.HistoricalDegreedEnterpriseCustomerConfiguration: - ".. no_pii:": "" + ".. no_pii:": "" +enterprise.HistoricalDefaultEnterpriseEnrollmentIntention: + ".. no_pii:": "" +enterprise.HistoricalDefaultEnterpriseEnrollmentRealization: + ".. no_pii:": "" enterprise.HistoricalEnrollmentNotificationEmailTemplate: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalEnterpriseCourseEnrollment: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalEnterpriseCustomer: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalEnterpriseCustomerCatalog: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalEnterpriseCustomerEntitlement: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalEnterpriseAnalyticsUser: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalPendingEnterpriseCustomerUser: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalPendingEnterpriseCustomerAdminUser: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalLicensedEnterpriseCourseEnrollment: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalPendingEnrollment: - ".. no_pii:": "" + ".. no_pii:": "" moodle.HistoricalMoodleEnterpriseCustomerConfiguration: - ".. no_pii:": "" -enterprise.EnterpriseCourseEntitlement: - ".. no_pii:": "" -enterprise.EnterpriseCustomerSsoConfiguration: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalEnterpriseCourseEntitlement: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalEnterpriseCustomerInviteKey: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalEnterpriseCustomerSsoConfiguration: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalEnterpriseCustomerUser: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalEnterpriseGroup: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalEnterpriseGroupMembership: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalLearnerCreditEnterpriseCourseEnrollment: - ".. no_pii:": "" + ".. no_pii:": "" enterprise.HistoricalSystemWideEnterpriseUserRoleAssignment: - ".. no_pii:": "" + ".. no_pii:": "" diff --git a/.pii_annotations.yml b/.pii_annotations.yml index 957c8f2692..206ee8727f 100644 --- a/.pii_annotations.yml +++ b/.pii_annotations.yml @@ -4,20 +4,19 @@ safelist_path: .annotation_safe_list.yml # Local models are all fully annotated, but non-local models are not annotated # because this repo does not contain an IDA/Django project (which, according to -# our own PII annotating policy, doesn't require non-local annotations). 75% +# our own PII annotating policy, doesn't require non-local annotations). 84.7% # coverage represents all local models, and is the current theoretical maximum # coverage. -# TODO: PLAT-2422 -coverage_target: 75.0 +coverage_target: 84.7 annotations: - ".. no_pii:": - "pii_group": - - ".. pii:": - - ".. pii_types:": - choices: [id, name, username, email_address, other] - - ".. pii_retirement:": - choices: [retained, local_api, consumer_api, third_party] + ".. no_pii:": + "pii_group": + - ".. pii:": + - ".. pii_types:": + choices: [id, name, username, email_address, other] + - ".. pii_retirement:": + choices: [retained, local_api, consumer_api, third_party] extensions: - python: - - py + python: + - py diff --git a/enterprise/models.py b/enterprise/models.py index 2d477e8fd1..55e8ab008d 100644 --- a/enterprise/models.py +++ b/enterprise/models.py @@ -1874,6 +1874,8 @@ def get_queryset(self): class EnterpriseCourseEntitlement(TimeStampedModel): """ Store the information about the entitlement of an enterprise user for a course + + .. no_pii: """ objects = EnterpriseCourseEntitlementManager() @@ -4252,6 +4254,8 @@ def __repr__(self): class EnterpriseCustomerSsoConfiguration(TimeStampedModel, SoftDeletableModel): """ Stores records of individual customer integrations with the SSO orchestration api. + + .. no_pii: """ all_objects = models.Manager() diff --git a/integrated_channels/blackboard/models.py b/integrated_channels/blackboard/models.py index b4b4f89f38..9d930ac703 100644 --- a/integrated_channels/blackboard/models.py +++ b/integrated_channels/blackboard/models.py @@ -97,6 +97,8 @@ def __repr__(self): class BlackboardEnterpriseCustomerConfiguration(EnterpriseCustomerPluginConfiguration): """ The Enterprise-specific configuration we need for integrating with Blackboard. + + .. no_pii: """ decrypted_client_id = EncryptedCharField( diff --git a/integrated_channels/canvas/models.py b/integrated_channels/canvas/models.py index 2620803f1f..56cd63f0c3 100644 --- a/integrated_channels/canvas/models.py +++ b/integrated_channels/canvas/models.py @@ -33,6 +33,8 @@ class CanvasEnterpriseCustomerConfiguration(EnterpriseCustomerPluginConfiguratio The Enterprise-specific configuration we need for integrating with Canvas. Based on: https://canvas.instructure.com/doc/api/file.oauth.html#oauth2-flow-3 + + .. no_pii: """ decrypted_client_id = EncryptedCharField( diff --git a/integrated_channels/integrated_channel/models.py b/integrated_channels/integrated_channel/models.py index 5ddaa37c36..a51f09b47b 100644 --- a/integrated_channels/integrated_channel/models.py +++ b/integrated_channels/integrated_channel/models.py @@ -457,6 +457,8 @@ def update_content_transmission_catalog(self, user): class GenericEnterpriseCustomerPluginConfiguration(EnterpriseCustomerPluginConfiguration): """ A generic implementation of EnterpriseCustomerPluginConfiguration which can be instantiated + + .. no_pii: """ def __str__(self): @@ -479,7 +481,7 @@ class ApiResponseRecord(TimeStampedModel): """ Api response data for learner and content metadata transmissions - .. no_pii; + .. no_pii: """ status_code = models.PositiveIntegerField( help_text='The most recent remote API call response HTTP status code', @@ -891,6 +893,8 @@ class OrphanedContentTransmissions(TimeStampedModel): """ A model to track content metadata transmissions that were successfully sent to the integrated channel but then subsequently were orphaned by a removal of their associated catalog from the customer. + + .. no_pii: """ class Meta: index_together = [('integrated_channel_code', 'plugin_configuration_id', 'resolved')] @@ -909,6 +913,8 @@ class Meta: class IntegratedChannelAPIRequestLogs(TimeStampedModel): """ A model to track basic information about every API call we make from the integrated channels. + + .. no_pii: """ enterprise_customer = models.ForeignKey(