From 31ae302314aac3979d9a6da38a7cf6a9efc6dca2 Mon Sep 17 00:00:00 2001 From: frantuma <frantuma@yahoo.com> Date: Thu, 26 Oct 2023 09:58:35 +0200 Subject: [PATCH 1/3] implement escapeQuotationMark in bash generator --- .../java/io/swagger/codegen/languages/BashClientCodegen.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/BashClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/BashClientCodegen.java index 487cb5c2e9e..3174ccf8285 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/BashClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/BashClientCodegen.java @@ -473,6 +473,8 @@ else if(collectionFormat.equals("pipes")) { } + + /** * Override with any special text escaping logic */ @@ -562,7 +564,8 @@ public String escapeText(String input) { @Override public String escapeQuotationMark(String input) { - return input; + // remove ' to avoid code injection + return input.replace("'", "\'\\\'\'"); } /** From d88d3f365c3cb2244d499bc32d084b501315ab53 Mon Sep 17 00:00:00 2001 From: frantuma <frantuma@yahoo.com> Date: Thu, 26 Oct 2023 09:58:48 +0200 Subject: [PATCH 2/3] update dependencies --- modules/swagger-codegen-cli/pom.xml | 2 +- modules/swagger-codegen-maven-plugin/pom.xml | 4 +-- modules/swagger-codegen/pom.xml | 2 +- modules/swagger-generator/pom.xml | 2 +- modules/swagger-generator/pom.xml.jenkins | 2 +- pom.xml | 14 +++++++++- pom.xml.jenkins | 28 ++++++++++++++------ 7 files changed, 39 insertions(+), 15 deletions(-) diff --git a/modules/swagger-codegen-cli/pom.xml b/modules/swagger-codegen-cli/pom.xml index 8aec33e8389..220c6cdd6c3 100644 --- a/modules/swagger-codegen-cli/pom.xml +++ b/modules/swagger-codegen-cli/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-project</artifactId> - <version>2.4.35</version> + <version>2.4.36-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/modules/swagger-codegen-maven-plugin/pom.xml b/modules/swagger-codegen-maven-plugin/pom.xml index 93748eb809d..027716613fe 100644 --- a/modules/swagger-codegen-maven-plugin/pom.xml +++ b/modules/swagger-codegen-maven-plugin/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-project</artifactId> - <version>2.4.35</version> + <version>2.4.36-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <artifactId>swagger-codegen-maven-plugin</artifactId> @@ -16,7 +16,7 @@ </prerequisites> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <maven.version>3.2.5</maven.version> + <maven.version>3.9.5</maven.version> </properties> <dependencies> <dependency> diff --git a/modules/swagger-codegen/pom.xml b/modules/swagger-codegen/pom.xml index d5523005cb1..f668698ddfb 100644 --- a/modules/swagger-codegen/pom.xml +++ b/modules/swagger-codegen/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-project</artifactId> - <version>2.4.35</version> + <version>2.4.36-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/modules/swagger-generator/pom.xml b/modules/swagger-generator/pom.xml index f658b44776a..2fbfe2fc7fe 100644 --- a/modules/swagger-generator/pom.xml +++ b/modules/swagger-generator/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-project</artifactId> - <version>2.4.35</version> + <version>2.4.36-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <artifactId>swagger-generator</artifactId> diff --git a/modules/swagger-generator/pom.xml.jenkins b/modules/swagger-generator/pom.xml.jenkins index fc9e86a2c9a..5c186f214fa 100644 --- a/modules/swagger-generator/pom.xml.jenkins +++ b/modules/swagger-generator/pom.xml.jenkins @@ -4,7 +4,7 @@ <parent> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-project</artifactId> - <version>2.4.35</version> + <version>2.4.36-SNAPSHOT</version> <relativePath>../..</relativePath> </parent> <artifactId>swagger-generator</artifactId> diff --git a/pom.xml b/pom.xml index a2b19f896c6..593cf71b5f2 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ <artifactId>swagger-codegen-project</artifactId> <packaging>pom</packaging> <name>swagger-codegen-project</name> - <version>2.4.35</version> + <version>2.4.36-SNAPSHOT</version> <url>https://github.com/swagger-api/swagger-codegen</url> <scm> <connection>scm:git:git@github.com:swagger-api/swagger-codegen.git</connection> @@ -965,6 +965,16 @@ <version>${mockito-version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>${httpclient-version}</version> + </dependency> + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + <version>${json-version}</version> + </dependency> </dependencies> </dependencyManagement> <repositories> @@ -997,5 +1007,7 @@ <mockito-version>5.6.0</mockito-version> <reflections-version>0.10.2</reflections-version> <snakeyaml-version>2.2</snakeyaml-version> + <httpclient-version>4.5.14</httpclient-version> + <json-version>20231013</json-version> </properties> </project> diff --git a/pom.xml.jenkins b/pom.xml.jenkins index df4d89bdfc9..b5ed8d3430c 100644 --- a/pom.xml.jenkins +++ b/pom.xml.jenkins @@ -9,7 +9,7 @@ <artifactId>swagger-codegen-project</artifactId> <packaging>pom</packaging> <name>swagger-codegen-project</name> - <version>2.4.35</version> + <version>2.4.36-SNAPSHOT</version> <url>https://github.com/swagger-api/swagger-codegen</url> <scm> <connection>scm:git:git@github.com:swagger-api/swagger-codegen.git</connection> @@ -990,6 +990,16 @@ <version>${mockito-version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>${httpclient-version}</version> + </dependency> + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + <version>${json-version}</version> + </dependency> </dependencies> </dependencyManagement> <repositories> @@ -1002,24 +1012,26 @@ </repository> </repositories> <properties> - <swagger-parser-version>1.0.67</swagger-parser-version> + <swagger-parser-version>1.0.68</swagger-parser-version> <scala-version>2.11.1</scala-version> <felix-version>3.3.0</felix-version> - <swagger-core-version>1.6.11</swagger-core-version> + <swagger-core-version>1.6.12</swagger-core-version> <commons-io-version>2.11.0</commons-io-version> <commons-cli-version>1.5.0</commons-cli-version> <junit-version>4.13.2</junit-version> - <jackson-version>2.15.2</jackson-version> + <jackson-version>2.15.3</jackson-version> <maven-plugin-version>1.0.0</maven-plugin-version> - <commons-lang-version>3.12.0</commons-lang-version> + <commons-lang-version>3.13.0</commons-lang-version> <slf4j-version>1.7.36</slf4j-version> <scala-maven-plugin-version>3.2.1</scala-maven-plugin-version> <jmustache-version>1.15</jmustache-version> - <testng-version>7.7.1</testng-version> + <testng-version>7.8.0</testng-version> <surefire-version>3.0.0</surefire-version> <jmockit-version>1.49</jmockit-version> - <mockito-version>5.2.0</mockito-version> + <mockito-version>5.6.0</mockito-version> <reflections-version>0.10.2</reflections-version> - <snakeyaml-version>2.0</snakeyaml-version> + <snakeyaml-version>2.2</snakeyaml-version> + <httpclient-version>4.5.14</httpclient-version> + <json-version>20231013</json-version> </properties> </project> From 6a195442759116a778e76cd8ff7bdac4ed21cce0 Mon Sep 17 00:00:00 2001 From: frantuma <frantuma@yahoo.com> Date: Thu, 26 Oct 2023 10:20:31 +0200 Subject: [PATCH 3/3] prepare release 2.4.36 --- README.md | 17 +++++++++-------- modules/swagger-codegen-cli/pom.xml | 2 +- modules/swagger-codegen-maven-plugin/pom.xml | 2 +- modules/swagger-codegen/pom.xml | 2 +- modules/swagger-generator/pom.xml | 2 +- modules/swagger-generator/pom.xml.jenkins | 2 +- pom.xml | 2 +- pom.xml.jenkins | 2 +- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index ec37205b3a7..b98fbd9dcff 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Build Status](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master-java7/badge/icon?subject=jenkins%20build%20-%20java%207)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master-java7/) -- Master (2.4.36-SNAPSHOT): [![Java Test](https://img.shields.io/jenkins/build.svg?jobUrl=https://jenkins.swagger.io/job/oss-swagger-codegen-master)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master) +- Master (2.4.37-SNAPSHOT): [![Java Test](https://img.shields.io/jenkins/build.svg?jobUrl=https://jenkins.swagger.io/job/oss-swagger-codegen-master)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-master) [![Windows Test](https://ci.appveyor.com/api/projects/status/github/swagger-api/swagger-codegen?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/swaggerhub-bot/swagger-codegen) - 3.0.51-SNAPSHOT: [![Java Test](https://img.shields.io/jenkins/build.svg?jobUrl=https://jenkins.swagger.io/job/oss-swagger-codegen-3)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swagger-codegen-3) @@ -50,7 +50,7 @@ dependency example: <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> - <version>2.4.35</version> + <version>2.4.36</version> </dependency> ``` @@ -183,9 +183,10 @@ Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes [3.0.2](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.2)| 2018-10-19 | 1.0, 1.1, 1.2, 2.0, 3.0 | Minor release [3.0.1](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.1)| 2018-10-05 | 1.0, 1.1, 1.2, 2.0, 3.0 | Major release with breaking changes [3.0.0](https://github.com/swagger-api/swagger-codegen/releases/tag/v3.0.0)| 2018-09-06 | 1.0, 1.1, 1.2, 2.0, 3.0 | Major release with breaking changes -2.4.36-SNAPSHOT (current master, upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/2.4.36-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0 | Minor release -[2.4.35](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.35) (**current stable**) | 2023-10-26 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.35](https://github.com/swagger-api/swagger-codegen/tree/v2.4.35) -[2.4.34](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.34) (**current stable**) | 2023-10-19 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.34](https://github.com/swagger-api/swagger-codegen/tree/v2.4.34) +2.4.37-SNAPSHOT (current master, upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/2.4.36-SNAPSHOT/)| TBD | 1.0, 1.1, 1.2, 2.0 | Minor release +[2.4.36](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.36) (**current stable**) | 2023-10-26 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.36](https://github.com/swagger-api/swagger-codegen/tree/v2.4.36) +[2.4.35](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.35) | 2023-10-26 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.35](https://github.com/swagger-api/swagger-codegen/tree/v2.4.35) +[2.4.34](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.34) | 2023-10-19 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.34](https://github.com/swagger-api/swagger-codegen/tree/v2.4.34) [2.4.33](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.33) | 2023-10-02 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.33](https://github.com/swagger-api/swagger-codegen/tree/v2.4.33) [2.4.32](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.32) | 2023-05-17 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.32](https://github.com/swagger-api/swagger-codegen/tree/v2.4.32) [2.4.31](https://github.com/swagger-api/swagger-codegen/releases/tag/v2.4.31) | 2023-04-02 | 1.0, 1.1, 1.2, 2.0 | [tag v2.4.31](https://github.com/swagger-api/swagger-codegen/tree/v2.4.31) @@ -233,7 +234,7 @@ If you're looking for the latest stable version, you can grab it directly from M ```sh # Download current stable 2.x.x branch (Swagger and OpenAPI version 2) -wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.35/swagger-codegen-cli-2.4.35.jar -O swagger-codegen-cli.jar +wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.36/swagger-codegen-cli-2.4.36.jar -O swagger-codegen-cli.jar java -jar swagger-codegen-cli.jar help @@ -243,7 +244,7 @@ wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3. java -jar swagger-codegen-cli.jar --help ``` -For Windows users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g. `Invoke-WebRequest -OutFile swagger-codegen-cli.jar https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.35/swagger-codegen-cli-2.4.35.jar` +For Windows users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g. `Invoke-WebRequest -OutFile swagger-codegen-cli.jar https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.36/swagger-codegen-cli-2.4.36.jar` On a mac, it's even easier with `brew`: ```sh @@ -391,7 +392,7 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \ ``` (if you're on Windows, replace the last command with `java -jar modules\swagger-codegen-cli\target\swagger-codegen-cli.jar generate -i https://petstore.swagger.io/v2/swagger.json -l php -o c:\temp\php_api_client`) -You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.35/swagger-codegen-cli-2.4.35.jar) +You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.36/swagger-codegen-cli-2.4.36.jar) To get a list of **general** options available, please run `java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar help generate` (for version 3.x check [3.0.0 branch](https://github.com/swagger-api/swagger-codegen/tree/3.0.0)) diff --git a/modules/swagger-codegen-cli/pom.xml b/modules/swagger-codegen-cli/pom.xml index 220c6cdd6c3..2ca5276bda8 100644 --- a/modules/swagger-codegen-cli/pom.xml +++ b/modules/swagger-codegen-cli/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-project</artifactId> - <version>2.4.36-SNAPSHOT</version> + <version>2.4.36</version> <relativePath>../..</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/modules/swagger-codegen-maven-plugin/pom.xml b/modules/swagger-codegen-maven-plugin/pom.xml index 027716613fe..11343e1f1de 100644 --- a/modules/swagger-codegen-maven-plugin/pom.xml +++ b/modules/swagger-codegen-maven-plugin/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-project</artifactId> - <version>2.4.36-SNAPSHOT</version> + <version>2.4.36</version> <relativePath>../..</relativePath> </parent> <artifactId>swagger-codegen-maven-plugin</artifactId> diff --git a/modules/swagger-codegen/pom.xml b/modules/swagger-codegen/pom.xml index f668698ddfb..c9b6e9561a8 100644 --- a/modules/swagger-codegen/pom.xml +++ b/modules/swagger-codegen/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-project</artifactId> - <version>2.4.36-SNAPSHOT</version> + <version>2.4.36</version> <relativePath>../..</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/modules/swagger-generator/pom.xml b/modules/swagger-generator/pom.xml index 2fbfe2fc7fe..049cbed408a 100644 --- a/modules/swagger-generator/pom.xml +++ b/modules/swagger-generator/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-project</artifactId> - <version>2.4.36-SNAPSHOT</version> + <version>2.4.36</version> <relativePath>../..</relativePath> </parent> <artifactId>swagger-generator</artifactId> diff --git a/modules/swagger-generator/pom.xml.jenkins b/modules/swagger-generator/pom.xml.jenkins index 5c186f214fa..5930f76556d 100644 --- a/modules/swagger-generator/pom.xml.jenkins +++ b/modules/swagger-generator/pom.xml.jenkins @@ -4,7 +4,7 @@ <parent> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-project</artifactId> - <version>2.4.36-SNAPSHOT</version> + <version>2.4.36</version> <relativePath>../..</relativePath> </parent> <artifactId>swagger-generator</artifactId> diff --git a/pom.xml b/pom.xml index 593cf71b5f2..02197936bef 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ <artifactId>swagger-codegen-project</artifactId> <packaging>pom</packaging> <name>swagger-codegen-project</name> - <version>2.4.36-SNAPSHOT</version> + <version>2.4.36</version> <url>https://github.com/swagger-api/swagger-codegen</url> <scm> <connection>scm:git:git@github.com:swagger-api/swagger-codegen.git</connection> diff --git a/pom.xml.jenkins b/pom.xml.jenkins index b5ed8d3430c..f7b5459b532 100644 --- a/pom.xml.jenkins +++ b/pom.xml.jenkins @@ -9,7 +9,7 @@ <artifactId>swagger-codegen-project</artifactId> <packaging>pom</packaging> <name>swagger-codegen-project</name> - <version>2.4.36-SNAPSHOT</version> + <version>2.4.36</version> <url>https://github.com/swagger-api/swagger-codegen</url> <scm> <connection>scm:git:git@github.com:swagger-api/swagger-codegen.git</connection>