TF401262: Value of long text field System.Description exceeds the maximum length allowed length of 1048576 - tfs

We are using TFS 2017 update 1 (on premise install). When I try to paste a large number of HTML tables and lots of text into the Description field, I get the following error:
TF401262: Value of long text field System.Description exceeds the maximum length allowed length of 1048576.
Can I change this limit ?

I had the same kind of necessity, so I tried a little bit harder...
This is my tfs database (Tfs_Dev):
I executed this procedure to add a registry value in TFS configuration:
EXEC [dbo].[prc_SetRegistryValue]
#partitionId=1,
#key='#\Service\WorkItemTracking\Settings\MaxLongTextSize\',
#value='2000000000'
I could find this solution after looking in TFS source code, thanks to a great tool named dnspy
You can find the specific TFS dll in a path similar to C:\Program Files\Microsoft Team Foundation Server 15.0\Application Tier\Web Services\bin\Microsoft.TeamFoundation.WorkItemTracking.Server.dll

Tested and cannot reproduce this issue on my side. But obviously it has the limitation for the maximum allowed length.
Generally String fields take a max of 255 characters. PlainText/HTML will take a max of 32K. If it crosses this limits, you can opt to store it to a file and add it as an attachment.
However you can try to change the limit by editing the web.config of the TFS site follow the instruction mentioned in this article : Easy Ways to Upload and Validate Large Files in ASP.NET
If you use IIS7 and you want to upload files larger than the
restricted 30000000 bytes or 28.6 MB, you can add the following code
to your web.config file in order to set that value to 100 MB:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="104857600" />
</requestFiltering>
</security>
</system.webServer>
If that still not work then please share the steps to reproduce the issue, especially for the "large number of HTML tables and lots of text" you mentioned (You can store the strings in a file e.g word if it's too large then share the file in Onedrive or another site we can access).

Related

Is there any offline safe method to prevent web-shell uploading in aspnet?

I have a simple page in asp net 5, and users can upload their images there. Valid files are: *.jpg, *.png, so I'm doing steps below to validating the files:
Validating filename length : e.g: file name must be less than 50 alphabet characters
Validating filename : replacing any hidden or invalid characters
Validating file size : based on our configurations (e.g: less than 10MB)
Validating file extensions : based on our white-list: *.jpg, *.png
Validating Mimetypes : based on our white-list for IMAGE/JPEG, IMAGE/PNG
Validating file's first bytes (Magic Number) : based on our white-list for JPG: "FF-D8-FF-DB", "FF-D8-FF-E0" , "FF-D8-FF-EE" ,"FF-D8-FF-E1" and PNG: "89-50-4E-47"
Uploading the file with a random (guid) filename in the temp folder outside webroot: without any executing permissions.
Scanning the file with AV (Kaspersky or Norton Security) service installed.
But, some webshells can bypass these steps, like Insomnia webshell or others (they use the magic number headers at the first of file headers and inject their codes into some part of the file).
So my question is :
how can I detect and prevent webshell uploading?
Should I read and check the whole file for some black-list keywords?
Or what?
btw :We can't use any online webshell detection services.
This is a simple shell injected into a PNG file by woanware.co.uk:

How can I resolve these err msgs following a TFS "Get Latest Version (Recursion)"?

I was able to compile and run an .exe built in XP Mode with Visual Studio 2003. I then noticed the version of the source I was using was not up to date (based on a version number string). So I did a "Get Latest Version (Recursion)"
That gave me the correct version number, but also over 100 Build Errors, of thes types:
Two of these, but 2-clicking them goes nowhere:
"Error reading resources from the resource file for the default culture: Invalid ResX input. Could not find valid "resheader" tags for the .NET Compact Framework ResX reader & writer type names. Make sure this Resx file is a .NET Compact Framework Resx file."
Dozens of these; 2-clicking them also takes me nowhere:
"Object type cannot be converted to target type."
10 or a dozen of these:
"Resource transformation for file 'frmAbout.resx' failed. Invalid ResX input. Could not find valid "resheader" tags for the .NET Compact Framework ResX reader & writer type names. Make sure this Resx file is a .NET Compact Framework Resx file."
2-clicking those gave me this nice "Data for Data" grid:
Finally, several like this:
"'PDAClient.PrinterPickerForm' does not contain a definition for 'AutoScaleMode'"
...which take me to code like this:
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
Why would simply getting the latest version of code cause all this mayhem?

Ant FTP task uploading truncating files to multiple of 1024 bytes

I'm running an Ant target which contains this:
<ftp action="send"
server="${ftp.server}"
remotedir="${ftp.remotedir}"
userid="${ftp.userid}"
password="${ftp.password}"
systemTypeKey="WINDOWS"
binary="no"
verbose="yes">
<fileset dir="${dist.dir}">
<includesfile name="${temp.dir}/changedListText.txt"/>
</fileset>
</ftp>
"changedListText.txt" is a newline-delimited list of files to upload. All text files I upload end up having a size of zero. Also, all binary files I upload have a size that doesn't match my local machine's. I thought splitting the text and binary files would help, but apparently it didn't.
I can find precious little documentation on the Ant FTP task, and as far as Verbose is reporting, there don't appear to be any errors during the upload.
EDIT: I see now that it's only uploading whole chunks of 1024 bytes. My text files are small, so they're ending up rounding down to zero.
Your probably using Apache Commons Net 3.0. Change to 1.4.1 and it will work. Don't forget to remove the 3.0 jar.
The jar file can be downloaded from: http://commons.apache.org/net/download_net.cgi

Grails - Jasper Plugin - Invalid byte 1 of 1-byte UTF-8 sequence error with .jasper file

I am using Grails 1.3.5, SQL Server 2005, iReports 3.7.6, Jasper Plugin 1.1.3. In my GSP page I have given the jasperReprt tag as:
<g:jasperReport jasper="report1" format="PDF">
<input type="hidden" name="test_id" id="test_id"/>
<input type="hidden" name="order_no" id="order_no" />
</g:jasperReport>
For development, in Config.groovy I have specified the
jasper.dir.reports = './reports'
There are two files created in the reports folder when a new report is created and saved, i.e. report.jrxml and report.jasper.
When clicked on the PDF icon in IE or Firefox, an 500 server error is thrown and below is stack trace.
[2010-11-27 01:13:14.998] ERROR groovy.grails.web.errors.GrailsExceptionResolver Invalid byte 1 of 1-byte UTF-8 sequence.
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:684)
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:554)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1742)
at
But if I delete the report1.jasper, the error is no longer thrown when PDF icon is clicked and the PDF report is shown fine.
Is this the correct way to do it?
My second issue is with using Sub Reports. Sub report is in the same folder as the main report. But When the report is executed from the application, below error is thrown:
[2010-11-27 01:30:27.556] ERROR groovy.grails.web.errors.GrailsExceptionResolver Could not load object from location : ./reports\report1sub_report.jasper
net.sf.jasperreports.engine.JRException: Could not load object from location : ./reports\urine_routinepatient_details_sub_report.jasper
at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLoader.java:262)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateReport(JRFillSubreport.java:301)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:327)
It does not find the sub report. How can I fix it?
Thank you.
Jay Chandran.
Edit:
I have been searching during this whole time, but still could not find a proper solution. So I did some trial and error. I figured out that, deleting report1.jasper and just leaving jasper.jrxml in the report directory works just fine as I said earlier.
For the sub-report issue: It was giving error Could not load object from location : ./reports\report1sub_report.jasper For some strange reason, the main report name report was getting appended to the name sub_report.jasper and was looking for a file named report1sub_report.jasper
So I created a sub-folder under reports folder and named it report1 and updated report1.jrxml file
<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "\\sub_report.jasper"]]></subreportExpression>
I had to add the extra \\ slash even though the "SUBREPORT_DIR" parameter had \\ the slashes at the end of the path as shown below.
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["F:\\Workspace\\SpringSource2.5.0\\GrailsProjec\\reports\\report1\\"]]></defaultValueExpression>
</parameter>
Notice the \\ at the end. I don't know why it was not getting appended!
Another way would have been to just change the sub-report name from sub_report.jasper
to report1sub_report.jasper!!! :)
I have tested this in production mode and it works fine. I am not sure if this is the way to do it, but all other possible solutions did not work for me.
Feedback will be very helpful.
I assume you have a version conflict here. iReport stores JRXML files and seems to compile them automatically to .jasper. The Grails Jasper plugin picks up the compile variant and gets into trouble with it. So try to disable compiled output in ireport.
The Grails Jasper plugin 1.1.3 uses internally Jasper 3.7.4, the used ireport is 3.7.6.
Regarding the sub reports: no idea.
The MalformedByteSequenceException is caused by a character encoding conflict. I'd suggest to use UTF-8 instead of Windows' Win-1252 (similar to ISO-8859-1) everywhere.
In Jasper's etc/ireport.conf file, change the default_options to:
default_options="-J-Dfile.encoding=UTF-8 -J-Xms24m -J-Xmx64m"
(Where Xms and Xmx are unrelated memory settings. If there are default settings with that config entry, you can overtake them, else, just leave them out.)
See this forum thread for alternative configurations.
As for the error with subreports, take a look at the backslash \ that's probably wrong.
EDIT : There is some information about two issues which maybe could help in
http://grails.org/plugin/jasper#faqTab
i hope i can help with one of the issues: which one related with subreports dir.
The problem is the plugin code sets SUBREPORT_DIR to the complete file path of main report, including its name. However the code honour the user provided param with the same name, so if you fill this param with whatever value except null the plugin will use it.
For example if you chain directly the jasper controller you can do:
def renderAs(data,format) {
def reportParams=params.clone()
reportParams["_format"]=reportParams["_format"]?:"${format.toUpperCase()}"
reportParams["SUBREPORT_DIR"]=CH.config.jasper.dir.reports+"/"
chain(controller:'jasper',action:'index',model:[data:[]+data],params:reportParams)
}
In your scenario an (ugly) option would be create an hidden input with name SUBREPORT_DIR and value the desired one. I would fill the paremeter in other way.
EDIT:
Another annoying problem is where do we have to put the main reports and compiled subreports:
When you run the app with run-app they work if you put them all in a folder with the same name as CH.config.jasper.dir.reports(reportDir) in the root of the grails app.
But if you want to deploy a war you have to put the main reports in a folder reportDir in the root of war file and compiled subreports in WEB-INF/classes/reportDir.
I've opted to keep all files in grailsApp/reports and copy the resources in the appropiate folders in the war grails task. In my BuildConfig.groovy i've added (reportDir is "reports"):
grails.war.resources = { stagingDir,args ->
def classpathDir="${stagingDir}/WEB-INF/classes"
copy(toDir:"${stagingDir}/reports") {
fileset(dir:"reports",includes:"**")
}
copy(toDir:"${classpathDir}/reports") {
fileset(dir:"reports",excludes:"**.jrxml")
}
}
Hope it helps.

