Skip to content

Commit 8b83b30

Browse files
committed
add documentation and changelog
Signed-off-by: NucleonGodX <[email protected]>
1 parent dd1d7d5 commit 8b83b30

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed

docs/policies.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,43 @@ Accepted values for the alert level:
9191
- ``warning``
9292
- ``error``
9393

94+
Creating Scorecard Thresholds Files
95+
-----------------------------------
96+
97+
A valid scorecard thresholds file is required to **enable OpenSSF Scorecard compliance features**.
98+
99+
The scorecard thresholds file, by default named ``policies.yml``, is a **YAML file** with a
100+
structure similar to the following:
101+
102+
.. code-block:: yaml
103+
104+
scorecard_score_thresholds:
105+
9.0: ok
106+
7.0: warning
107+
0: error
108+
109+
- In the example above, the keys ``9.0``, ``7.0``, and ``0`` are numeric threshold values
110+
representing **minimum scorecard scores**.
111+
- The values ``error``, ``warning``, and ``ok`` are the **compliance alert levels** that
112+
will be triggered if the project's scorecard score meets or exceeds the
113+
corresponding threshold.
114+
- The thresholds must be listed in **strictly descending order**.
115+
116+
How it works:
117+
118+
- If the scorecard score is **9.0 or above**, the alert is **``ok``**.
119+
- If the scorecard score is **7.0 to 8.9**, the alert is **``warning``**.
120+
- If the scorecard score is **below 7.0**, the alert is **``error``**.
121+
122+
You can adjust the threshold values and alert levels to match your organization's
123+
security compliance requirements.
124+
125+
Accepted values for the alert level:
126+
127+
- ``ok``
128+
- ``warning``
129+
- ``error``
130+
94131
App Policies
95132
------------
96133

docs/rest-api.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,31 @@ Data:
518518
"license_clarity_compliance_alert": "warning"
519519
}
520520
521+
.. _rest_api_scorecard_compliance:
522+
523+
Scorecard Compliance
524+
^^^^^^^^^^^^^^^^^^^^
525+
526+
This action returns the **scorecard compliance alert** for a project.
527+
528+
The scorecard compliance alert is a single value (``ok``, ``warning``, or ``error``)
529+
that summarizes the project's **OpenSSF Scorecard security compliance status**,
530+
based on the thresholds defined in the ``policies.yml`` file.
531+
532+
``GET /api/projects/6461408c-726c-4b70-aa7a-c9cc9d1c9685/scorecard_compliance/``
533+
534+
Data:
535+
- ``scorecard_compliance_alert``: The overall scorecard compliance alert
536+
for the project.
537+
538+
Possible values: ``ok``, ``warning``, ``error``.
539+
540+
.. code-block:: json
541+
542+
{
543+
"scorecard_compliance_alert": "warning"
544+
}
545+
521546
Reset
522547
^^^^^
523548

docs/tutorial_license_policies.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,51 @@ The ``license_clarity_compliance_alert`` value (e.g., ``"error"``, ``"warning"``
128128
is computed automatically based on the thresholds you configured and reflects the
129129
overall license clarity status of the scanned codebase.
130130

131+
Scorecard Compliance Thresholds and Alerts
132+
------------------------------------------
133+
134+
ScanCode.io also supports **OpenSSF Scorecard compliance thresholds**, allowing you to enforce
135+
minimum security standards for open source packages in your codebase. This is managed
136+
through the ``scorecard_score_thresholds`` section in your ``policies.yml`` file.
137+
138+
Defining Scorecard Thresholds
139+
-----------------------------
140+
141+
Add a ``scorecard_score_thresholds`` section to your ``policies.yml`` file, for example:
142+
143+
.. code-block:: yaml
144+
145+
scorecard_score_thresholds:
146+
9.0: ok
147+
7.0: warning
148+
0: error
149+
150+
Scorecard Compliance in Results
151+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
152+
153+
When you run a the addon pipeline fetch_scores with scorecard thresholds defined in your
154+
``policies.yml``, the computed scorecard compliance alert is included in the project's
155+
``extra_data`` field.
156+
157+
For example:
158+
159+
.. code-block:: json
160+
161+
"extra_data": {
162+
"md5": "d23df4a4",
163+
"sha1": "3e9b61cc98c",
164+
"size": 3095,
165+
"sha256": "abacfc8bcee59067",
166+
"sha512": "208f6a83c83a4c770b3c0",
167+
"filename": "cuckoo_filter-1.0.6.tar.gz",
168+
"sha1_git": "3fdb0f82ad59",
169+
"scorecard_compliance_alert": "warning"
170+
}
171+
172+
The ``scorecard_compliance_alert`` value (e.g., ``"error"``, ``"warning"``, or ``"ok"``)
173+
is computed automatically based on the thresholds you configured and reflects the
174+
overall security compliance status of the OpenSSF Scorecard scores for packages in the scanned codebase.
175+
131176
Run the ``check-compliance`` command
132177
------------------------------------
133178

0 commit comments

Comments
 (0)