Policies are not appearing as expected in policy list view - JavaScript error on fetch policy details
Summary
As a User I want to have Scan Policies visible on group level where the policy is created and on all sub-groups and projects.
Background:
Created policy on group level should be visible to an UI user but few users reported that the policy is failing to load.
It is expected that the policy will be visible to all users on group level where policy is defined and all sub groups and projects.
Acceptance criteria:
Policy to be visible on UI.
Example of successful execution:
Example of unsuccessful execution:
The fullstack error from console:
TypeError: Cannot read properties of null (reading 'fullPath')
at a.policyListUrlArgs (policies_list.vue:237:1)
at fn (policies_list.vue:1:1835)
at Object.i [as namespace] (vue.runtime.esm.js:2404:66)
at render (sprintf.js:128:47)
at vue.runtime.esm.js:4357:32
at jr (vue.runtime.esm.js:4497:16)
at vue.runtime.esm.js:2916:21
at fn (vue.runtime.esm.js:2866:12)
at t._c (vue.runtime.esm.js:2635:44)
at fn (policies_list.vue:1:1655)
at i (vue.runtime.esm.js:2404:41)
at a.Te [as _t] (vue.runtime.esm.js:2082:13)
at fn (table.js:43:297)
at i (vue.runtime.esm.js:2404:41)
at u (normalize-slot.js:51:29)
at a.normalizeSlot (normalize-slot.js:24:20)
at a.renderTbodyRowCell (mixin-tbody-row.js:201:41)
at mixin-tbody-row.js:237:23
at Array.map (<anonymous>)
at a.renderTbodyRow (mixin-tbody-row.js:236:25)
at mixin-tbody.js:198:28
at Array.forEach (<anonymous>)
at a.renderTbody (mixin-tbody.js:196:15)
at a.render (mixin-table-renderer.js:151:35)
at t._render (vue.runtime.esm.js:2684:28)
at a.r (vue.runtime.esm.js:3875:27)
at t.get (vue.runtime.esm.js:3446:33)
at t.run (vue.runtime.esm.js:3522:30)
at mr (vue.runtime.esm.js:4121:17)
at Array.<anonymous> (vue.runtime.esm.js:3143:20)
at _n (vue.runtime.esm.js:3065:16)
GraphQL request:
[{"operationName":"groupScanExecutionPolicies","variables":{"relationship":"INHERITED","fullPath":"ubs-ag/gt/ise/devops-platforms/gitlab/aa45144-abc"},"query":"query groupScanExecutionPolicies($fullPath: ID!, $relationship: SecurityPolicyRelationType = INHERITED) {\n namespace: group(fullPath: $fullPath) {\n id\n scanExecutionPolicies(relationship: $relationship) {\n nodes {\n name\n yaml\n enabled\n source {\n ...SecurityPolicySource\n __typename\n }\n updatedAt\n __typename\n }\n __typename\n }\n __typename\n }\n}\n\nfragment SecurityPolicySource on SecurityPolicySource {\n ... on GroupSecurityPolicySource {\n inherited\n namespace {\n id\n fullPath\n name\n __typename\n }\n __typename\n }\n ... on ProjectSecurityPolicySource {\n project {\n fullPath\n __typename\n }\n __typename\n }\n __typename\n}\n"},{"operationName":"groupScanResultPolicies","variables":{"relationship":"INHERITED","fullPath":"ubs-ag/gt/ise/devops-platforms/gitlab/aa45144-abc"},"query":"query groupScanResultPolicies($fullPath: ID!, $relationship: SecurityPolicyRelationType = INHERITED) {\n namespace: group(fullPath: $fullPath) {\n id\n scanResultPolicies(relationship: $relationship) {\n nodes {\n name\n yaml\n enabled\n updatedAt\n userApprovers {\n id\n name\n webUrl\n __typename\n }\n groupApprovers {\n id\n fullPath\n webUrl\n __typename\n }\n roleApprovers\n source {\n ...SecurityPolicySource\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n}\n\nfragment SecurityPolicySource on SecurityPolicySource {\n ... on GroupSecurityPolicySource {\n inherited\n namespace {\n id\n fullPath\n name\n __typename\n }\n __typename\n }\n ... on ProjectSecurityPolicySource {\n project {\n fullPath\n __typename\n }\n __typename\n }\n __typename\n}\n"}]
GraphQL response:
[
{
"data": {
"namespace": {
"id": "gid://gitlab/Group/74922",
"scanExecutionPolicies": {
"nodes": [],
"__typename": "ScanExecutionPolicyConnection"
},
"__typename": "Group"
}
}
},
{
"data": {
"namespace": {
"id": "gid://gitlab/Group/74922",
"scanResultPolicies": {
"nodes": [
{
"name": "SI Scan Result Policy",
"yaml": "---\nname: SI Scan Result Policy\ndescription: |-\n This policy will enforce additional approval requirement from the Maintainer of the project if a secret is detected in an MR.\n The Maintainer is supposed to acknowledge the vulnerability in the project dashboard and make the decision on the MR.\nenabled: true\nactions:\n- type: require_approval\n approvals_required: 1\n role_approvers:\n - maintainer\nrules:\n- type: scan_finding\n branches: []\n scanners:\n - secret_detection\n vulnerabilities_allowed: 0\n severity_levels:\n - critical\n - high\n - medium\n - low\n - unknown\n - info\n vulnerability_states:\n - newly_detected\n - detected\n - confirmed\n",
"enabled": true,
"updatedAt": "2023-08-30T12:03:03+00:00",
"userApprovers": [],
"groupApprovers": [],
"roleApprovers": [
"MAINTAINER"
],
"source": {
"inherited": true,
"namespace": null,
"__typename": "GroupSecurityPolicySource"
},
"__typename": "ScanResultPolicy"
}
],
"__typename": "ScanResultPolicyConnection"
},
"__typename": "Group"
}
}
}
]
Steps to reproduce
Example Project
What is the current bug behavior?
What is the expected correct behavior?
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)