SPDX IDs that differ only by case are treated as duplicates

Offen
#463 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@soimkim arbeitet bereits daran.

Seit 19.11.2026.

  • #464 von @soimkim — offen

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
58/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
java
Bereich
backend, databases

Rechercherichtung

Start with src/main/java/org/spdx/storage/simple/InMemSpdxStore.java and trace how exists, create, getItem, delete, and getCaseSensitiveId form and look up map keys. Check the tests for InMemSpdxStore and add coverage for two SPDX IDs that differ only by case. Done means both IDs can be stored and resolved independently without a duplicate exception.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Summary

InMemSpdxStore stores each element under a lowercased object URI. Two SPDX IDs that differ only by letter case therefore collide, and create throws DuplicateSpdxIdException.

SPDX 2.3.1 treats those IDs as different. An SPDXID is SPDXRef- plus a unique idstring of letters, numbers, ., and -. The specification does not fold case. SPDXRef-Arcturus.ogg and SPDXRef-arcturus.ogg are two identifiers.

The element URI is [document namespace]#[SPDX identifier]. URI fragments are case-sensitive, so those two IDs are also different element URIs.

The 2.3.1 JSON schema allows both cases in one pattern: ^SPDXRef-[a-zA-Z0-9.-]+$.

Spec

Actual behavior

InMemSpdxStore in v2.0.5 uses the lowercased URI as the map key:

  • exists: typedValueMap.containsKey(objectUri.toLowerCase())
  • create: typedValueMap.putIfAbsent(typedValue.getObjectUri().toLowerCase(), value), then DuplicateSpdxIdException when the key is already present
  • getItem, delete, and getCaseSensitiveId also look up toLowerCase()

v1.1.10 does the same with id.toLowerCase(). Loading a document that contains both IDs fails there with:

org.spdx.library.model.DuplicateSpdxIdException: ID SPDXRef-system-product-media-audio-notifications-arcturus.ogg already exists.

That document has two different files:

  • SPDXRef-system-product-media-audio-notifications-Arcturus.ogg for /system/product/media/audio/notifications/Arcturus.ogg
  • SPDXRef-system-product-media-audio-notifications-arcturus.ogg for /system/product/media/audio/notifications/arcturus.ogg

Expected behavior

IDs that differ only by case are stored and resolved as different elements.

Code

https://github.com/spdx/Spdx-Java-Library/blob/v2.0.5/src/main/java/org/spdx/storage/simple/InMemSpdxStore.java

Vorherrschende Sprache
Java
Sterne
72
Forks
45
Ø Merge
1 T. 13 Std.
Gemergte PRs (30 T.)
10

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus spdx/Spdx-Java-Library

Alle Issues in spdx/Spdx-Java-Library

Ähnliche Issues

Weitere Issues zu Java

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.