RESTler is the first stateful REST API fuzzing tool for automatically testing cloud services through their REST APIs and finding security and reliability bugs in these services.
MIT License
2.59k
stars
296
forks
source link
Compilation fails sometimes for path named "/s/" #703
I have found interesting edge case - in some cases compilation fails when path name is specific.
I've provided a file with single path /s/ which fails during compilation. If I change the name of that path to /r/ compilation works fine.
I'm using a Docker container built by running docker build . -t restler:latest using latest restler-fuzzer code (at revision c0c7c53f4fe7daedb381b1d0bfd4833ddc81b40a).
During preparation of this minimal reproduction, I've found that adding at leas one parameter is required to force a fail during compilation.
Execute Restler compile --api_spec openapi.json.
Expected results
Compilation suceeds.
Actual results
Compilation fails with:
Starting task Compile...
ERROR: Compiler failed. See logs in /app/Compile directory for more information.
Task Compile failed.
Collecting logs...
Compile/StdErr.txt file contents:
Unhandled exception. System.AggregateException: One or more errors occurred. (Index was outside the bounds of the array.)
---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.String.get_Chars(Int32 index)
at Restler.ApiResourceTypes.ApiResource.getConvention(String str) in /src/compiler/Restler.Compiler/ApiResourceTypes.fs:line 156
at Restler.ApiResourceTypes.ApiResource.getTypeWords(String name) in /src/compiler/Restler.Compiler/ApiResourceTypes.fs:line 176
at Restler.ApiResourceTypes.ApiResource.getCandidateTypeNames() in /src/compiler/Restler.Compiler/ApiResourceTypes.fs:line 194
at Restler.ApiResourceTypes.ApiResource..ctor(RequestId requestId, ResourceReference resourceReference, FSharpOption`1 namingConvention, PrimitiveType primitiveType) in /src/compiler/Restler.Compiler/ApiResourceTypes.fs:line 183
at Restler.Dependencies.getConsumer@909(ParameterKind parameterKind, IEnumerable`1 globalAnnotations, RequestId requestId, FSharpOption`1 namingConvention, FSharpMap`2 annotatedRequests, String parameterName, String resourceName, FSharpList`1 resourceAccessPath, FSharpOption`1 primitiveType) in /src/compiler/Restler.Compiler/Dependencies.fs:line 932
at Restler.Dependencies.getParameterDependencies(ParameterKind parameterKind, IEnumerable`1 globalAnnotations, Tuple`2[] requestData, RequestId requestId, RequestParameter requestParameter, FSharpOption`1 namingConvention)
at Restler.Dependencies.getParameterConsumers@1116-1.Invoke(RequestParameter p) in /src/compiler/Restler.Compiler/Dependencies.fs:line 1117
at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(b& curr) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 78
at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 64
at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.takeOuter@273[T,TResult](ConcatEnumerator`2 x, Unit unitVar0) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 274
at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.takeInner@266[T,TResult](ConcatEnumerator`2 x, Unit unitVar0) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 268
at Microsoft.FSharp.Collections.SeqModule.DistinctBy@1098.GenerateNext(IEnumerable`1& next) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 1099
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 371
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.System-Collections-IEnumerator-MoveNext() in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seqcore.fs:line 403
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at Microsoft.FSharp.Collections.SeqModule.ToArray[T](IEnumerable`1 source) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\seq.fs:line 825
at Restler.Dependencies.generatedSuffixes@1378.Invoke(Tuple`2 tupledArg) in /src/compiler/Restler.Compiler/Dependencies.fs:line 1380
at Microsoft.FSharp.Collections.ArrayModule.Parallel.Map@1317-3.Invoke(Int32 i) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\array.fs:line 1318
at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
--- End of stack trace from previous location ---
at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
at System.Threading.Tasks.TaskReplicator.Replica.Execute()
--- End of inner exception stack trace ---
at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure)
at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
--- End of stack trace from previous location ---
at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException)
at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.For(Int32 fromInclusive, Int32 toExclusive, Action`1 body)
at Microsoft.FSharp.Collections.ArrayModule.Parallel.Map[T,TResult](FSharpFunc`2 mapping, T[] array) in F:\workspace\_work\1\s\src\fsharp\FSharp.Core\array.fs:line 1317
at Restler.Dependencies.extractDependencies(Tuple`2[] requestData, IEnumerable`1 globalAnnotations, MutationsDictionary customDictionary, Boolean queryDependencies, Boolean bodyDependencies, Boolean headerDependencies, Boolean allowGetProducers, Boolean dataFuzzing, FSharpMap`2 perResourceDictionaries, FSharpOption`1 namingConvention) in /src/compiler/Restler.Compiler/Dependencies.fs:line 1376
at Restler.Compiler.Main.generateRequestGrammar(FSharpList`1 swaggerDocs, MutationsDictionary dictionary, Config config, FSharpList`1 globalExternalAnnotations, FSharpList`1 userSpecifiedExamples) in /src/compiler/Restler.Compiler/Compiler.fs:line 1312
at Restler.Workflow.generateGrammarFromSwagger(String grammarOutputDirectoryPath, FSharpOption`1 swaggerDoc, FSharpOption`1 specMetadata, Config config) in /src/compiler/Restler.Compiler/Workflow.fs:line 182 at Restler.Workflow.generateRestlerGrammar(FSharpOption`1 swaggerDoc, Config config) in /src/compiler/Restler.Compiler/Workflow.fs:line 290
at Program.main(String[] argv) in /src/compiler/Restler.CompilerExe/Program.fs:line 43
Environment details
command executed in container built by running docker build . -t restler:latest using latest restler-fuzzer code (at revision c0c7c53f4fe7daedb381b1d0bfd4833ddc81b40a).
Description
I have found interesting edge case - in some cases compilation fails when path name is specific.
I've provided a file with single path
/s/
which fails during compilation. If I change the name of that path to/r/
compilation works fine.I'm using a Docker container built by running
docker build . -t restler:latest
using latestrestler-fuzzer
code (at revisionc0c7c53f4fe7daedb381b1d0bfd4833ddc81b40a
).Steps to reproduce
Create a file
openapi.json
with contents:During preparation of this minimal reproduction, I've found that adding at leas one parameter is required to force a fail during compilation.
Execute
Restler compile --api_spec openapi.json
.Expected results
Compilation suceeds.
Actual results
Compilation fails with:
Compile/StdErr.txt
file contents:Environment details
docker build . -t restler:latest
using latestrestler-fuzzer
code (at revisionc0c7c53f4fe7daedb381b1d0bfd4833ddc81b40a
).