Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: microsoft/kiota-java
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.7.2
Choose a base ref
...
head repository: microsoft/kiota-java
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.7.3
Choose a head ref

Commits on Sep 1, 2023

  1. Bump org.sonarqube in /components/authentication/azure

    Bumps org.sonarqube from 4.3.0.3225 to 4.3.1.3277.
    
    ---
    updated-dependencies:
    - dependency-name: org.sonarqube
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 1, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    800963d View commit details

Commits on Sep 2, 2023

  1. Merge pull request #600 from microsoft/dependabot/gradle/components/a…

    …uthentication/azure/org.sonarqube-4.3.1.3277
    
    Bump org.sonarqube from 4.3.0.3225 to 4.3.1.3277 in /components/authentication/azure
    github-actions[bot] authored Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    da5af71 View commit details
  2. Bump org.sonarqube in /components/serialization/json

    Bumps org.sonarqube from 4.3.0.3225 to 4.3.1.3277.
    
    ---
    updated-dependencies:
    - dependency-name: org.sonarqube
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    5a77309 View commit details
  3. Bump org.sonarqube in /components/serialization/multipart

    Bumps org.sonarqube from 4.3.0.3225 to 4.3.1.3277.
    
    ---
    updated-dependencies:
    - dependency-name: org.sonarqube
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b5093f8 View commit details
  4. Bump org.sonarqube in /components/http/okHttp

    Bumps org.sonarqube from 4.3.0.3225 to 4.3.1.3277.
    
    ---
    updated-dependencies:
    - dependency-name: org.sonarqube
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d7370fd View commit details
  5. Bump org.sonarqube in /components/abstractions

    Bumps org.sonarqube from 4.3.0.3225 to 4.3.1.3277.
    
    ---
    updated-dependencies:
    - dependency-name: org.sonarqube
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    5ac27be View commit details
  6. Merge pull request #598 from microsoft/dependabot/gradle/components/h…

    …ttp/okHttp/org.sonarqube-4.3.1.3277
    
    Bump org.sonarqube from 4.3.0.3225 to 4.3.1.3277 in /components/http/okHttp
    github-actions[bot] authored Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    5404a00 View commit details
  7. Merge pull request #599 from microsoft/dependabot/gradle/components/a…

    …bstractions/org.sonarqube-4.3.1.3277
    
    Bump org.sonarqube from 4.3.0.3225 to 4.3.1.3277 in /components/abstractions
    github-actions[bot] authored Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    5c6bbd0 View commit details
  8. Merge pull request #596 from microsoft/dependabot/gradle/components/s…

    …erialization/multipart/org.sonarqube-4.3.1.3277
    
    Bump org.sonarqube from 4.3.0.3225 to 4.3.1.3277 in /components/serialization/multipart
    github-actions[bot] authored Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    2c30573 View commit details
  9. Merge pull request #601 from microsoft/dependabot/gradle/components/s…

    …erialization/json/org.sonarqube-4.3.1.3277
    
    Bump org.sonarqube from 4.3.0.3225 to 4.3.1.3277 in /components/serialization/json
    github-actions[bot] authored Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1363708 View commit details
  10. Bump org.sonarqube in /components/serialization/form

    Bumps org.sonarqube from 4.3.0.3225 to 4.3.1.3277.
    
    ---
    updated-dependencies:
    - dependency-name: org.sonarqube
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    c135d2d View commit details
  11. Merge pull request #597 from microsoft/dependabot/gradle/components/s…

    …erialization/form/org.sonarqube-4.3.1.3277
    
    Bump org.sonarqube from 4.3.0.3225 to 4.3.1.3277 in /components/serialization/form
    github-actions[bot] authored Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    fa5a9d2 View commit details
  12. Bump org.sonarqube in /components/serialization/text

    Bumps org.sonarqube from 4.3.0.3225 to 4.3.1.3277.
    
    ---
    updated-dependencies:
    - dependency-name: org.sonarqube
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    81920e1 View commit details
  13. Merge pull request #595 from microsoft/dependabot/gradle/components/s…

    …erialization/text/org.sonarqube-4.3.1.3277
    
    Bump org.sonarqube from 4.3.0.3225 to 4.3.1.3277 in /components/serialization/text
    github-actions[bot] authored Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    332b6d2 View commit details
  14. #585 Prevent decoding of parameter values

    in the ParametersNameDecodingHandler Interceptor
    & write corresponding test case
    Avzel committed Sep 2, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    2346964 View commit details

