Skip to content

Commit

Permalink
improve session id validation
Browse files Browse the repository at this point in the history
  • Loading branch information
artsiomkorzun committed Jan 14, 2025
1 parent b3dddf6 commit 59e0c3f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,14 @@ private ResourceDescriptor sessionResource(ProxyContext context, String sessionI
? ("user/" + sessionId)
: ("app/" + bucket.getAppBucket() + "/" + sessionId);

return ResourceDescriptorFactory.fromEncoded(ResourceTypes.CODE_INTERPRETER_SESSION,
ResourceDescriptor resource = ResourceDescriptorFactory.fromEncoded(ResourceTypes.CODE_INTERPRETER_SESSION,
bucket.getUserBucket(), bucket.getUserBucketLocation(), path);

if (resource.isFolder()) {
throw new IllegalArgumentException("Invalid resource");
}

return resource;
} catch (Throwable e) {
throw new IllegalArgumentException("Invalid sessionId: " + sessionId);
}
Expand Down

0 comments on commit 59e0c3f

Please sign in to comment.