diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-08-21 01:15:46 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-08-21 01:15:46 +1200 |
commit | 9fb1f19aab9e4535c1c208fdd3dc0e986940b160 (patch) | |
tree | c10454ce4180a2d5999ea587c90bdd9ff8d66229 /src/org/traccar/helper | |
parent | 901bcf5da82eb7d1370856ceb732397e8ef4c670 (diff) | |
download | trackermap-server-9fb1f19aab9e4535c1c208fdd3dc0e986940b160.tar.gz trackermap-server-9fb1f19aab9e4535c1c208fdd3dc0e986940b160.tar.bz2 trackermap-server-9fb1f19aab9e4535c1c208fdd3dc0e986940b160.zip |
Prevent PatternUtil in production
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r-- | src/org/traccar/helper/PatternUtil.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/org/traccar/helper/PatternUtil.java b/src/org/traccar/helper/PatternUtil.java index 12536eaef..1bbb166a6 100644 --- a/src/org/traccar/helper/PatternUtil.java +++ b/src/org/traccar/helper/PatternUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ package org.traccar.helper; +import java.lang.management.ManagementFactory; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; @@ -49,6 +50,10 @@ public final class PatternUtil { public static MatchResult checkPattern(String pattern, String input) { + if (!ManagementFactory.getRuntimeMXBean().getInputArguments().toString().contains("-agentlib:jdwp")) { + throw new RuntimeException("PatternUtil usage detected"); + } + MatchResult result = new MatchResult(); for (int i = 0; i < pattern.length(); i++) { |