You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[x] bug report => search github for a similar issue before submitting
...about
[x] edit experience / UI
[x] admin experience UI
Current Behavior / Expected Behavior
A user copy/pasted bad data from a document into a custom 2sxc App Content Type Text / string value. When attempting to export this data row or when attempting to export the App, this error is displayed:
{"Message":"Bad Request","ExceptionType":"System.ArgumentException","ExceptionMessage":"'\u0002', hexadecimal value 0x02, is an invalid character."}
Users should not be allowed to create content that breaks core 2sxc functionality. A possible fix would be to use a RegEx to detect and report on or filter out all special characters that are not allowed in the database. In this specific case, the character is HEX 0x02, STX, an obsolete "Start of Text" control character.
Instructions to Reproduce the Problem
-Create new App "DEBUG"
-Create new Content Type "DEBUG"
-Create new Field "DEBUG"
-Add new Item
-Use a hex editor, such as https://hexed.it/, to create a new 1-byte file that contains the HEX character value 0x02
-Use a text editor, such as Notepad++ to load and copy the single [STX] character to the clipboard
-Paste the character into the new Item in the 2sxc App and save
-Export the DEBUG Content Type
-The following error is displayed and the export does not complete:
{"Message":"Bad Request","ExceptionMessage":"'\u0002', hexadecimal value 0x02, is an invalid character.","ExceptionType":"System.ArgumentException","StackTrace":" at System.Xml.XmlEncodedRawTextWriter.WriteElementTextBlock(Char* pSrc, Char* pSrcEnd)\r\n at System.Xml.XmlEncodedRawTextWriter.WriteString(String text)\r\n at System.Xml.XmlWellFormedWriter.WriteString(String text)\r\n at System.Xml.Linq.ElementWriter.WriteElement(XElement e)\r\n at System.Xml.Linq.XElement.WriteTo(XmlWriter writer)\r\n at System.Xml.Linq.XContainer.WriteContentTo(XmlWriter writer)\r\n at System.Xml.Linq.XNode.GetXmlString(SaveOptions o)\r\n at ToSic.Eav.Apps.ImportExport.ExportListXml.GenerateXml(String languageSelected, String languageFallback, String[] sysLanguages, ExportLanguageResolution exportLanguageReference, Boolean resolveLinks, Int32[] selectedIds) in C:\Projects\2sxc\eav-server\ToSic.Eav.Apps\ImportExport\ExportListXml.cs:line 136\r\n at ToSic.Eav.WebApi.ImportExport.ContentExportApi1.<>c__DisplayClass8_0.<ExportContent>b__0(ILogCall l) in C:\\Projects\\2sxc\\eav-server\\ToSic.Eav.WebApi\\ImportExport\\ContentExportApi.cs:line 90\r\n at ToSic.Lib.Logging.ILog_Func.FuncLogResultMessage[TResult](ILog log, Func2 func, String parameters, String message, Boolean timer, CodeRef code, Boolean enabled, Boolean logResult) in C:\Projects\2sxc\eav-server\ToSic.Lib.Core\Logging\Log\ILog_Func.cs:line 246\r\n at ToSic.Eav.WebApi.ImportExport.ContentExportApi1.ExportContent(IUser user, String language, String defaultLanguage, String contentType, ExportSelection exportSelection, ExportResourceReferenceMode exportResourcesReferences, ExportLanguageResolution exportLanguageReferences, String selectedIds) in C:\\Projects\\2sxc\\eav-server\\ToSic.Eav.WebApi\\ImportExport\\ContentExportApi.cs:line 70\r\n at ToSic.Eav.WebApi.Admin.EntityControllerReal1.Download(Int32 appId, String language, String defaultLanguage, String contentType, ExportSelection recordExport, ExportResourceReferenceMode resourcesReferences, ExportLanguageResolution languageReferences, String selectedIds) in C:\Projects\2sxc\eav-server\ToSic.Eav.WebApi\Admin\EntityControllerReal.cs:line 81\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.b__2(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__171.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Tracing.ITraceWriterExtensions.d__17`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ExceptionFilterResult.d__6.MoveNext()"}
Your environment
OS: Windows 11
Hex Editor: https://hexed.it/
Text Editor: Notepad++
IIS: 10
2sxc: 16.2.0 and 17.1.6
Browser: All
DNN: 9.13.0
Language: English
The text was updated successfully, but these errors were encountered:
I'm submitting a
[x] bug report => search github for a similar issue before submitting
...about
[x] edit experience / UI
[x] admin experience UI
Current Behavior / Expected Behavior
A user copy/pasted bad data from a document into a custom 2sxc App Content Type Text / string value. When attempting to export this data row or when attempting to export the App, this error is displayed:
{"Message":"Bad Request","ExceptionType":"System.ArgumentException","ExceptionMessage":"'\u0002', hexadecimal value 0x02, is an invalid character."}
Users should not be allowed to create content that breaks core 2sxc functionality. A possible fix would be to use a RegEx to detect and report on or filter out all special characters that are not allowed in the database. In this specific case, the character is HEX 0x02, STX, an obsolete "Start of Text" control character.
Instructions to Reproduce the Problem
-Create new App "DEBUG"
-Create new Content Type "DEBUG"
-Create new Field "DEBUG"
-Add new Item
-Use a hex editor, such as https://hexed.it/, to create a new 1-byte file that contains the HEX character value 0x02
-Use a text editor, such as Notepad++ to load and copy the single [STX] character to the clipboard
-Paste the character into the new Item in the 2sxc App and save
-Export the DEBUG Content Type
-The following error is displayed and the export does not complete:
{"Message":"Bad Request","ExceptionMessage":"'\u0002', hexadecimal value 0x02, is an invalid character.","ExceptionType":"System.ArgumentException","StackTrace":" at System.Xml.XmlEncodedRawTextWriter.WriteElementTextBlock(Char* pSrc, Char* pSrcEnd)\r\n at System.Xml.XmlEncodedRawTextWriter.WriteString(String text)\r\n at System.Xml.XmlWellFormedWriter.WriteString(String text)\r\n at System.Xml.Linq.ElementWriter.WriteElement(XElement e)\r\n at System.Xml.Linq.XElement.WriteTo(XmlWriter writer)\r\n at System.Xml.Linq.XContainer.WriteContentTo(XmlWriter writer)\r\n at System.Xml.Linq.XNode.GetXmlString(SaveOptions o)\r\n at ToSic.Eav.Apps.ImportExport.ExportListXml.GenerateXml(String languageSelected, String languageFallback, String[] sysLanguages, ExportLanguageResolution exportLanguageReference, Boolean resolveLinks, Int32[] selectedIds) in C:\Projects\2sxc\eav-server\ToSic.Eav.Apps\ImportExport\ExportListXml.cs:line 136\r\n at ToSic.Eav.WebApi.ImportExport.ContentExportApi
1.<>c__DisplayClass8_0.<ExportContent>b__0(ILogCall l) in C:\\Projects\\2sxc\\eav-server\\ToSic.Eav.WebApi\\ImportExport\\ContentExportApi.cs:line 90\r\n at ToSic.Lib.Logging.ILog_Func.FuncLogResultMessage[TResult](ILog log, Func
2 func, String parameters, String message, Boolean timer, CodeRef code, Boolean enabled, Boolean logResult) in C:\Projects\2sxc\eav-server\ToSic.Lib.Core\Logging\Log\ILog_Func.cs:line 246\r\n at ToSic.Eav.WebApi.ImportExport.ContentExportApi1.ExportContent(IUser user, String language, String defaultLanguage, String contentType, ExportSelection exportSelection, ExportResourceReferenceMode exportResourcesReferences, ExportLanguageResolution exportLanguageReferences, String selectedIds) in C:\\Projects\\2sxc\\eav-server\\ToSic.Eav.WebApi\\ImportExport\\ContentExportApi.cs:line 70\r\n at ToSic.Eav.WebApi.Admin.EntityControllerReal
1.Download(Int32 appId, String language, String defaultLanguage, String contentType, ExportSelection recordExport, ExportResourceReferenceMode resourcesReferences, ExportLanguageResolution languageReferences, String selectedIds) in C:\Projects\2sxc\eav-server\ToSic.Eav.WebApi\Admin\EntityControllerReal.cs:line 81\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.b__2(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__17
1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Tracing.ITraceWriterExtensions.d__17`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__6.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Filters.AuthorizationFilterAttribute.d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ExceptionFilterResult.d__6.MoveNext()"}Your environment
OS: Windows 11
Hex Editor: https://hexed.it/
Text Editor: Notepad++
IIS: 10
2sxc: 16.2.0 and 17.1.6
Browser: All
DNN: 9.13.0
Language: English
The text was updated successfully, but these errors were encountered: