From 1a32ad149b01d465ff9da6e6d67757a1aafed346 Mon Sep 17 00:00:00 2001 From: "Hassan D. M. Sambo" Date: Mon, 29 Jul 2024 12:33:51 -0400 Subject: [PATCH 1/2] Added logging for waiver actions (#4117) --- backend/audit/admin.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/backend/audit/admin.py b/backend/audit/admin.py index d8b19da38d..50494c1521 100644 --- a/backend/audit/admin.py +++ b/backend/audit/admin.py @@ -1,3 +1,4 @@ +import logging from django.conf import settings from django.contrib import admin, messages from audit.forms import SacValidationWaiverForm, UeiValidationWaiverForm @@ -18,6 +19,8 @@ from django.contrib.admin import SimpleListFilter from django.utils.translation import gettext_lazy as _ +logger = logging.getLogger(__name__) + class SACAdmin(admin.ModelAdmin): """ @@ -139,20 +142,32 @@ def save_model(self, request, obj, form, change): SingleAuditChecklist.STATUS.READY_FOR_CERTIFICATION, SingleAuditChecklist.STATUS.AUDITOR_CERTIFIED, ]: + logger.info( + f"User {request.user.email} is applying waiver for SAC with status: {sac.submission_status}" + ) self.handle_auditor_certification(request, obj, sac) self.handle_auditee_certification(request, obj, sac) + super().save_model(request, obj, form, change) + logger.info( + f"SAC {sac.report_id} updated successfully with waiver by user: {request.user.email}." + ) else: messages.set_level(request, messages.WARNING) messages.warning( request, f"Cannot apply waiver to SAC with status {sac.submission_status}. Expected status to be one of {SingleAuditChecklist.STATUS.READY_FOR_CERTIFICATION}, {SingleAuditChecklist.STATUS.AUDITOR_CERTIFIED}", ) - - super().save_model(request, obj, form, change) + logger.warning( + f"User {request.user.email} attempted to apply waiver to SAC with invalid status: {sac.submission_status}" + ) except Exception as e: messages.set_level(request, messages.ERROR) messages.error(request, str(e)) + logger.error( + f"Error saving SAC waiver by user {request.user.email}: {str(e)}", + exc_info=True, + ) def handle_auditor_certification(self, request, obj, sac): if SacValidationWaiver.TYPES.AUDITOR_CERTIFYING_OFFICIAL in obj.waiver_types: @@ -187,6 +202,9 @@ def handle_auditor_certification(self, request, obj, sac): event_user=request.user, event_type=SubmissionEvent.EventType.AUDITOR_CERTIFICATION_COMPLETED, ) + logger.info( + f"Auditor certification completed for SAC {sac.report_id} by user: {request.user.email}." + ) def handle_auditee_certification(self, request, obj, sac): if SacValidationWaiver.TYPES.AUDITEE_CERTIFYING_OFFICIAL in obj.waiver_types: @@ -220,6 +238,9 @@ def handle_auditee_certification(self, request, obj, sac): event_user=request.user, event_type=SubmissionEvent.EventType.AUDITEE_CERTIFICATION_COMPLETED, ) + logger.info( + f"Auditee certification completed for SAC {sac.report_id} by user: {request.user.email}." + ) class UeiValidationWaiverAdmin(admin.ModelAdmin): From e096c4c2a46fadb6e23fcfa8c372dffecd974868 Mon Sep 17 00:00:00 2001 From: James Person Date: Mon, 29 Jul 2024 13:38:15 -0400 Subject: [PATCH 2/2] NPM Dependency Updates 07292024 (#4124) * Bump eslint-plugin-prettier from 5.1.3 to 5.2.1 in /backend Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 5.1.3 to 5.2.1. - [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases) - [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v5.1.3...v5.2.1) --- updated-dependencies: - dependency-name: eslint-plugin-prettier dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump postcss from 8.4.39 to 8.4.40 in /backend Bumps [postcss](https://github.com/postcss/postcss) from 8.4.39 to 8.4.40. - [Release notes](https://github.com/postcss/postcss/releases) - [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md) - [Commits](https://github.com/postcss/postcss/compare/8.4.39...8.4.40) --- updated-dependencies: - dependency-name: postcss dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump eslint-plugin-cypress from 3.3.0 to 3.4.0 in /backend Bumps [eslint-plugin-cypress](https://github.com/cypress-io/eslint-plugin-cypress) from 3.3.0 to 3.4.0. - [Release notes](https://github.com/cypress-io/eslint-plugin-cypress/releases) - [Commits](https://github.com/cypress-io/eslint-plugin-cypress/compare/v3.3.0...v3.4.0) --- updated-dependencies: - dependency-name: eslint-plugin-cypress dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump @babel/eslint-parser from 7.24.8 to 7.25.1 in /backend Bumps [@babel/eslint-parser](https://github.com/babel/babel/tree/HEAD/eslint/babel-eslint-parser) from 7.24.8 to 7.25.1. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.25.1/eslint/babel-eslint-parser) --- updated-dependencies: - dependency-name: "@babel/eslint-parser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Bump eslint from 9.7.0 to 9.8.0 in /backend Bumps [eslint](https://github.com/eslint/eslint) from 9.7.0 to 9.8.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v9.7.0...v9.8.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- backend/package-lock.json | 64 +++++++++++++++++++-------------------- backend/package.json | 10 +++--- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/backend/package-lock.json b/backend/package-lock.json index 676a0e2d9f..2acc7e8c36 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -15,22 +15,22 @@ "esbuild-sass-plugin": "3.3.1", "glob": "11.0.0", "npm-run-all": "^4.1.5", - "postcss": "^8.4.39", + "postcss": "^8.4.40", "postcss-cli": "^11.0.0" }, "devDependencies": { "@4tw/cypress-drag-drop": "^2.2.5", - "@babel/eslint-parser": "^7.24.8", + "@babel/eslint-parser": "^7.25.1", "@eslint/js": "^9.7.0", "cypress": "^13.13.1", "cypress-axe": "^1.5.0", "cypress-downloadfile": "^1.2.4", "cypress-file-upload": "^5.0.8", "cypress-otp": "^1.0.3", - "eslint": "^9.7.0", + "eslint": "^9.8.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-cypress": "^3.3.0", - "eslint-plugin-prettier": "^5.1.3", + "eslint-plugin-cypress": "^3.4.0", + "eslint-plugin-prettier": "^5.2.1", "prettier": "^3.3.3", "stylelint": "^15.10.1", "stylelint-config-scss": "^1.0.0-security", @@ -120,9 +120,9 @@ } }, "node_modules/@babel/eslint-parser": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.24.8.tgz", - "integrity": "sha512-nYAikI4XTGokU2QX7Jx+v4rxZKhKivaQaREZjuW3mrJrbdWJ5yUfohnoUULge+zEEaKjPYNxhoRgUKktjXtbwA==", + "version": "7.25.1", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.25.1.tgz", + "integrity": "sha512-Y956ghgTT4j7rKesabkh5WeqgSFZVFwaPR0IWFm7KFHFmmJ4afbG49SmfW4S+GyRPx0Dy5jxEWA5t0rpxfElWg==", "dev": true, "dependencies": { "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", @@ -941,9 +941,9 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.17.0.tgz", - "integrity": "sha512-A68TBu6/1mHHuc5YJL0U0VVeGNiklLAL6rRmhTCP2B5XjWLMnrX+HkO+IAXyHvks5cyyY1jjK5ITPQ1HGS2EVA==", + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.17.1.tgz", + "integrity": "sha512-BlYOpej8AQ8Ev9xVqroV7a02JK3SkBAaN9GfMMH9W6Ch8FlQlkjGw4Ir7+FgYwfirivAf4t+GtzuAxqfukmISA==", "dev": true, "dependencies": { "@eslint/object-schema": "^2.1.4", @@ -990,9 +990,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.7.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.7.0.tgz", - "integrity": "sha512-ChuWDQenef8OSFnvuxv0TCVxEwmu3+hPNKvM9B34qpM0rDRbjL8t5QkQeHHeAfsKQjuH9wS82WeCi1J/owatng==", + "version": "9.8.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.8.0.tgz", + "integrity": "sha512-MfluB7EUfxXtv3i/++oh89uzAr4PDI4nn201hsp+qaXqsjAWzinlZEHEfPgAX4doIlKvPG/i0A9dpKxOLII8yA==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2920,16 +2920,16 @@ } }, "node_modules/eslint": { - "version": "9.7.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.7.0.tgz", - "integrity": "sha512-FzJ9D/0nGiCGBf8UXO/IGLTgLVzIxze1zpfA8Ton2mjLovXdAPlYDv+MQDcqj3TmrhAGYfOpz9RfR+ent0AgAw==", + "version": "9.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.8.0.tgz", + "integrity": "sha512-K8qnZ/QJzT2dLKdZJVX6W4XOwBzutMYmt0lqUS+JdXgd+HTYFlonFgkJ8s44d/zMPPCnOOk0kMWCApCPhiOy9A==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.11.0", - "@eslint/config-array": "^0.17.0", + "@eslint/config-array": "^0.17.1", "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.7.0", + "@eslint/js": "9.8.0", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.3.0", "@nodelib/fs.walk": "^1.2.8", @@ -2983,9 +2983,9 @@ } }, "node_modules/eslint-plugin-cypress": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-3.3.0.tgz", - "integrity": "sha512-HPHMPzYBIshzJM8wqgKSKHG2p/8R0Gbg4Pb3tcdC9WrmkuqxiKxSKbjunUrajhV5l7gCIFrh1P7C7GuBqH6YuQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-3.4.0.tgz", + "integrity": "sha512-Rrrr3Ri6wHqzrRr+TyUV7bDS4UnMMrFY1R1PP2F7XdGfe9txDC6lQEshyoNOWqGoPkbbeDm1x1XPc/adxemsnA==", "dev": true, "dependencies": { "globals": "^13.20.0" @@ -3022,13 +3022,13 @@ } }, "node_modules/eslint-plugin-prettier": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz", - "integrity": "sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz", + "integrity": "sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==", "dev": true, "dependencies": { "prettier-linter-helpers": "^1.0.0", - "synckit": "^0.8.6" + "synckit": "^0.9.1" }, "engines": { "node": "^14.18.0 || >=16.0.0" @@ -5753,9 +5753,9 @@ } }, "node_modules/postcss": { - "version": "8.4.39", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.39.tgz", - "integrity": "sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==", + "version": "8.4.40", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.40.tgz", + "integrity": "sha512-YF2kKIUzAofPMpfH6hOi2cGnv/HrUlfucspc7pDyvv7kGdqXrfj8SCl/t8owkEgKEuu8ZcRjSOxFxVLqwChZ2Q==", "funding": [ { "type": "opencollective", @@ -7590,9 +7590,9 @@ "dev": true }, "node_modules/synckit": { - "version": "0.8.8", - "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.8.tgz", - "integrity": "sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.1.tgz", + "integrity": "sha512-7gr8p9TQP6RAHusBOSLs46F4564ZrjV8xFmw5zCmgmhGUcw2hxsShhJ6CEiHQMgPDwAQ1fWHPM0ypc4RMAig4A==", "dev": true, "dependencies": { "@pkgr/core": "^0.1.0", diff --git a/backend/package.json b/backend/package.json index 363628c0ce..5a1ceeb6cf 100644 --- a/backend/package.json +++ b/backend/package.json @@ -24,17 +24,17 @@ "license": "ISC", "devDependencies": { "@4tw/cypress-drag-drop": "^2.2.5", - "@babel/eslint-parser": "^7.24.8", + "@babel/eslint-parser": "^7.25.1", "@eslint/js": "^9.7.0", "cypress": "^13.13.1", "cypress-axe": "^1.5.0", "cypress-downloadfile": "^1.2.4", "cypress-file-upload": "^5.0.8", "cypress-otp": "^1.0.3", - "eslint": "^9.7.0", + "eslint": "^9.8.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-cypress": "^3.3.0", - "eslint-plugin-prettier": "^5.1.3", + "eslint-plugin-cypress": "^3.4.0", + "eslint-plugin-prettier": "^5.2.1", "prettier": "^3.3.3", "stylelint": "^15.10.1", "stylelint-config-scss": "^1.0.0-security", @@ -48,7 +48,7 @@ "esbuild-sass-plugin": "3.3.1", "glob": "11.0.0", "npm-run-all": "^4.1.5", - "postcss": "^8.4.39", + "postcss": "^8.4.40", "postcss-cli": "^11.0.0" } }