SPDX IDs that differ only by case are treated as duplicates

Aberta
#463 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@soimkim já está trabalhando nisso.

Desde 19/11/2026.

  • #464 de @soimkim — aberto

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
58/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
java
Domínio
backend, databases

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
Java
Estrelas
72
Forks
45
Merge médio
1d 13h
PRs com merge (30d)
10

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de spdx/Spdx-Java-Library

Todas as issues de spdx/Spdx-Java-Library

Issues semelhantes

Mais issues de Java

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.