diff options
-rw-r--r-- | SECURITY.md | 28 | ||||
-rw-r--r-- | src/main/java/com/beust/jcommander/IMainParameter.java | 25 | ||||
-rw-r--r-- | src/main/java/com/beust/jcommander/JCommander.java | 6 |
3 files changed, 56 insertions, 3 deletions
diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..327750e --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,28 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | GPG Signing Key | +| ---------------- | ------------------ | ---------------- | +| 1.83 | :white_check_mark: | 31D2D79DF7E85DD3 | +| 1.82 and earlier | :x: | ? | + +## Reporting a Vulnerability + +If you find a security vulnerability, please [open a Github issue](https://github.com/cbeust/jcommander/issues). + +We will try to publish a security fix on Maven Central ASAP after you reported it. + +There will be no frequently scheduled security updates. + +## GPG Signature Validation + +All artefacts are published on the Maven Central Repository accompanied by an *.asc GPG signature file. + +The GPG signing key used since v1.83 is found on [keyserver.ubuntu.com](https://keyserver.ubuntu.com/pks/lookup?search=1D85469D8559C2E1DF5F925131D2D79DF7E85DD3&fingerprint=on&op=index): +``` +pub rsa3072 2023-08-04 [SC] [expires: 2025-08-03] + 1D85 469D 8559 C2E1 DF5F 9251 31D2 D79D F7E8 5DD3 +uid [ultimate] Markus KARG <markus@headcrashing.eu> +sub rsa3072 2023-08-04 [E] [expires: 2025-08-03] +``` diff --git a/src/main/java/com/beust/jcommander/IMainParameter.java b/src/main/java/com/beust/jcommander/IMainParameter.java new file mode 100644 index 0000000..2443b55 --- /dev/null +++ b/src/main/java/com/beust/jcommander/IMainParameter.java @@ -0,0 +1,25 @@ +/** + * Copyright (C) 2024 the original author or authors. + * See the notice.md file distributed with this work for additional + * information regarding copyright ownership. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.beust.jcommander; + +public interface IMainParameter { + + ParameterDescription getDescription(); + +} diff --git a/src/main/java/com/beust/jcommander/JCommander.java b/src/main/java/com/beust/jcommander/JCommander.java index a822170..067929c 100644 --- a/src/main/java/com/beust/jcommander/JCommander.java +++ b/src/main/java/com/beust/jcommander/JCommander.java @@ -64,7 +64,7 @@ public class JCommander { * Description of a main parameter, which can be either a list of string or a single field. Both * are subject to converters before being returned to the user. */ - static class MainParameter { + static class MainParameter implements IMainParameter { /** * This field/method will contain whatever command line parameter is not an option. */ @@ -93,6 +93,7 @@ public class JCommander { private boolean firstTimeMainParameter = true; + @Override public ParameterDescription getDescription() { return description; } @@ -858,7 +859,6 @@ public class JCommander { // but the one assigned on the variable initialization), make it as assigned and // remove it from the list of parameters to be required if (parameterDescription.getDefault() != null && !parameterDescription.getParameterized().getType().isPrimitive()) { - fields.get(parameterDescription.getParameterized()).setAssigned(true); requiredFields.remove(parameterDescription.getParameterized()); } } @@ -1145,7 +1145,7 @@ public class JCommander { return descriptions; } - public MainParameter getMainParameter() { + public IMainParameter getMainParameter() { return mainParameter; } |