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

[JENKINS-49027] Better report JEP-200 violations in Remoting #247

Merged
merged 2 commits into from
Jan 30, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 4 additions & 7 deletions src/main/java/hudson/remoting/Channel.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import java.lang.ref.WeakReference;
import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
import java.util.Date;
import java.util.Hashtable;
import java.util.Locale;
Expand Down Expand Up @@ -910,13 +909,11 @@ V call(Callable<V,T> callable) throws IOException, T, InterruptedException {

// re-wrap the exception so that we can capture the stack trace of the caller.
} catch (ClassNotFoundException e) {
IOException x = new IOException("Remote call on "+name+" failed");
x.initCause(e);
throw x;
throw new IOException("Remote call on " + name + " failed", e);
} catch (Error e) {
IOException x = new IOException("Remote call on "+name+" failed");
x.initCause(e);
throw x;
throw new IOException("Remote call on " + name + " failed", e);
} catch (SecurityException e) {
throw new IOException("Failed to deserialize response to " + request + ": " + e, e);
} finally {
// since this is synchronous operation, when the round trip is over
// we assume all the exported objects are out of scope.
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/hudson/remoting/ClassFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ public boolean isBlacklisted(@Nonnull Class c) {
* @throws SecurityException if it is blacklisted
*/
public final String check(String name) {
if (isBlacklisted(name))
throw new SecurityException("Rejected: " +name);
if (isBlacklisted(name)) {
throw new SecurityException("Rejected: " + name + "; see https://jenkins.io/redirect/class-filter/");
}
return name;
}

Expand All @@ -71,8 +72,9 @@ public final String check(String name) {
* @throws SecurityException if it is blacklisted
*/
public final Class check(Class c) {
if (isBlacklisted(c))
throw new SecurityException("Rejected: " +c.getName());
if (isBlacklisted(c)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: indentation looks off here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tabs vs. spaces. I can live with that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will refactor the entire class later

throw new SecurityException("Rejected: " + c.getName() + "; see https://jenkins.io/redirect/class-filter/");
}
return c;
}

Expand Down