Skip to content

Commit 12d749f

Browse files
Maffoochclaude
andcommitted
fix: ruff E302 + drop cred refs from fixtures
- dojo/authorization/roles_permissions.py: add the second blank line before get_roles_with_permissions() that ruff's E302 demands. - Remove the now-orphan dojo.cred_user / dojo.cred_mapping entries from the three test fixtures, drop watson.searchentry rows pointing at those content types, and strip the gone enable_credentials field from System_Settings entries (the loaddata test was failing on it). The fixture normalization picks up small indentation diffs in unrelated sections (Python's json.dump uses one consistent indent) but the data is unchanged otherwise. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b0f866b commit 12d749f

4 files changed

Lines changed: 71 additions & 243 deletions

File tree

dojo/authorization/roles_permissions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ def get_product_api_scan_configuration_permissions(cls):
263263
Permissions.Product_API_Scan_Configuration_Delete,
264264
}
265265

266+
266267
def get_roles_with_permissions():
267268
return {
268269
Roles.Reader: {

dojo/fixtures/defect_dojo_sample_data.json

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,6 @@
797797
"enable_benchmark": true,
798798
"enable_calendar": true,
799799
"enable_checklists": true,
800-
"enable_credentials": true,
801800
"enable_deduplication": false,
802801
"enable_endpoint_metadata_import": true,
803802
"enable_finding_groups": true,
@@ -43206,60 +43205,6 @@
4320643205
"model": "watson.searchentry",
4320743206
"pk": 3
4320843207
},
43209-
{
43210-
"fields": {
43211-
"content": "",
43212-
"content_type": [
43213-
"dojo",
43214-
"cred_user"
43215-
],
43216-
"description": "",
43217-
"engine_slug": "default",
43218-
"meta_encoded": "{}",
43219-
"object_id": "3",
43220-
"object_id_int": 3,
43221-
"title": "Web Scan (Feb 23, 2022)",
43222-
"url": ""
43223-
},
43224-
"model": "watson.searchentry",
43225-
"pk": 4
43226-
},
43227-
{
43228-
"fields": {
43229-
"content": "",
43230-
"content_type": [
43231-
"dojo",
43232-
"cred_user"
43233-
],
43234-
"description": "",
43235-
"engine_slug": "default",
43236-
"meta_encoded": "{}",
43237-
"object_id": "13",
43238-
"object_id_int": 13,
43239-
"title": "Web Scan (Mar 26, 2022)",
43240-
"url": ""
43241-
},
43242-
"model": "watson.searchentry",
43243-
"pk": 5
43244-
},
43245-
{
43246-
"fields": {
43247-
"content": "",
43248-
"content_type": [
43249-
"dojo",
43250-
"cred_user"
43251-
],
43252-
"description": "",
43253-
"engine_slug": "default",
43254-
"meta_encoded": "{}",
43255-
"object_id": "14",
43256-
"object_id_int": 14,
43257-
"title": "Web Scan (Feb 23, 2022)",
43258-
"url": ""
43259-
},
43260-
"model": "watson.searchentry",
43261-
"pk": 6
43262-
},
4326343208
{
4326443209
"fields": {
4326543210
"content": "High Impact test finding None HIGH test finding test mitigation HIGH S0 None None None None None 5b0dead640b58a2b778aa2e8f5cccf67df7dc833b0c3f410985d1237615c86e7 ",
@@ -43602,60 +43547,6 @@
4360243547
"model": "watson.searchentry",
4360343548
"pk": 25
4360443549
},
43605-
{
43606-
"fields": {
43607-
"content": "",
43608-
"content_type": [
43609-
"dojo",
43610-
"cred_user"
43611-
],
43612-
"description": "",
43613-
"engine_slug": "default",
43614-
"meta_encoded": "{}",
43615-
"object_id": "3",
43616-
"object_id_int": 3,
43617-
"title": "Web Scan (Feb 23, 2022)",
43618-
"url": ""
43619-
},
43620-
"model": "watson.searchentry",
43621-
"pk": 26
43622-
},
43623-
{
43624-
"fields": {
43625-
"content": "",
43626-
"content_type": [
43627-
"dojo",
43628-
"cred_user"
43629-
],
43630-
"description": "",
43631-
"engine_slug": "default",
43632-
"meta_encoded": "{}",
43633-
"object_id": "13",
43634-
"object_id_int": 13,
43635-
"title": "Web Scan (Mar 26, 2022)",
43636-
"url": ""
43637-
},
43638-
"model": "watson.searchentry",
43639-
"pk": 27
43640-
},
43641-
{
43642-
"fields": {
43643-
"content": "",
43644-
"content_type": [
43645-
"dojo",
43646-
"cred_user"
43647-
],
43648-
"description": "",
43649-
"engine_slug": "default",
43650-
"meta_encoded": "{}",
43651-
"object_id": "14",
43652-
"object_id_int": 14,
43653-
"title": "Web Scan (Feb 23, 2022)",
43654-
"url": ""
43655-
},
43656-
"model": "watson.searchentry",
43657-
"pk": 28
43658-
},
4365943550
{
4366043551
"fields": {
4366143552
"content": "High Impact test finding None HIGH test finding test mitigation HIGH S0 None None None None None 5b0dead640b58a2b778aa2e8f5cccf67df7dc833b0c3f410985d1237615c86e7 ",

dojo/fixtures/dojo_testdata.json

Lines changed: 35 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -202,40 +202,40 @@
202202
"remote_addr": null,
203203
"timestamp": "2021-10-22T01:24:54.921Z",
204204
"additional_data": null
205-
}
206-
},
207-
{
208-
"model": "auditlog.logentry",
209-
"pk": 804,
210-
"fields": {
211-
"content_type": 28,
212-
"object_pk": "2",
213-
"object_id": 2,
214-
"object_repr": "Internal CRM App",
215-
"action": 0,
216-
"changes": "{\"product\": [\"None\", \"dojo.Cred_Mapping.None\"], \"product_meta\": [\"None\", \"dojo.DojoMeta.None\"], \"name\": [\"None\", \"Internal CRM App\"], \"description\": [\"None\", \"* New product in development that attempts to follow all best practices\"], \"product_manager\": [\"None\", \"(product_manager)\"], \"technical_contact\": [\"None\", \"(product_manager)\"], \"team_manager\": [\"None\", \"(user2)\"], \"prod_type\": [\"None\", \"Commerce\"], \"id\": [\"None\", \"2\"], \"tid\": [\"None\", \"0\"], \"business_criticality\": [\"None\", \"medium\"], \"platform\": [\"None\", \"web\"], \"lifecycle\": [\"None\", \"construction\"], \"origin\": [\"None\", \"internal\"], \"external_audience\": [\"None\", \"False\"], \"internet_accessible\": [\"None\", \"False\"], \"enable_simple_risk_acceptance\": [\"None\", \"False\"], \"enable_full_risk_acceptance\": [\"None\", \"True\"]}",
217-
"actor": null,
218-
"remote_addr": null,
219-
"timestamp": "2021-10-22T01:24:55.044Z",
220-
"additional_data": null
221-
}
222-
},
223-
{
224-
"model": "auditlog.logentry",
225-
"pk": 805,
226-
"fields": {
227-
"content_type": 28,
228-
"object_pk": "3",
229-
"object_id": 3,
230-
"object_repr": "Apple Accounting Software",
231-
"action": 0,
232-
"changes": "{\"product\": [\"None\", \"dojo.Cred_Mapping.None\"], \"product_meta\": [\"None\", \"dojo.DojoMeta.None\"], \"name\": [\"None\", \"Apple Accounting Software\"], \"description\": [\"None\", \"Accounting software is typically composed of various modules, different sections dealing with particular areas of accounting. Among the most common are:\\r\\n\\r\\n**Core modules**\\r\\n\\r\\n* Accounts receivable\\u2014where the company enters money received\\r\\n* Accounts payable\\u2014where the company enters its bills and pays money it owes\\r\\n* General ledger\\u2014the company's \\\"books\\\"\\r\\n* Billing\\u2014where the company produces invoices to clients/customers\"], \"product_manager\": [\"None\", \"(admin)\"], \"technical_contact\": [\"None\", \"(user2)\"], \"team_manager\": [\"None\", \"(user2)\"], \"prod_type\": [\"None\", \"Billing\"], \"id\": [\"None\", \"3\"], \"tid\": [\"None\", \"0\"], \"business_criticality\": [\"None\", \"high\"], \"platform\": [\"None\", \"web\"], \"lifecycle\": [\"None\", \"production\"], \"origin\": [\"None\", \"purchased\"], \"user_records\": [\"None\", \"5000\"], \"external_audience\": [\"None\", \"True\"], \"internet_accessible\": [\"None\", \"False\"], \"enable_simple_risk_acceptance\": [\"None\", \"False\"], \"enable_full_risk_acceptance\": [\"None\", \"True\"]}",
233-
"actor": null,
234-
"remote_addr": null,
235-
"timestamp": "2021-10-22T01:24:55.071Z",
236-
"additional_data": null
237-
}
238-
},
205+
}
206+
},
207+
{
208+
"model": "auditlog.logentry",
209+
"pk": 804,
210+
"fields": {
211+
"content_type": 28,
212+
"object_pk": "2",
213+
"object_id": 2,
214+
"object_repr": "Internal CRM App",
215+
"action": 0,
216+
"changes": "{\"product\": [\"None\", \"dojo.Cred_Mapping.None\"], \"product_meta\": [\"None\", \"dojo.DojoMeta.None\"], \"name\": [\"None\", \"Internal CRM App\"], \"description\": [\"None\", \"* New product in development that attempts to follow all best practices\"], \"product_manager\": [\"None\", \"(product_manager)\"], \"technical_contact\": [\"None\", \"(product_manager)\"], \"team_manager\": [\"None\", \"(user2)\"], \"prod_type\": [\"None\", \"Commerce\"], \"id\": [\"None\", \"2\"], \"tid\": [\"None\", \"0\"], \"business_criticality\": [\"None\", \"medium\"], \"platform\": [\"None\", \"web\"], \"lifecycle\": [\"None\", \"construction\"], \"origin\": [\"None\", \"internal\"], \"external_audience\": [\"None\", \"False\"], \"internet_accessible\": [\"None\", \"False\"], \"enable_simple_risk_acceptance\": [\"None\", \"False\"], \"enable_full_risk_acceptance\": [\"None\", \"True\"]}",
217+
"actor": null,
218+
"remote_addr": null,
219+
"timestamp": "2021-10-22T01:24:55.044Z",
220+
"additional_data": null
221+
}
222+
},
223+
{
224+
"model": "auditlog.logentry",
225+
"pk": 805,
226+
"fields": {
227+
"content_type": 28,
228+
"object_pk": "3",
229+
"object_id": 3,
230+
"object_repr": "Apple Accounting Software",
231+
"action": 0,
232+
"changes": "{\"product\": [\"None\", \"dojo.Cred_Mapping.None\"], \"product_meta\": [\"None\", \"dojo.DojoMeta.None\"], \"name\": [\"None\", \"Apple Accounting Software\"], \"description\": [\"None\", \"Accounting software is typically composed of various modules, different sections dealing with particular areas of accounting. Among the most common are:\\r\\n\\r\\n**Core modules**\\r\\n\\r\\n* Accounts receivable\\u2014where the company enters money received\\r\\n* Accounts payable\\u2014where the company enters its bills and pays money it owes\\r\\n* General ledger\\u2014the company's \\\"books\\\"\\r\\n* Billing\\u2014where the company produces invoices to clients/customers\"], \"product_manager\": [\"None\", \"(admin)\"], \"technical_contact\": [\"None\", \"(user2)\"], \"team_manager\": [\"None\", \"(user2)\"], \"prod_type\": [\"None\", \"Billing\"], \"id\": [\"None\", \"3\"], \"tid\": [\"None\", \"0\"], \"business_criticality\": [\"None\", \"high\"], \"platform\": [\"None\", \"web\"], \"lifecycle\": [\"None\", \"production\"], \"origin\": [\"None\", \"purchased\"], \"user_records\": [\"None\", \"5000\"], \"external_audience\": [\"None\", \"True\"], \"internet_accessible\": [\"None\", \"False\"], \"enable_simple_risk_acceptance\": [\"None\", \"False\"], \"enable_full_risk_acceptance\": [\"None\", \"True\"]}",
233+
"actor": null,
234+
"remote_addr": null,
235+
"timestamp": "2021-10-22T01:24:55.071Z",
236+
"additional_data": null
237+
}
238+
},
239239
{
240240
"pk": 1,
241241
"model": "dojo.system_settings",
@@ -3018,38 +3018,6 @@
30183018
"codename": "view_logentry"
30193019
}
30203020
},
3021-
{
3022-
"model": "dojo.cred_user",
3023-
"pk": 1,
3024-
"fields": {
3025-
"name": "Cred Product",
3026-
"username": "admin",
3027-
"password": "AES.1:2f3cb6d1d412a0552a46b67d972d14f5:6617146b4d29492551dfc62e4a697aca",
3028-
"role": "admin",
3029-
"authentication": "Form",
3030-
"http_authentication": "Basic",
3031-
"description": "test",
3032-
"url": "https://google.com",
3033-
"environment": 1,
3034-
"login_regex": null,
3035-
"logout_regex": null,
3036-
"is_valid": true,
3037-
"notes": []
3038-
}
3039-
},
3040-
{
3041-
"model": "dojo.cred_mapping",
3042-
"pk": 1,
3043-
"fields": {
3044-
"cred_id": 1,
3045-
"product": 1,
3046-
"finding": null,
3047-
"engagement": null,
3048-
"test": null,
3049-
"is_authn_provider": false,
3050-
"url": "https://google.com"
3051-
}
3052-
},
30533021
{
30543022
"model": "dojo.announcement",
30553023
"pk": 1,
@@ -3409,4 +3377,4 @@
34093377
"action": "N"
34103378
}
34113379
}
3412-
]
3380+
]

