Skip to content

Conversation

@jbaiera
Copy link
Member

@jbaiera jbaiera commented Sep 19, 2017

This PR is specific to the 5.x line, as #22793 in master and 6.x, while unrelated, fixes this problem.

When a user goes to list the available snapshots under a readonly HDFDS repository, before any other repository actions are performed, the requests will be met with a security exception. In this scenario, certain methods within the RPC layer have yet to be set accessible for usage in HDFS's dynamic-proxy-based RPC client. Normally, these methods would be set accessible during a privileged call in the validation step, but this process is skipped for readonly repositories. Instead, the security check is made to see if the code allows for supressAccessChecks. While the HDFS repository has these permissions, the core code base that is on the stack trace does not, and thus, a security exception is thrown for that permission.

This PR adds a reproducing test case for the behavior and backports the relevant portions of #22793 - Namely the HDFSPrivilegedInputStream. Additional validations of permissions within privileged blocks are added to the privileged input stream. These validations will be forward-ported to master in a different PR (link).

Relates #26513

jbaiera and others added 3 commits September 19, 2017 11:15
MiniHDFS will now start with an existing repository with a single snapshot contained within.
Readonly Repository is created in tests and attempts to list the snapshots within this repo.
Correcting typos...
…-hdfs (elastic#22793)"

Only pulled the relevant changes - such as the Priveleged input stream implementation for HDFS.
Limiting the permissions during privileged executions to the same ones used by the rest of the privileged code.
@risdenk
Copy link
Contributor

risdenk commented Sep 19, 2017

@jbaiera - Changes look good to me. Thanks for tracking this down!

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@Tim-Brooks Tim-Brooks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jbaiera jbaiera merged commit 985320f into elastic:5.6 Sep 21, 2017
@jbaiera jbaiera deleted the jbaiera-fix-readonlyhdfs branch September 21, 2017 15:31
jbaiera added a commit that referenced this pull request Sep 21, 2017
Listing the available snapshots under a readonly HDFDS repository before any other repository 
actions are performed is met with a security exception. Certain methods within the RPC layer are 
yet to be set accessible for usage in HDFS's dynamic-proxy-based RPC client. These methods 
would be set accessible during a privileged call in the validation step, but some validation steps 
are skipped for readonly repositories.

This backports the relevant parts of HDFSPrivilegedInputStream to allow for initializing steps that 
would otherwise not be allowed by the codesources found on the stack trace.
@clintongormley clintongormley added :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs and removed :Plugin Repository HDFS labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants