Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 4e93082

Browse files
authored
Merge pull request #1207 from microsoft/jandupej/dos-fixes
Various fixes for DoS vulnerabilities.
2 parents b13fee1 + 8cbee0c commit 4e93082

File tree

219 files changed

+13524
-10796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+13524
-10796
lines changed

CHANGELOG.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ tag versions. The Bond compiler (`gbc`) and
1111
different versioning scheme, following the Haskell community's
1212
[package versioning policy](https://wiki.haskell.org/Package_versioning_policy).
1313

14-
## Unreleased ##
14+
## 11.0.1: 2024-06-26 ##
1515

16-
* IDL core version: TBD
17-
* C++ version: TBD (major bump needed)
18-
* C# NuGet version: TBD (major bump needed)
19-
* `gbc` & compiler library: TBD (major bump needed)
16+
* IDL core version: 3.0
17+
* C++ version: 11.0.1
18+
* C# NuGet version: 11.0.1
19+
* Java version: 11.0.1
20+
* `gbc` & compiler library: 0.13.0.0
2021

2122
### `gbc` and Bond compiler library ###
2223
* **Breaking change**: Codegen for Bond-over-gRPC has been removed: the
@@ -34,9 +35,22 @@ different versioning scheme, following the Haskell community's
3435
See [issue \#1131, Bond-over-gRPC will be deprecated February
3536
2022](https://github.com/microsoft/bond/issues/1131), for the full
3637
announcement.
38+
* By default, deserialization will no longer process very deeply nested
39+
structures. Instead, an `bond::CoreException` will be thrown in order to
40+
protect against stack overflows. The depth limit may be changed by calling
41+
the function `bond::SetDeserializeMaxDepth(uint32_t)`.
42+
* Fixed handling of large containers of invalid types that could cause
43+
excessive CPU use when deserializing some payloads.
3744

3845
### C# ###
3946

47+
* **Breaking change**: Update of Newtonsoft.Json library to version 13.3.0.
48+
([Issue \#1156](https://github.com/microsoft/bond/issues/1156))
49+
50+
This update fixes depth check in input JSON string (by default: 64).
51+
Depth check is necessary to prevent stack overflow issue with long payloads.
52+
* **Breaking change**: The minimum supported version of .NET Framework is
53+
4.6.2. Support for .NET Framework 4.5 has been dropped.
4054
* **Breaking change**: All Bond-over-gRPC code has been removed. This is
4155
everything under the `Bond.Grpc` namespace and the Bond.Grpc.CSharp NuGet
4256
package. Service definitions can still appear in .bond files, but no C#
@@ -48,6 +62,18 @@ different versioning scheme, following the Haskell community's
4862
[System.Collections.Immutable](https://learn.microsoft.com/dotnet/api/system.collections.immutable)
4963
collections. (Pull request
5064
[\#1161](https://github.com/microsoft/bond/pull/1161))
65+
* By default, deserialization will no longer process very deeply nested
66+
structures. Instead, an `InvalidOperationException` will be thrown in
67+
order to protect against stack overflows. The depth limit may be changed
68+
by setting the property `Bond.DeserializerControls.Active.MaxDepth`.
69+
70+
### Java ###
71+
72+
* By default, deserialization will no longer process very deeply nested
73+
structures. Instead, a `org.bondlib.InvalidBondDataException` exception
74+
will be thrown in order to protect against stack overflows. The depth
75+
limit may be changed by calling the method
76+
`org.bondlib.bond.DeserializerControls.setMaxDepth`.
5177

5278
## 10.0: 2022-03-07 ##
5379

README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ For details, see the User's Manuals:
1919
* [C#](https://microsoft.github.io/bond/manual/bond_cs.html)
2020
* [Java](https://microsoft.github.io/bond/manual/bond_java.html)
2121
* [Python](https://microsoft.github.io/bond/manual/bond_py.html)
22-
* [Bond-over-gRPC](https://microsoft.github.io/bond/manual/bond_over_grpc.html)
23-
([deprecated: will be removed in May
24-
2022](https://github.com/microsoft/bond/issues/1131))
2522
* [`gbc`, the Bond compiler/codegen tool](https://microsoft.github.io/bond/manual/compiler.html)
2623
* See also
2724
[the compiler library](https://hackage.haskell.org/package/bond) that
@@ -181,10 +178,10 @@ cmake .. \
181178

182179
Install the following tools:
183180

184-
- Visual Studio 2015 or 2017
185-
- VS2017 is required to build C# Bond from source
186-
- .NET Core SDK ([https://www.microsoft.com/net/core](https://www.microsoft.com/net/core#windows))
187-
- Alternative to VS2017 for building C# Bond from source
181+
- Visual Studio 2017 or newer. The following components are required:
182+
- .NET Framework 4.6.2 targeting pack
183+
- C++ development tools. A working C++ compiler is needed to build gbc.
184+
- .NET SDK ([https://dotnet.microsoft.com/en-us/download](https://dotnet.microsoft.com/en-us/download))
188185
- CMake ([http://www.cmake.org/download/](http://www.cmake.org/download/))
189186
- Haskell Stack ([https://docs.haskellstack.org/en/stable/install_and_upgrade/#windows](https://docs.haskellstack.org/en/stable/install_and_upgrade/#windows))
190187

@@ -199,7 +196,7 @@ Now you are ready to build the C# version of Bond. Open the solution file
199196
`cs\cs.sln` in Visual Studio and build as usual. The C# unit tests can
200197
also be run from within the solution.
201198

202-
To build using the .NET Core SDK:
199+
To build using the .NET SDK:
203200

204201
```bash
205202
dotnet restore cs\cs.sln
@@ -225,6 +222,22 @@ pre-built libraries are only needed for unit tests, and Python. If Boost or
225222
Python libraries are not found on the system, then some tests and examples
226223
will not be built.
227224

225+
You can also get an appropriate version of boost using the same approach as employed
226+
by CI. The appveyor.yml file includes an invocation of:
227+
```
228+
tools\ci-scripts\windows\Install-Boost.ps1 `
229+
-Version $env:BOND_BOOST `
230+
-VcToolSetVer $vcToolSetVer `
231+
-Components $boostComponents
232+
```
233+
which can also be invoked manually in order to download the relevant version, e.g.
234+
```
235+
Install-Boost.ps1 -Version 1.61.0 -VcToolSetVer 14.0
236+
```
237+
This will return the location to which the files were downloaded. It will be a temporary
238+
location, so you should subsequently copy the directories to a more permanent location and
239+
then configure your environment variables to point to those locations.
240+
228241
To generate a solution to build the Bond Core C++ and Python with Visual
229242
Studio 2015 run the following commands from the root `bond` directory:
230243

compiler/bond.cabal

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
cabal-version: 1.12
22

3-
-- This file has been generated from package.yaml by hpack version 0.34.4.
3+
-- This file has been generated from package.yaml by hpack version 0.35.0.
44
--
55
-- see: https://github.com/sol/hpack
6-
--
7-
-- hash: b3e1e8755f812c54ff2252111e7b261404f305c68fbcdde72babcd762faf6acb
86

97
name: bond
10-
version: 0.12.1.0
8+
version: 0.13.0.0
119
synopsis: Bond schema compiler and code generator
1210
description: Bond is a cross-platform framework for handling schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. . This package contains a library for parsing the Bond schema definition language and performing template-based code generation. The library includes built-in templates for generating standard Bond C++ and C# code, as well as utilities for writing custom codegen templates. . The package also contains a command-line compiler/codegen tool, named gbc, which is primarily used to generate code for C++ and C# programs using Bond.
1311
category: Language, Compiler, Code Generation
@@ -71,13 +69,13 @@ library
7169
, shakespeare
7270
, text
7371
, unordered-containers
72+
default-language: Haskell2010
7473
if os(windows) && arch(i386)
7574
ld-options: -Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware
7675
if os(windows) && arch(x86_64)
7776
ld-options: -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va
7877
if flag(warningsAsErrors)
7978
ghc-options: -Wall -Werror
80-
default-language: Haskell2010
8179

8280
executable gbc
8381
main-is: Main.hs
@@ -104,6 +102,7 @@ executable gbc
104102
, shakespeare
105103
, text
106104
, unordered-containers
105+
default-language: Haskell2010
107106
if os(windows) && arch(i386)
108107
ld-options: -Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware
109108
if os(windows) && arch(x86_64)
@@ -112,7 +111,6 @@ executable gbc
112111
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Werror
113112
else
114113
ghc-options: -threaded -rtsopts -with-rtsopts=-N
115-
default-language: Haskell2010
116114

117115
test-suite gbc-tests
118116
type: exitcode-stdio-1.0
@@ -153,6 +151,7 @@ test-suite gbc-tests
153151
, tasty-quickcheck
154152
, text
155153
, unordered-containers
154+
default-language: Haskell2010
156155
if os(windows) && arch(i386)
157156
ld-options: -Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware
158157
if os(windows) && arch(x86_64)
@@ -161,4 +160,3 @@ test-suite gbc-tests
161160
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Werror
162161
else
163162
ghc-options: -threaded -rtsopts -with-rtsopts=-N
164-
default-language: Haskell2010

compiler/package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: bond
2-
version: 0.12.1.0
2+
version: 0.13.0.0
33
github: "microsoft/bond"
44
license: MIT
55
author: Adam Sapek <[email protected]>

compiler/src/Language/Bond/Codegen/Cpp/Types_h.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ types_h export_attribute userHeaders enumHeader allocator alloc_ctors_enabled ty
3939
#{newlineBeginSep 0 includeHeader userHeaders}
4040
#include <bond/core/bond_version.h>
4141

42-
#if BOND_VERSION < 0x0902
42+
#if BOND_VERSION < 0x0b00
4343
#error This file was generated by a newer version of the Bond compiler and is incompatible with your version of the Bond library.
4444
#endif
4545

compiler/stack.yaml.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ packages:
77
- completed:
88
hackage: quickcheck-arbitrary-template-0.2.1.0@sha256:01f9deb34f8af3e6b879ee984b0be8803eb9c31e389490b5ddb8ca5fde32957c,2026
99
pantry-tree:
10-
size: 625
1110
sha256: a79d0b9f39f1096774a34f502c209dc70c85bc43f164e2925cb6b7a3f7ad82c8
11+
size: 625
1212
original:
1313
hackage: quickcheck-arbitrary-template-0.2.1.0
1414
snapshots:
1515
- completed:
16+
sha256: 16f24be248b42c9e16d59db84378836b1e7c239448a041cae46d32daffa45a8b
1617
size: 523884
1718
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/4.yaml
18-
sha256: 16f24be248b42c9e16d59db84378836b1e7c239448a041cae46d32daffa45a8b
1919
original: lts-14.4

compiler/tests/generated/alias_key_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
#include <bond/core/bond_version.h>
55

6-
#if BOND_VERSION < 0x0902
6+
#if BOND_VERSION < 0x0b00
77
#error This file was generated by a newer version of the Bond compiler and is incompatible with your version of the Bond library.
88
#endif
99

10-
#if BOND_MIN_CODEGEN_VERSION > 0x0c10
10+
#if BOND_MIN_CODEGEN_VERSION > 0x0d00
1111
#error This file was generated by an older version of the Bond compiler and is incompatible with your version of the Bond library.
1212
#endif
1313

compiler/tests/generated/alias_with_allocator_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
#include <bond/core/bond_version.h>
55

6-
#if BOND_VERSION < 0x0902
6+
#if BOND_VERSION < 0x0b00
77
#error This file was generated by a newer version of the Bond compiler and is incompatible with your version of the Bond library.
88
#endif
99

10-
#if BOND_MIN_CODEGEN_VERSION > 0x0c10
10+
#if BOND_MIN_CODEGEN_VERSION > 0x0d00
1111
#error This file was generated by an older version of the Bond compiler and is incompatible with your version of the Bond library.
1212
#endif
1313

compiler/tests/generated/aliases_types.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace tests
1818
using System.Collections.Generic;
1919

2020
[global::Bond.Schema]
21-
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")]
21+
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.13.0.0")]
2222
public partial class Foo<T>
2323
{
2424
[global::Bond.Id(0), global::Bond.Type(typeof(List<List<global::Bond.Tag.classT>>))]
@@ -34,14 +34,14 @@ protected Foo(string fullName, string name)
3434
}
3535
}
3636

37-
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")]
37+
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.13.0.0")]
3838
public enum EnumToWrap
3939
{
4040
anEnumValue,
4141
}
4242

4343
[global::Bond.Schema]
44-
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.12.1.0")]
44+
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.13.0.0")]
4545
public partial class WrappingAnEnum
4646
{
4747
[global::Bond.Id(0)]

compiler/tests/generated/aliases_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
#include <bond/core/bond_version.h>
55

6-
#if BOND_VERSION < 0x0902
6+
#if BOND_VERSION < 0x0b00
77
#error This file was generated by a newer version of the Bond compiler and is incompatible with your version of the Bond library.
88
#endif
99

10-
#if BOND_MIN_CODEGEN_VERSION > 0x0c10
10+
#if BOND_MIN_CODEGEN_VERSION > 0x0d00
1111
#error This file was generated by an older version of the Bond compiler and is incompatible with your version of the Bond library.
1212
#endif
1313

0 commit comments

Comments
 (0)