Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth fix: don't ignore permission exception in parseEntry() #1380

Merged
merged 1 commit into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class GremlinAPI extends API {
@Status(Status.CREATED)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON_WITH_CHARSET)
@RolesAllowed({"admin", "$owner=$graph $action=gremlin_job_execute"})
@RolesAllowed({"admin", "$owner=$graph $action=gremlin_execute"})
public Map<String, Id> post(@Context GraphManager manager,
@PathParam("graph") String graph,
GremlinRequest request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import java.util.function.Consumer;
import java.util.function.Function;

import javax.ws.rs.ForbiddenException;

import org.apache.commons.collections.CollectionUtils;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Element;
Expand Down Expand Up @@ -1815,6 +1817,12 @@ private HugeVertex parseEntry(BackendEntry entry) {
HugeVertex vertex = this.serializer.readVertex(graph(), entry);
assert vertex != null;
return vertex;
} catch (ForbiddenException | SecurityException e) {
/*
* Can't ignore permission exception here, otherwise users will
* be confused to treat as the record does not exist.
*/
throw e;
} catch (Throwable e) {
LOG.error("Failed to parse entry: {}", entry, e);
if (this.ignoreInvalidEntry) {
Expand Down