dojo/fixtures/dojo_testdata_locations.json

Lines changed: 35 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -202,40 +202,40 @@
202202
"remote_addr": null,
203203
"timestamp": "2021-10-22T01:24:54.921Z",
204204
"additional_data": null
205-
}
206-
},
207-
{
208-
"model": "auditlog.logentry",
209-
"pk": 804,
210-
"fields": {
211-
"content_type": 28,
212-
"object_pk": "2",
213-
"object_id": 2,
214-
"object_repr": "Internal CRM App",
215-
"action": 0,
216-
"changes": "{\"product\": [\"None\", \"dojo.Cred_Mapping.None\"], \"product_meta\": [\"None\", \"dojo.DojoMeta.None\"], \"name\": [\"None\", \"Internal CRM App\"], \"description\": [\"None\", \"* New product in development that attempts to follow all best practices\"], \"product_manager\": [\"None\", \"(product_manager)\"], \"technical_contact\": [\"None\", \"(product_manager)\"], \"team_manager\": [\"None\", \"(user2)\"], \"prod_type\": [\"None\", \"Commerce\"], \"id\": [\"None\", \"2\"], \"tid\": [\"None\", \"0\"], \"business_criticality\": [\"None\", \"medium\"], \"platform\": [\"None\", \"web\"], \"lifecycle\": [\"None\", \"construction\"], \"origin\": [\"None\", \"internal\"], \"external_audience\": [\"None\", \"False\"], \"internet_accessible\": [\"None\", \"False\"], \"enable_simple_risk_acceptance\": [\"None\", \"False\"], \"enable_full_risk_acceptance\": [\"None\", \"True\"]}",
217-
"actor": null,
218-
"remote_addr": null,
219-
"timestamp": "2021-10-22T01:24:55.044Z",
220-
"additional_data": null
221-
}
222-
},
223-
{
224-
"model": "auditlog.logentry",
225-
"pk": 805,
226-
"fields": {
227-
"content_type": 28,
228-
"object_pk": "3",
229-
"object_id": 3,
230-
"object_repr": "Apple Accounting Software",
231-
"action": 0,
232-
"changes": "{\"product\": [\"None\", \"dojo.Cred_Mapping.None\"], \"product_meta\": [\"None\", \"dojo.DojoMeta.None\"], \"name\": [\"None\", \"Apple Accounting Software\"], \"description\": [\"None\", \"Accounting software is typically composed of various modules, different sections dealing with particular areas of accounting. Among the most common are:\\r\\n\\r\\n**Core modules**\\r\\n\\r\\n* Accounts receivable\\u2014where the company enters money received\\r\\n* Accounts payable\\u2014where the company enters its bills and pays money it owes\\r\\n* General ledger\\u2014the company's \\\"books\\\"\\r\\n* Billing\\u2014where the company produces invoices to clients/customers\"], \"product_manager\": [\"None\", \"(admin)\"], \"technical_contact\": [\"None\", \"(user2)\"], \"team_manager\": [\"None\", \"(user2)\"], \"prod_type\": [\"None\", \"Billing\"], \"id\": [\"None\", \"3\"], \"tid\": [\"None\", \"0\"], \"business_criticality\": [\"None\", \"high\"], \"platform\": [\"None\", \"web\"], \"lifecycle\": [\"None\", \"production\"], \"origin\": [\"None\", \"purchased\"], \"user_records\": [\"None\", \"5000\"], \"external_audience\": [\"None\", \"True\"], \"internet_accessible\": [\"None\", \"False\"], \"enable_simple_risk_acceptance\": [\"None\", \"False\"], \"enable_full_risk_acceptance\": [\"None\", \"True\"]}",
233-
"actor": null,
234-
"remote_addr": null,
235-
"timestamp": "2021-10-22T01:24:55.071Z",
236-
"additional_data": null
237-
}
238-
},
205+
}
206+
},
207+
{
208+
"model": "auditlog.logentry",
209+
"pk": 804,
210+
"fields": {
211+
"content_type": 28,
212+
"object_pk": "2",
213+
"object_id": 2,
214+
"object_repr": "Internal CRM App",
215+
"action": 0,
216+
"changes": "{\"product\": [\"None\", \"dojo.Cred_Mapping.None\"], \"product_meta\": [\"None\", \"dojo.DojoMeta.None\"], \"name\": [\"None\", \"Internal CRM App\"], \"description\": [\"None\", \"* New product in development that attempts to follow all best practices\"], \"product_manager\": [\"None\", \"(product_manager)\"], \"technical_contact\": [\"None\", \"(product_manager)\"], \"team_manager\": [\"None\", \"(user2)\"], \"prod_type\": [\"None\", \"Commerce\"], \"id\": [\"None\", \"2\"], \"tid\": [\"None\", \"0\"], \"business_criticality\": [\"None\", \"medium\"], \"platform\": [\"None\", \"web\"], \"lifecycle\": [\"None\", \"construction\"], \"origin\": [\"None\", \"internal\"], \"external_audience\": [\"None\", \"False\"], \"internet_accessible\": [\"None\", \"False\"], \"enable_simple_risk_acceptance\": [\"None\", \"False\"], \"enable_full_risk_acceptance\": [\"None\", \"True\"]}",
217+
"actor": null,
218+
"remote_addr": null,
219+
"timestamp": "2021-10-22T01:24:55.044Z",
220+
"additional_data": null
221+
}
222+
},
223+
{
224+
"model": "auditlog.logentry",
225+
"pk": 805,
226+
"fields": {
227+
"content_type": 28,
228+
"object_pk": "3",
229+
"object_id": 3,
230+
"object_repr": "Apple Accounting Software",
231+
"action": 0,
232+
"changes": "{\"product\": [\"None\", \"dojo.Cred_Mapping.None\"], \"product_meta\": [\"None\", \"dojo.DojoMeta.None\"], \"name\": [\"None\", \"Apple Accounting Software\"], \"description\": [\"None\", \"Accounting software is typically composed of various modules, different sections dealing with particular areas of accounting. Among the most common are:\\r\\n\\r\\n**Core modules**\\r\\n\\r\\n* Accounts receivable\\u2014where the company enters money received\\r\\n* Accounts payable\\u2014where the company enters its bills and pays money it owes\\r\\n* General ledger\\u2014the company's \\\"books\\\"\\r\\n* Billing\\u2014where the company produces invoices to clients/customers\"], \"product_manager\": [\"None\", \"(admin)\"], \"technical_contact\": [\"None\", \"(user2)\"], \"team_manager\": [\"None\", \"(user2)\"], \"prod_type\": [\"None\", \"Billing\"], \"id\": [\"None\", \"3\"], \"tid\": [\"None\", \"0\"], \"business_criticality\": [\"None\", \"high\"], \"platform\": [\"None\", \"web\"], \"lifecycle\": [\"None\", \"production\"], \"origin\": [\"None\", \"purchased\"], \"user_records\": [\"None\", \"5000\"], \"external_audience\": [\"None\", \"True\"], \"internet_accessible\": [\"None\", \"False\"], \"enable_simple_risk_acceptance\": [\"None\", \"False\"], \"enable_full_risk_acceptance\": [\"None\", \"True\"]}",
233+
"actor": null,
234+
"remote_addr": null,
235+
"timestamp": "2021-10-22T01:24:55.071Z",
236+
"additional_data": null
237+
}
238+
},
239239
{
240240
"pk": 1,
241241
"model": "dojo.system_settings",
@@ -3043,38 +3043,6 @@
30433043
"codename": "view_logentry"
30443044
}
30453045
},
3046-
{
3047-
"model": "dojo.cred_user",
3048-
"pk": 1,
3049-
"fields": {
3050-
"name": "Cred Product",
3051-
"username": "admin",
3052-
"password": "AES.1:2f3cb6d1d412a0552a46b67d972d14f5:6617146b4d29492551dfc62e4a697aca",
3053-
"role": "admin",
3054-
"authentication": "Form",
3055-
"http_authentication": "Basic",
3056-
"description": "test",
3057-
"url": "https://google.com",
3058-
"environment": 1,
3059-
"login_regex": null,
3060-
"logout_regex": null,
3061-
"is_valid": true,
3062-
"notes": []
3063-
}
3064-
},
3065-
{
3066-
"model": "dojo.cred_mapping",
3067-
"pk": 1,
3068-
"fields": {
3069-
"cred_id": 1,
3070-
"product": 1,
3071-
"finding": null,
3072-
"engagement": null,
3073-
"test": null,
3074-
"is_authn_provider": false,
3075-
"url": "https://google.com"
3076-
}
3077-
},
30783046
{
30793047
"model": "dojo.announcement",
30803048
"pk": 1,
@@ -3434,4 +3402,4 @@
34343402
"action": "N"
34353403
}
34363404
}
3437-
]
3405+
]

0 commit comments

Comments
 (0)