Make JsonMasker load mask keys from jars and be thread-safe
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 58/100
Direzione di ricerca
Start in JsonMasker: the singleton INSTANCE() double-checked locking, the INSTANCE(Set) key loading via Files.readAllLines(Path.of(uri)), and mask(..) are all in the same class. Change resource loading to URL.openStream(), replace the TreeSet with a concurrent set, skip blank lines, and handle non-JSON byte[] and nested arrays in mask(..). Add tests that load META-INF/mask.keys from a jar plus cases for blank keys, byte[] input and arrays inside arrays; done when the existing directory-based tests still pass alongside the new ones.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
JsonMasker loads the keys to mask from META-INF/mask.keys resources using Files.readAllLines(Path.of(uri)). For a resource inside a jar (for example a fat jar deployed to AWS Lambda) the jar: URI cannot be converted to a Path unless a zip file system is already open, so loading fails, a warning is logged and the key set stays empty. As a result nothing is masked in packaged deployments. The existing tests do not notice because their mask.keys is loaded from a directory.
Related problems in the same class:
- the singleton field is not volatile, so the double-checked locking in
INSTANCE()does not guarantee safe publication - the set of keys is a plain
TreeSetthat is modified byINSTANCE(Set)while other threads may be reading it inmask(..) - a blank line in
mask.keysregisters an empty string as a key mask(..)throwsClassCastExceptionfor abyte[]input that is not JSON- an array nested directly inside an array is not searched for keys to mask
Proposed change:
- read the resources with
URL.openStream()so that they also work from jars - create the instance with a holder class and keep the keys in a concurrent set
- skip blank entries
- return the text for non-JSON
byte[]input - mask keys in nested arrays
- add tests for loading keys from a jar and for the cases above
Public method signatures stay the same.
- Lingua principale
- Java
- Stelle
- 1.1k
- Fork
- 655
- Merge medio
- 4h 54m
- PR unite (30g)
- 10
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di spring-cloud/spring-cloud-function
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
spring-cloud/spring-cloud-function#1542 ·
I maintainer di solito rispondono entro 1 giorno
-
GcfJarLayout omits GcfJarLauncher$NestedUrlStreamHandlerFactory, causing NoClassDefFoundError under the GCF invokerForse già presa @zemiles l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 32/100
spring-cloud/spring-cloud-function#1544 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
spring-cloud/spring-cloud-function#1538 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Kotlin function wrapper treats empty input as no inputForse già presa @seonwooj0810 l’ha presa oggi. Aperta5.0.x backport bug
Difficoltà 3/5 Mezza giornata Idoneità per principianti 30/100
spring-cloud/spring-cloud-function#1537 ·
I maintainer di solito rispondono entro 1 giorno
-
Default JSON mapper collection limit is hard-coded and replaces all collection deserializationAperta5.0.x backport bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
spring-cloud/spring-cloud-function#1536 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di spring-cloud/spring-cloud-function
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug devops low
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
enhancement
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
MDMesh-app/MDMesh#252 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
I maintainer di solito rispondono entro 1 giorno