|
| 1 | +.. _how_to_6: |
| 2 | + |
| 3 | +How To 6 - Configure Policy Rules |
| 4 | +================================= |
| 5 | + |
| 6 | +This chapter explains how to activate and configure the **Policy Rules Engine** for |
| 7 | +your Dataspace. Policy rules evaluate compliance conditions against your products |
| 8 | +automatically and record violations when thresholds are exceeded. |
| 9 | + |
| 10 | +All rules are disabled by default. You must explicitly enable the rules that are |
| 11 | +relevant to your compliance program and, optionally, adjust their parameters and |
| 12 | +thresholds. |
| 13 | + |
| 14 | +.. seealso:: |
| 15 | + Refer to :ref:`reference_policy_rules` for a complete description of all available |
| 16 | + rules, configuration options, and violation lifecycle. |
| 17 | + |
| 18 | +1. Access the Policy Rules Configuration |
| 19 | +---------------------------------------- |
| 20 | + |
| 21 | +1. From the DejaCode **Administration dashboard**, navigate to :guilabel:`Dataspaces`. |
| 22 | +2. Open your Dataspace by clicking on its name. |
| 23 | +3. Scroll down to the **Policy Rules Configuration** section. |
| 24 | + |
| 25 | +.. image:: images/howto-6-policy-rules-configuration/policy-rules-configuration-section.jpg |
| 26 | + |
| 27 | +Each built-in rule is listed with its label, description, threshold, and optional |
| 28 | +parameters. |
| 29 | + |
| 30 | +2. Enable a Rule |
| 31 | +---------------- |
| 32 | + |
| 33 | +To activate a rule check the :guilabel:`Enable this rule` checkbox. |
| 34 | + |
| 35 | +.. image:: images/howto-6-policy-rules-configuration/enable-rule-checkbox.jpg |
| 36 | + :width: 150 |
| 37 | + |
| 38 | +Click :guilabel:`Save` at the bottom of the Dataspace form. DejaCode will immediately |
| 39 | +schedule a background re-evaluation of all products in the Dataspace. |
| 40 | + |
| 41 | +To disable a rule, uncheck the :guilabel:`Enable this rule` checkbox and save. Any |
| 42 | +currently open violations for that rule are automatically resolved. |
| 43 | + |
| 44 | +.. note:: |
| 45 | + Rules that are not enabled are skipped during evaluation and any previously open |
| 46 | + violations for those rules are automatically resolved. |
| 47 | + |
| 48 | +3. Set a Threshold |
| 49 | +------------------ |
| 50 | + |
| 51 | +By default, a single violation is enough to trigger a rule. The :guilabel:`Threshold` |
| 52 | +field lets you tolerate a certain number of violations before a triggered state is |
| 53 | +recorded. Violations are only recorded when the count strictly exceeds the threshold. |
| 54 | + |
| 55 | +For example, setting a threshold of 2 on the **License Coverage Gap** rule means the |
| 56 | +rule is only triggered when more than 2 packages have no license expression. |
| 57 | + |
| 58 | +This is useful when a small number of violations is acceptable during remediation |
| 59 | +phases. |
| 60 | + |
| 61 | +4. Configure Rule Parameters |
| 62 | +---------------------------- |
| 63 | + |
| 64 | +Only vulnerability-based rules expose additional parameter fields to narrow their scope. |
| 65 | + |
| 66 | +For the **Vulnerability Detected** rule, you can set a :guilabel:`Min Risk Score` to |
| 67 | +restrict detection to vulnerabilities above a minimum risk score. Leave the field blank |
| 68 | +to flag any vulnerability regardless of score. |
| 69 | + |
| 70 | +For the **Vulnerability Stale** rule, two parameters are available: |
| 71 | + |
| 72 | +- :guilabel:`Max Days`: the maximum number of days a high-risk vulnerability may remain |
| 73 | + unaddressed before the package is flagged. Defaults to 30. |
| 74 | +- :guilabel:`Min Risk Score`: only vulnerabilities at or above this score are |
| 75 | + considered. Defaults to 8.0. |
| 76 | + |
| 77 | +.. image:: images/howto-6-policy-rules-configuration/vulnerability-rule-parameters.jpg |
| 78 | + :width: 300 |
| 79 | + |
| 80 | +5. Investigate Violations |
| 81 | +------------------------- |
| 82 | + |
| 83 | +Once rules are active and violations have been detected, DejaCode provides two levels |
| 84 | +of visibility. |
| 85 | + |
| 86 | +**Compliance Dashboard** |
| 87 | + |
| 88 | +The :guilabel:`Compliance Dashboard` is a dedicated page (accessible from the main |
| 89 | +menu) providing an overview of all products with their compliance metrics, including a |
| 90 | +**Policy violations** column showing the number of active violations per product. |
| 91 | +Use this view to identify at a glance which products have triggered rules and |
| 92 | +prioritize which ones to address first. |
| 93 | + |
| 94 | +.. image:: images/howto-6-policy-rules-configuration/compliance-dashboard-violations-column.jpg |
| 95 | + :width: 400 |
| 96 | + |
| 97 | +**Compliance tab drill-down** |
| 98 | + |
| 99 | +From the :guilabel:`Compliance Dashboard`, click the policy violations count on a |
| 100 | +product row to open its :guilabel:`Compliance` tab directly. |
| 101 | +The **Policy violations** panel lists each triggered rule with its violation count |
| 102 | +and detection date. |
| 103 | + |
| 104 | +.. image:: images/howto-6-policy-rules-configuration/compliance-tab-policy-violations.jpg |
| 105 | + |
| 106 | +.. tip:: |
| 107 | + To see the status of all active rules, including those that are not triggered, |
| 108 | + click the info icon next to the panel title. A modal opens showing every enabled |
| 109 | + rule with its current status: **Triggered** or **OK**. |
| 110 | + |
| 111 | +To drill into the affected packages for a specific rule: |
| 112 | + |
| 113 | +1. In the **Policy violations** panel, locate the rule you want to investigate. |
| 114 | +2. Click the violation count in the **In violation** column. |
| 115 | + |
| 116 | +The product inventory opens pre-filtered to show only the packages that triggered |
| 117 | +that rule. You can use the inventory's standard filters and sorting to prioritize |
| 118 | +remediation. |
| 119 | + |
| 120 | +6. Set Up Notifications |
| 121 | +----------------------- |
| 122 | + |
| 123 | +DejaCode can notify external systems automatically when policy violations are detected |
| 124 | +or resolved, without requiring manual checks of the compliance tab. |
| 125 | + |
| 126 | +Two webhook events are available: |
| 127 | + |
| 128 | +- ``policy.violation_detected``: fired when one or more new violations are detected |
| 129 | + during a rule evaluation run. |
| 130 | +- ``policy.violation_resolved``: fired when violations are resolved. |
| 131 | + |
| 132 | +To receive these notifications, configure a webhook in the Admin interface pointing to |
| 133 | +your target endpoint (Slack, ticketing system, CI/CD pipeline, or any HTTP receiver). |
| 134 | + |
| 135 | +.. seealso:: |
| 136 | + :ref:`integrations_webhook` for instructions on creating and configuring webhooks. |
0 commit comments