PartCover browser not opening code files

We're generating PartCover reports via the command line tool along with our CruiseControl.Net unit tests. This generates an xml file that displays the results nicely on the cruisecontrol dashboard. The xslt transforms that are included only show you the percentage of coverage in an individual class. We want to know exactly what lines are not being covered. The problem ist when we open the report in the PartCover browser and double click a method it doesn't show us our cs files. I know the PartCover browser is capable of showing you the files because of the following.
Here's a screenshot of PartCover browser with the lines of code showing: http://kjkpub.s3.amazonaws.com/blog/img/partcover-browse.png.
The information looks like it should be available to the browser because the report contains this:
<Method name="get_DeviceType" sig="Cathexis.IDBlue.DeviceType ()" bodysize="19" flags="0" iflags="0">
<pt visit="2" pos="0" len="1" fid="82" sl="35" sc="13" el="35" ec="14" />
<pt visit="2" pos="1" len="4" fid="82" sl="36" sc="17" el="36" ec="39" />
<pt visit="2" pos="5" len="2" fid="82" sl="37" sc="13" el="37" ec="14" />
</Method>
and this:
<File id="66" url="D:\sandbox\idblue\idblue\trunk\software\code\driver\dotnet\Common\AsyncEventQueue.cs" />
All I want to be able to do is view what lines of code are not being covered in my test cases without having to figure out what the xml above is trying to tell me.
Thanks to anyone in advance who replies.
I figured out why the cs files were not displaying. The paths were incorrect in the xml file because our test project was being built on a different machine than the one partcover was on. (partcover must generate the .cs file paths from pdb files maybe?) Once I search and replaced the file switching the base directory of our subversion location to the one on the other machine all was well.

Resources