Make JsonMasker load mask keys from jars and be thread-safe
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 58/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Java
- Sterne
- 1.1k
- Forks
- 655
- Ø Merge
- 4 Std. 54 Min.
- Gemergte PRs (30 T.)
- 10
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus spring-cloud/spring-cloud-function
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
spring-cloud/spring-cloud-function#1542 ·
Maintainer antworten meist innerhalb von 1 Tag
-
GcfJarLayout omits GcfJarLauncher$NestedUrlStreamHandlerFactory, causing NoClassDefFoundError under the GCF invokerEvtl. vergeben @zemiles hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 32/100
spring-cloud/spring-cloud-function#1544 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
spring-cloud/spring-cloud-function#1538 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Kotlin function wrapper treats empty input as no inputEvtl. vergeben @seonwooj0810 hat das heute übernommen. Offen5.0.x backport bug
Schwierigkeit 3/5 Ein halber Tag Anfängerfreundlichkeit 30/100
spring-cloud/spring-cloud-function#1537 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Default JSON mapper collection limit is hard-coded and replaces all collection deserializationOffen5.0.x backport bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 22/100
spring-cloud/spring-cloud-function#1536 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in spring-cloud/spring-cloud-function
Ähnliche Issues
-
[FEAT] Lambda: support the nodejs26.x runtimeEvtl. vergeben @lBroth hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
floci-io/floci#9392 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
apache/camel-website#1872 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
area/backend component/c8-api kind/task
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug devops low
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag