SPDX IDs that differ only by case are treated as duplicates

Ouverte
#463 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@soimkim y travaille déjà.

Depuis le 19/11/2026.

  • #464 par @soimkim — ouverte

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
58/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
java
Domaine
backend, databases

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
Java
Étoiles
72
Forks
45
Merge moyen
1 j 13 h
PR mergées (30 j)
10

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de spdx/Spdx-Java-Library

Toutes les issues de spdx/Spdx-Java-Library

Issues similaires

Plus d'issues Java

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.