This seems like a bug... ```writedump(getFileFromP...
# lucee
d
This seems like a bug...
Copy code
writedump(getFileFromPath("<s3://testbucket/APDF.pdf>"))
Result
Copy code
java.lang.RuntimeException
{SECRET_ACCESS_KEY}: Could not found accessKeyId / secretAccessKey. You can define the credentials as part of the path itself in various ways s3://{accessKeyId}:{SECRET_ACCESS_K.....
🤦 1
p
Are you utilizing um the S3 credentials that are required?
d
No, I certainly dont want a
getFileFromPath()
call to go anywhere near the actual S3 buckets
p
Then what is the bug, I am not following your issue
d
Anymore than I want a
getFileFromPath("/etc/passwd")
to access
/etc/passwd
There is no reason to actually access S3 to get the file from the path
p
Sounds like you need to place security restrictions on what Lucee has access to
d
I am fairly certain you dont understand the issue here
p
You are stating that a function shouldnt perform its actual operation based on a certain path you are giving it..."Extracts a filename from an absolute path."
d
Have a look at the tryCF gist
You think its acccessing C:/windows...etc to get that file path?
p
its right there in the example; gives you the filename from an absolute path....
d
Yes, I can run that anywhere I want, it will never ACTUALLY ACCESS
file.txt
where as, if you try it with S3, its checking the S3 credentials
where you dont need them, because it should never actually access s3
p
s3 is considered a virtual file system and the file system tools are built for use with it
your Lucee install apparently has permissions to reach c:/windows etc
d
What?? Please, have a look at the tryCF again
p
Since you arent being clear; are you stating, that function should NEVER access but merely read from the path provided and return the name?
d
Patrick, Im being as clear as I can be, the TryCF shows that the getfilefrompath function simply returns the filename from a path. It doesnt have to be an actual path, the file doesnt have to exist, unless you are suggesting that the server tryCF runs on actually has both
c:/windows/system32/test.dll
and
/etc/passwd
and that the Lucee instance that TryCF is running on has access to those files.
p
So yes, we are now on the same page. Appears using s3: in any of the file functions likely has some middle functionality for interactions with s3 related stuff
Not sure that I would consider that a bug rather than a security layer for s3
its likely that
getFileFromPath
is operating as expected but when s3: is picked up then additional functionality comes into play as seen there
d
It shouldnt, because its just a function to return the file part of a path
p
I understand your stance; just not sure what
s://
should be considered
d
It shouldnt be considered at all, any more than
Copy code
getFileFromPath("<mysql://var/mysql.sock>")
should try to open a MySQL connection
p
Like I said, I am torn on it. Because s3 is a file storage virtual path but that path needs auth against it. Yes same should occur if accessing a c:/windows type path if not authorized. But yea not sure, im 50/50
d
Consider this example, my app doesn't use S3 at all as a backend, but I let people store links to S3 bucket objects, or http links. Im my object table Im going to store the full path the customer adds, but on the display page, I want to display just the filename. This bug means you cannot do
getFileFromPath("<s3://customer-bucket/path/file.txt>")
, but you can do
getFileFromPath("<https://mysite.com/path/file.txt>")
The existence (or not) of the file in question should never be taken in to account, its a parsing function, not a filesystem function
p
Yea agree with you in that circumstance