Skip to content

Commit

Permalink
Merge pull request #110 from microsoftgraph/dev
Browse files Browse the repository at this point in the history
1.0.7 release
  • Loading branch information
baywet authored Jan 21, 2021
2 parents 76e3517 + 317c35f commit 22036b0
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 9 deletions.
9 changes: 9 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Microsoft Open Source Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

Resources:

- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [[email protected]](mailto:[email protected]) with questions or concerns
41 changes: 41 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK -->

## Security

Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).

If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.

## Reporting Security Issues

**Please do not report security vulnerabilities through public GitHub issues.**

Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).

If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).

You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.

## Preferred Languages

We prefer all communications to be in English.

## Policy

Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).

<!-- END MICROSOFT SECURITY.MD BLOCK -->
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mavenGroupId = com.microsoft.graph
mavenArtifactId = microsoft-graph-core
mavenMajorVersion = 1
mavenMinorVersion = 0
mavenPatchVersion = 6
mavenPatchVersion = 7
mavenArtifactSuffix =
nightliesUrl = http://dl.bintray.com/MicrosoftGraph/Maven

Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repositories {
dependencies {
// Include the sdk as a dependency
implementation 'com.microsoft.graph:microsoft-graph-core:1.0.6'
implementation 'com.microsoft.graph:microsoft-graph-core:1.0.7'
}
```

Expand All @@ -32,7 +32,7 @@ Add the dependency in `dependencies` in pom.xml
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph-core</artifactId>
<version>1.0.6</version>
<version>1.0.7</version>
</dependency>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public MSBatchRequestStep(String requestId, Request request, List<String> arrayO
if(requestId.length() == 0)
throw new IllegalArgumentException("Request Id cannot be empty.");
if(request == null)
new IllegalArgumentException("Request cannot be null.");
throw new IllegalArgumentException("Request cannot be null.");

this.requestId = requestId;
this.request = request;
Expand Down
11 changes: 7 additions & 4 deletions src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
public class TelemetryHandler implements Interceptor{

public static final String SDK_VERSION = "SdkVersion";
public static final String VERSION = "v1.0.6";
public static final String VERSION = "v1.0.7";
public static final String GRAPH_VERSION_PREFIX = "graph-java-core";
public static final String JAVA_VERSION_PREFIX = "java";
public static final String ANDROID_VERSION_PREFIX = "android";
public static final String CLIENT_REQUEST_ID = "client-request-id";
private static final String DEFAULT_VERSION_VALUE = "0";

@Override
public Response intercept(Chain chain) throws IOException {
Expand All @@ -30,7 +31,9 @@ public Response intercept(Chain chain) throws IOException {
final String featureUsage = "(featureUsage=" + telemetryOptions.getFeatureUsage() + ")";
final String javaVersion = System.getProperty("java.version");
final String androidVersion = getAndroidAPILevel();
final String sdkversion_value = GRAPH_VERSION_PREFIX + "/" + VERSION + " " + featureUsage + " " + JAVA_VERSION_PREFIX + "/" + javaVersion + " " + ANDROID_VERSION_PREFIX + "/" + androidVersion;
final String sdkversion_value = GRAPH_VERSION_PREFIX + "/" + VERSION + " " + featureUsage +
(javaVersion == DEFAULT_VERSION_VALUE ? "" : (", " + JAVA_VERSION_PREFIX + "/" + javaVersion)) +
(androidVersion == DEFAULT_VERSION_VALUE ? "" : (", " + ANDROID_VERSION_PREFIX + "/" + androidVersion));
telemetryAddedBuilder.addHeader(SDK_VERSION, sdkversion_value);

if(request.header(CLIENT_REQUEST_ID) == null) {
Expand Down Expand Up @@ -61,10 +64,10 @@ private String getAndroidAPILevelInternal() {
final Field sdkVersionField = versionClass.getField("SDK_INT");
final Object value = sdkVersionField.get(null);
final String valueStr = String.valueOf(value);
return valueStr == null || valueStr == "" ? "0" : valueStr;
return valueStr == null || valueStr == "" ? DEFAULT_VERSION_VALUE : valueStr;
} catch (IllegalAccessException | ClassNotFoundException | NoSuchFieldException ex) {
// we're not on android and return "0" to align with java version which returns "0" when running on android
return "0";
return DEFAULT_VERSION_VALUE;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Request authenticateRequest(Request request) {
final Response response = client.newCall(request).execute();
assertNotNull(response);
assertTrue(response.request().header(TelemetryHandler.SDK_VERSION).contains(expectedHeader));
assertTrue(response.request().header(TelemetryHandler.SDK_VERSION).contains(TelemetryHandler.ANDROID_VERSION_PREFIX));
assertTrue(!response.request().header(TelemetryHandler.SDK_VERSION).contains(TelemetryHandler.ANDROID_VERSION_PREFIX)); // Android version is not going to be present on unit tests runnning on java platform
assertTrue(response.request().header(TelemetryHandler.SDK_VERSION).contains(TelemetryHandler.JAVA_VERSION_PREFIX));
}

Expand Down

0 comments on commit 22036b0

Please sign in to comment.