Skip to content

MantaClient.ILLEGAL_METADATA_HEADERS not exhaustive and only checked from putMetadata #274

Open
@tjcelaya

Description

@tjcelaya

It is possible for users to set encryption-related metadata. In some cases this metadata will simply be overridden (i.e. when passed alongside a regular PUT) but in other cases it will effectively make the object inaccessible. The following code snippet will make it impossible to read a file encrypted with CSE using AES/CTR/NoPadding by squashing it's plaintext length:

client.put(file, localBytes);

MantaMetadata metadata = new MantaMetadata();
metadata.put(MantaHttpHeaders.ENCRYPTION_PLAINTEXT_CONTENT_LENGTH, "illegal");
client.putMetadata(file, metadata);

leading to the following exception when attempting to fetch the object:

Exception in thread "main" java.lang.NumberFormatException: For input string: "illegal"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Long.parseLong(Long.java:589)
	at java.lang.Long.parseLong(Long.java:631)
	at com.joyent.manta.http.EncryptionHttpHelper.httpRequestAsInputStream(EncryptionHttpHelper.java:321)
	at com.joyent.manta.client.MantaClient.getAsInputStream(MantaClient.java:408)
	at com.joyent.manta.client.MantaClient.getAsInputStream(MantaClient.java:434)
	at co.tjcelaya.sandbox.App.main(App.java:110)

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions