Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Low] CSI plugin builds staging directories from storage_volume_id without a containment check

Aperta Adatta ai principianti
#2,935 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
backend, security

Direzione di ricerca

Leggi internal/volume/csi/plugin.go nei punti in cui stageVolume e unstageVolume costruiscono i percorsi, poi verifica come resources.ValidateStorageVolumeID convalida gli ID. Aggiungi la copertura per ../x e a/b nel test unitario pertinente e verifica che nessuna delle due operazioni di staging acceda a percorsi al di fuori del prefisso di staging.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area/security kind/bug

Summary

stageVolume and unstageVolume in the CSI volume plugin build the staging path as filepath.Join(p.stagingDirPrefix, volumeID), then MkdirAll and later remove it. storage_volume_id is only checked for control characters and length, so a value containing / or .. would resolve outside stagingDirPrefix. The ID comes from the CSI provisioner and control plane, not from tenants, so this is defense in depth.

Details

internal/volume/csi/plugin.go#L296-L299:

stagingPath := filepath.Join(p.stagingDirPrefix, req.VolumeID)
if err := os.MkdirAll(stagingPath, 0750); err != nil {
	return "", fmt.Errorf("failed to create staging directory %q: %w", stagingPath, err)
}

#L344: stagingPath := filepath.Join(p.stagingDirPrefix, volumeID) (unstage, followed by removal of the staging dir).

storage_volume_id (pkg/proto/ateapipb/ateapi.proto#L507-L519) is "the storage system's own" format, validated only by resources.ValidateStorageVolumeID (control characters).

Impact

Low: the value is set by the provisioner when it creates the volume, not by an actor or template. A misbehaving or compromised CSI driver could return an ID that makes atelet create or remove directories outside the staging prefix on the node.

Suggested fix

Derive the staging directory from a hash of the volume ID (as kubelet does) instead of the raw ID, or reject IDs where !filepath.IsLocal(id). Add a unit test with ../x and a/b.

Lingua principale
Go
Stelle
5k
Fork
563
Merge medio
2g 12h
PR unite (30g)
493

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di agent-substrate/substrate

Tutte le issue di agent-substrate/substrate

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.