Remote execution of scripts with relative `@file:Include` statements fails
See original GitHub issueKscript doesn’t interpret non-absolute URIs as being relative to a script when it’s remotely executed, leading to exceptions like the following.
Exception in thread "main" java.lang.IllegalArgumentException: URI is not absolute
at java.net.URI.toURL(URI.java:1088)
at kscript.app.ResolveIncludesKt.resolveIncludes(ResolveIncludes.kt:39)
at kscript.app.KscriptKt.main(Kscript.kt:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jetbrains.kotlin.runner.AbstractRunner.run(runners.kt:61)
at org.jetbrains.kotlin.runner.Main.run(Main.kt:110)
at org.jetbrains.kotlin.runner.Main.main(Main.kt:120)
kscript should, ideally, take @file:Include("foo.kt")
statements and, if executed from a script invoked via kscript https://foo.bar/baz/blah.kts
and interpret the foo.kt
reference as https://foo.bar/baz/foo.kt
Given that #219 improved relative referencing of @file:Include
it seems that this doesn’t take into account remote invocations.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
File Inclusion and Path Traversal - Web Applications Pentesting
File inclusion is the method for applications, and scripts, to include local or remote files during run-time. The vulnerability occurs when an application ......
Read more >Unable to execute a remote command with powershell
I want to execute a script on a remote computer that in turn calls other scripts with relative paths. The problem is that...
Read more >CWE-98: Improper Control of Filename for Include/Require ...
CWE-98: Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion') ; Integrity Confidentiality Availability.
Read more >include - Manual - PHP
It is possible to execute a return statement inside an included file in order to terminate processing in that file and return to...
Read more >Windows: can not run scripts starting with relative path #1729
Solution to make it runable on windows is to replace / slash with \\ when process.platform is win32 , but the problem is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is now fixed in the 4.x version of kscript.
Thanks for the feedback