Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ The [maintainer advisory](https://github.com/lovell/sharp/security/advisories/GH

Malformed, conflicting, qualified, prerelease and uncovered-future versions remain unknown. Contradictory Sharp/native-library observations also remain unknown. The embedded snapshot has no updater; consult the current vendor guidance for remediation.

Reports retain every distinct accepted exact Sharp and librsvg version in each
component's evidence detail, including conflicting observations. Repeated equal
values are deduplicated and sorted; qualified or malformed raw strings are not
exported. Retaining a candidate never selects it as the assessed version.

JSON, formula-neutralized CSV and a self-contained, script-free HTML report use the same validated evidence records. HTML supports escaped `--brand` and an optional bounded local raster `--logo`. See the [actual synthetic HTML example](docs/example-report.html); retained images in `docs/images/` are earlier concept artwork, not generated results.

## Documentation and development
Expand Down
2 changes: 1 addition & 1 deletion SHA256SUMS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
694c7078442ca6a7fae1da810adecf1dec28673b5b5d43aa41132e57f0903273 sharp_rsvg_rce_check.py
293da888b6c8cb667dc373f4a138dd94d9a76855a7420df5bca56a7aa252f593 sharp_rsvg_rce_check.py
dbcee01397d62d0017fea9319fcb8d59a36b5bf0dfe16556f890cca498c848f6 rules/snapshot.json
6 changes: 6 additions & 0 deletions docs/CONTRACT.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Security evidence contract v1.0

Sharp's `sharp-versions` and `librsvg-versions` inventory evidence details retain
each distinct accepted exact version, sorted and deduplicated within the input
limit of eight observations per component. Invalid/qualified raw text is omitted.
The existing bounded detail field carries this information in all renderers;
the schema shape and conservative conflict classification are unchanged.

Each checker repository owns its implementation, embedded advisory snapshot,
and copy of this contract. The executable is self-contained and does not import
another checker repository or a hosted rules service. The helpers are vendored
Expand Down
6 changes: 6 additions & 0 deletions docs/METHODOLOGY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ An operator must establish the input path and effective process configuration in
Use build records, native linkage evidence and documented vendor patch provenance from the deployment being assessed. Keep conflicting evidence together; do not delete it or relabel a build to obtain a fixed result. Consult current upstream/vendor guidance, rebuild and redeploy as appropriate, and verify the effective deployed process separately. There is no public-website mode because ordinary response metadata cannot answer these questions.

The 2026-10-25 adapters emit separate unknown records: neither an ELF layout hint nor a lexical block call is an established runtime precondition or mitigation. Metadata package versions do not attest library selection or provenance. See the reference for exact format coverage and bounds.

For explicit version observations, each component's exported evidence preserves
all distinct accepted exact values, including conflicts. Only validated stable
version strings are retained, never malformed or qualified raw text. This makes
distinct conflicts reproducible while keeping the selected version null and
the assessment unknown; it does not establish which version is deployed.
7 changes: 7 additions & 0 deletions docs/REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ python sharp_rsvg_rce_check.py --library-source global --librsvg-version 2.63.2

`--sharp-version` and `--librsvg-version` are repeatable (at most eight observations each). Repeated equal values agree; different values conflict. Accepted comparison values are plain three-part stable versions, without leading zeroes, whitespace, `v`, ranges, prereleases, vendor suffixes or build metadata. Invalid version text is not echoed in reports.

The `sharp-versions` and `librsvg-versions` evidence records retain their distinct
accepted exact values in the existing bounded `detail` string, sorted and
deduplicated. JSON, CSV's serialized evidence and HTML carry the same component
association. Accepted values are retained even alongside invalid observations;
the invalid raw strings are omitted and the assessment stays uncertain. This
uses the existing schema 1.0 evidence shape without a new field or schema change.

An explicit library selection is required for classification. `bundled` uses the Sharp threshold and Sharp provenance; `global` uses independent librsvg evidence and its own provenance. Supplying both sets of version evidence does not merge their identities. With a bundle, additional native-library evidence must have upstream provenance, stay within the reviewed 2.63 line and agree on the fix side; disagreement or possible backport evidence stays unknown. In global mode, missing Sharp metadata is allowed, but supplied malformed/conflicting Sharp observations keep the overall result unknown.

## JSON inventory
Expand Down
8 changes: 4 additions & 4 deletions docs/example-report.html

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion sharp_rsvg_rce_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,8 +1013,12 @@ def assess_record(raw):
"detail": "Operator-reported library selection: " + record["library_source"] + "; linkage is not independently verified."}]
for key, label in (("sharp_versions", "Sharp"), ("librsvg_versions", "librsvg")):
value, _, state = version_observation(record[key])
accepted = sorted({item for item in record[key] if exact_version(item) is not None})
detail = label + " version observation: " + (value if value else "missing, qualified or conflicting") + "."
if accepted:
detail += " Accepted exact observations: " + ", ".join(accepted) + "."
evidence.append({"id": key.replace("_", "-"), "kind": "inventory", "state": state,
"detail": label + " version observation: " + (value if value else "missing, qualified or conflicting") + "."})
"detail": detail})
platform, libc = record["platform"], record["libc"]
glibc = "absent" if platform == "other" or (platform == "linux" and libc in {"musl", "other"}) else "present" if platform == "linux" and libc == "glibc" else "unknown"
states = {
Expand Down
6 changes: 5 additions & 1 deletion src/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,12 @@ def assess_record(raw):
"detail": "Operator-reported library selection: " + record["library_source"] + "; linkage is not independently verified."}]
for key, label in (("sharp_versions", "Sharp"), ("librsvg_versions", "librsvg")):
value, _, state = version_observation(record[key])
accepted = sorted({item for item in record[key] if exact_version(item) is not None})
detail = label + " version observation: " + (value if value else "missing, qualified or conflicting") + "."
if accepted:
detail += " Accepted exact observations: " + ", ".join(accepted) + "."
evidence.append({"id": key.replace("_", "-"), "kind": "inventory", "state": state,
"detail": label + " version observation: " + (value if value else "missing, qualified or conflicting") + "."})
"detail": detail})
platform, libc = record["platform"], record["libc"]
glibc = "absent" if platform == "other" or (platform == "linux" and libc in {"musl", "other"}) else "present" if platform == "linux" and libc == "glibc" else "unknown"
states = {
Expand Down
82 changes: 82 additions & 0 deletions test_conflict_evidence.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
"""Offline conflict retention across public report formats."""
import contextlib
import csv
import io
import json
import unittest
from unittest.mock import patch

import sharp_rsvg_rce_check as check


class ConflictEvidenceTests(unittest.TestCase):
def report(self, sharp, native, fmt):
args = ['--library-source', 'global' if native else 'bundled',
'--sharp-build-source', 'upstream', '--librsvg-build-source', 'upstream',
'--format', fmt]
for value in sharp:
args += ['--sharp-version', value]
for value in native:
args += ['--librsvg-version', value]
out = io.StringIO()
with patch('socket.socket', side_effect=AssertionError('offline')), contextlib.redirect_stdout(out):
self.assertEqual(0, check.main(args))
return out.getvalue()

def test_both_components_retain_distinct_conflicts_in_all_formats(self):
for fmt in ('json', 'csv', 'html'):
with self.subTest(format=fmt):
text = self.report(['0.35.4', '0.35.5'], ['2.63.1', '2.63.2'], fmt)
for observation in ('Sharp version observation:', 'librsvg version observation:',
'0.35.4, 0.35.5', '2.63.1, 2.63.2'):
self.assertIn(observation, text)
if fmt == 'json':
result = json.loads(text)['results'][0]
elif fmt == 'csv':
result = next(csv.DictReader(io.StringIO(text)))
else:
self.assertIn('unknown', text)
self.assertIn('not_tested', text)
continue
self.assertEqual('unknown', result['status'])
self.assertEqual('not_tested', result['exploitability'])
if fmt == 'json':
self.assertIsNone(result['component']['version'])

def test_different_conflicting_pairs_are_distinguishable(self):
for fmt in ('json', 'csv', 'html'):
with self.subTest(format=fmt):
self.assertNotEqual(self.report(['0.35.4', '0.35.5'], [], fmt),
self.report(['0.35.3', '0.35.6'], [], fmt))
self.assertNotEqual(self.report([], ['2.63.1', '2.63.2'], fmt),
self.report([], ['2.63.0', '2.63.3'], fmt))

def test_qualified_or_secret_bearing_values_are_not_echoed(self):
unsafe = ['0.35.5+private-secret', '<private-secret>', '=private-secret']
for fmt in ('json', 'csv', 'html'):
with self.subTest(format=fmt):
text = self.report(['0.35.4'] + unsafe, ['2.63.2'] + unsafe, fmt)
self.assertIn('0.35.4', text)
self.assertIn('2.63.2', text)
self.assertNotIn('private-secret', text)
self.assertIn('unknown', text)
self.assertIn('not_tested', text)

def test_duplicate_and_reordered_observations_have_stable_evidence(self):
for fmt in ('json', 'csv', 'html'):
with self.subTest(format=fmt):
self.assertEqual(self.report(['0.35.5', '0.35.4', '0.35.4'], [], fmt),
self.report(['0.35.4', '0.35.5'], [], fmt))

def test_maximum_observations_preserve_bounded_validated_evidence(self):
versions = ['0.35.' + str(i) for i in range(8)]
result = check.assess_record({'asset_id': 'bounded', 'sharp_versions': versions})
check.validate_result(result)
detail = next(item['detail'] for item in result['evidence'] if item['id'] == 'sharp-versions')
for version in versions:
self.assertIn(version, detail)
self.assertLess(len(detail), 2048)


if __name__ == '__main__':
unittest.main()
Loading