Conversation
PG 8.3 introduced inv_truncate, and 9.3 made offsets/lengths 64 bit. What's nice is that the Java and JNI method signatures have always been 64-bit ready; now just stop downcasting to 32 on 9.3+ PostgreSQLs where 64 bit offsets are really accepted.
Ok, it seems that another change to the PostgreSQL large object APIs happened in PG 9.0: large objects got ACLs. Before that, anybody could access them. In PL/Java, anybody still can. :( The ideal accommodation on PL/Java's side will be to retarget PL/Java's LargeObject code from the PG inv_api.c layer to the be-fsstubs.c layer (if something doesn't make that prohibitively difficult), because that's where the 9.0+ access checks happen. Otherwise, the checking code needs to be duplicated in PL/Java. The fsstubs layer has only-good-within-one-transaction semantics. Happily, that's all that's expected for the JDBC *LOB interfaces, which presumably are the public API this stuff should ultimately have. Too involved for 1.5.0. However, this is a good argument for a least- privilege, no-public-by-default installation of the 'java' language, documenting how GRANT USAGE can then be used to allow specific users/roles to make PL/Java functions. Moral: this wasn't a problem before 9.0, when everybody knew LOBs had no access controls. It became a problem when PG added access controls for them, and PL/Java didn't follow suit. What's a trusted language today could need adjustments tomorrow, so no-public-usage-by-default really seems like the best posture; the user/installer should always be encouraged to follow the least privilege principle.
jcflack
added a commit
that referenced
this pull request
Feb 1, 2016
Merging expeditiously ... was just waiting for the number assignment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sync PL/Java's large-object code with PG (64-bit offsets, truncate).
In passing, noticed PL/Java won't honor ACLs on large objects, introduced in PG 9.0 (assigned CVE-2016-0768). Too much rework for 1.5.0 (ought to rewrite the affected code over a different PG API); instead, shift to a secure-by-default posture with
USAGE ON LANGUAGE javanot granted topublicby default, so it can be selectively granted to roles with that responsibility ... it's a good least-privilege-y idea anyway.