question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remote execution of scripts with relative `@file:Include` statements fails

See original GitHub issue

Kscript 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:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
aartiPlcommented, Jun 23, 2022

This is now fixed in the 4.x version of kscript.

0reactions
holgerbrandlcommented, Feb 11, 2021

Thanks for the feedback

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found