Commits on Sep 4, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    99efc95 View commit details
  2. Bump io.github.std-uritemplate:std-uritemplate

    Bumps [io.github.std-uritemplate:std-uritemplate](https://github.com/std-uritemplate/std-uritemplate) from 0.0.31 to 0.0.38.
    - [Commits](std-uritemplate/std-uritemplate@0.0.31...0.0.38)
    
    ---
    updated-dependencies:
    - dependency-name: io.github.std-uritemplate:std-uritemplate
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 4, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    34b830c View commit details
  3. Bump actions/checkout from 3 to 4

    Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
    - [Release notes](https://github.com/actions/checkout/releases)
    - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
    - [Commits](actions/checkout@v3...v4)
    
    ---
    updated-dependencies:
    - dependency-name: actions/checkout
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 4, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    7472783 View commit details
  4. Bump io.github.std-uritemplate:std-uritemplate

    Bumps [io.github.std-uritemplate:std-uritemplate](https://github.com/std-uritemplate/std-uritemplate) from 0.0.31 to 0.0.38.
    - [Commits](std-uritemplate/std-uritemplate@0.0.31...0.0.38)
    
    ---
    updated-dependencies:
    - dependency-name: io.github.std-uritemplate:std-uritemplate
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 4, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    ce01951 View commit details

Commits on Sep 5, 2023

  1. Merge pull request #605 from microsoft/dependabot/gradle/components/a…

    …bstractions/io.github.std-uritemplate-std-uritemplate-0.0.38
    
    Bump io.github.std-uritemplate:std-uritemplate from 0.0.31 to 0.0.38 in /components/abstractions
    github-actions[bot] authored Sep 5, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    994a958 View commit details
  2. Merge pull request #604 from microsoft/dependabot/github_actions/acti…

    …ons/checkout-4
    
    Bump actions/checkout from 3 to 4
    andrueastman authored Sep 5, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    ff478c7 View commit details
  3. Merge pull request #603 from microsoft/dependabot/gradle/components/a…

    …bstractions/android/io.github.std-uritemplate-std-uritemplate-0.0.38
    
    Bump io.github.std-uritemplate:std-uritemplate from 0.0.31 to 0.0.38 in /components/abstractions/android
    github-actions[bot] authored Sep 5, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    46ff12f View commit details
  4. Merge pull request #602 from Avzel/main

    #585 Prevent decoding of parameter values in the ParametersNameDecodingHandler Interceptor & write corresponding test case
    andrueastman authored Sep 5, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    baywet Vincent Biret
    Copy the full SHA
    357171d View commit details
2 changes: 1 addition & 1 deletion .github/workflows/api-level-lint.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ jobs:
lint-api-level:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v3
with:
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
environment: maven_central_snapshot
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v3
with:
@@ -61,7 +61,7 @@ jobs:
runs-on: ubuntu-latest
environment: maven_central
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v3
with:
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
if: ${{ ( github.event_name == 'push' ) || ( github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login == 'microsoft' ) }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

## [0.7.3] - 2023-09-04

### Fixed

- Fixed bug that caused the ParametersNameDecodingHandler to decode query parameter values in addition to names

## [0.7.2] - 2023-09-01

### Changed
2 changes: 1 addition & 1 deletion components/abstractions/build.gradle
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ plugins {
id 'signing'
id 'jacoco'
id 'com.github.spotbugs' version '5.1.3'
id "org.sonarqube" version "4.3.0.3225"
id "org.sonarqube" version "4.3.1.3277"
}

java {
2 changes: 1 addition & 1 deletion components/abstractions/gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ dependencies {
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:32.1.2-jre'
implementation 'org.javatuples:javatuples:1.2'
implementation 'io.github.std-uritemplate:std-uritemplate:0.0.31'
implementation 'io.github.std-uritemplate:std-uritemplate:0.0.38'
implementation 'io.opentelemetry:opentelemetry-api:1.29.0'
implementation 'io.opentelemetry:opentelemetry-context:1.29.0'
implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'
2 changes: 1 addition & 1 deletion components/authentication/azure/build.gradle
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ plugins {
id 'signing'
id 'jacoco'
id 'com.github.spotbugs' version '5.1.3'
id "org.sonarqube" version "4.3.0.3225"
id "org.sonarqube" version "4.3.1.3277"
}

java {
2 changes: 1 addition & 1 deletion components/http/okHttp/build.gradle
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ plugins {
id 'signing'
id 'jacoco'
id 'com.github.spotbugs' version '5.1.3'
id "org.sonarqube" version "4.3.0.3225"
id "org.sonarqube" version "4.3.1.3277"
}

java {
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@
import java.util.Objects;
import java.util.AbstractMap.SimpleEntry;
import java.util.Map.Entry;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import jakarta.annotation.Nonnull;
import jakarta.annotation.Nullable;
@@ -61,7 +63,8 @@ public Response intercept(final Chain chain) throws IOException {
nameOption.parametersToDecode.length == 0) {
return chain.proceed(request);
}
String query = originalUri.query();
// Must use .encodedQuery() because .query() method decodes both parameter values and names
String query = originalUri.encodedQuery();
if (query == null || query.isEmpty()) {
return chain.proceed(request);
}
@@ -71,7 +74,8 @@ public Response intercept(final Chain chain) throws IOException {
if (span != null) {
builder.tag(Span.class, span);
}
final HttpUrl newUrl = originalUri.newBuilder().query(query).build();
// Must use .encodedQuery() because .query() method decodes both parameter values and names
final HttpUrl newUrl = originalUri.newBuilder().encodedQuery(query).build();
return chain.proceed(builder.url(newUrl).build());
} finally {
if (scope != null) {
@@ -91,15 +95,37 @@ public Response intercept(final Chain chain) throws IOException {
@Nonnull
public static String decodeQueryParameters(@Nullable final String original, @Nonnull final char[] charactersToDecode) {
Objects.requireNonNull(charactersToDecode);
String decoded = original == null ? "" : new StringBuffer(original).toString();

if (original == null || original.isBlank() || charactersToDecode.length == 0) {
return "";
}

String[] encodedQueryParameters =
(original.startsWith("?") ? original.substring(1) : original)
.split("&");

final ArrayList<SimpleEntry<String, String>> toDecode = new ArrayList<SimpleEntry<String, String>>();
for (final String encodedQueryParameter : encodedQueryParameters) {
String[] nameAndValue = encodedQueryParameter.split("=", 2);
// Use query parameter value as simple entry key and query parameter name as simple entry value to allow
// for in-place updating of query parameter name during iteration and prevent the need to add or remove keys.
// Note: query parameter values may not be unique, so a LinkedHashMap or equivalent would not be appropriate
toDecode.add(new SimpleEntry<String, String>(nameAndValue.length > 1 ? nameAndValue[1] : "", nameAndValue[0]));
}

final ArrayList<SimpleEntry<String, String>> symbolsToReplace = new ArrayList<SimpleEntry<String, String>>(charactersToDecode.length);
for (final char charToReplace : charactersToDecode) {
symbolsToReplace.add(new SimpleEntry<String,String>("%" + String.format("%x", (int)charToReplace), String.valueOf(charToReplace)));
symbolsToReplace.add(new SimpleEntry<String, String>("%" + String.format("%x", (int) charToReplace), String.valueOf(charToReplace)));
}

for (final Entry<String, String> symbolToReplace : symbolsToReplace) {
decoded = decoded.replace(symbolToReplace.getKey(), symbolToReplace.getValue());
for (final Entry<String, String> queryParameter : toDecode) {
queryParameter.setValue(queryParameter.getValue().replaceAll("(?i)"+Pattern.quote(symbolToReplace.getKey()), symbolToReplace.getValue()));
}
}
return decoded;

return toDecode.stream()
.map(tuple -> tuple.getKey().isBlank() ? tuple.getValue() : tuple.getValue() + "=" + tuple.getKey())
.collect(Collectors.joining("&"));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.microsoft.kiota.http;

import com.microsoft.kiota.http.middleware.ParametersNameDecodingHandler;
import com.microsoft.kiota.http.middleware.options.ParametersNameDecodingOption;

import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;
import java.util.stream.Stream;

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

public class ParametersNameDecodingHandlerTest {

private static Stream<Arguments> originalAndExpectedUrls() {
return Stream.of(
Arguments.of("https://www.google.com/", "https://www.google.com/"),
Arguments.of("https://www.google.com/?q=1%2B2", "https://www.google.com/?q=1%2B2"),
Arguments.of("https://www.google.com/?q=M%26A", "https://www.google.com/?q=M%26A"),
Arguments.of("https://www.google.com/?q%2D1=M%26A", "https://www.google.com/?q-1=M%26A"),
Arguments.of("https://www.google.com/?q%2D1&q=M%26A=M%26A", "https://www.google.com/?q-1&q=M%26A=M%26A")
);
}

@ParameterizedTest
@MethodSource("originalAndExpectedUrls")
public void defaultParameterNameDecodingHandlerOnlyDecodesNamesNotValues(String original, String expectedResult) throws IOException {
Interceptor[] interceptors = new Interceptor[] {
new ParametersNameDecodingHandler( new ParametersNameDecodingOption() {
{
parametersToDecode = new char[] { '$', '.', '-', '~', '+', '&' };
}
})
};
final OkHttpClient client = KiotaClientFactory.create(interceptors).build();
final Request request = new Request.Builder().url(original).build();
final Response response = client.newCall(request).execute();

assertNotNull(response);
assertEquals(expectedResult, response.request().url().toString());
}
}
2 changes: 1 addition & 1 deletion components/serialization/form/build.gradle
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ plugins {
id 'signing'
id 'jacoco'
id 'com.github.spotbugs' version '5.1.3'
id "org.sonarqube" version "4.3.0.3225"
id "org.sonarqube" version "4.3.1.3277"
}

java {
2 changes: 1 addition & 1 deletion components/serialization/json/build.gradle
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ plugins {
id 'signing'
id 'jacoco'
id 'com.github.spotbugs' version '5.1.3'
id "org.sonarqube" version "4.3.0.3225"
id "org.sonarqube" version "4.3.1.3277"
}

java {
2 changes: 1 addition & 1 deletion components/serialization/multipart/build.gradle
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ plugins {
id 'signing'
id 'jacoco'
id 'com.github.spotbugs' version '5.1.3'
id "org.sonarqube" version "4.3.0.3225"
id "org.sonarqube" version "4.3.1.3277"
}

java {
2 changes: 1 addition & 1 deletion components/serialization/text/build.gradle
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ plugins {
id 'signing'
id 'jacoco'
id 'com.github.spotbugs' version '5.1.3'
id "org.sonarqube" version "4.3.0.3225"
id "org.sonarqube" version "4.3.1.3277"
}

java {
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ org.gradle.caching=true
mavenGroupId = com.microsoft.kiota
mavenMajorVersion = 0
mavenMinorVersion = 7
mavenPatchVersion = 2
mavenPatchVersion = 3
mavenArtifactSuffix =

#These values are used to run functional tests