Closed Bug 448652 Opened 16 years ago Closed 16 years ago

Very Long URL seems to be blocked by "Security Zone Policy"

Categories

(Toolkit :: Downloads API, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.1b2

People

(Reporter: bugzilla, Assigned: jimm)

References

(Blocks 1 open bug, )

Details

(Keywords: fixed1.9.1)

Attachments

(1 file, 5 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1

The Download of resources with "very long URLs" (i.e. 1683 Characters and more) seems to be blocked by Security Zone Policy. Slightly shorter URLs (i.e. 1674) from the same domain do not have that problem.

The Example-URL will only work if you are logged in at zyb.com (registration is free) - I am sorry about that, but I am not aware of other public servers that generate urls long enough.

Reproducible: Always

Steps to Reproduce:
1. Log-in at zyb.com (any login should do)
2. Enter / select the URL mentioned above
3. When ask what to do, select "Save File"
4. Select Path and Filename
Actual Results:  
The file is generated with file size 0 and without content.

In the "Downloads" List, the File is listed along with the error Message
"This download has been blocked by your Security Zone Policy" (in my German Version "Dieser Download wurde durch Ihre Sicherheitszonen-Regel blockiert")

Expected Results:  
The file should be properly saved instead. When I use a shorter link (Example below), it is.

Additionally, I would expect some kind of notification if a download fails. With the zero-size file and no visible message one might wrongly assume that the download was successful.

I am using a German version of Firefox, so sorry in case I mistranslated some the messages that Firefox generates!

The Examples have been anonymized -- therefore a "successful" download will also generate a zero-size file, but no error message in the downloads. If you substitute the "12345678"'s by the number of an actual ZYB-Contact, the successful download will provide a file with data, the non-successfull will still provide an empty file.

Some URL that will *not* generate an Error:
http://zyb.com/core/contacts/export/?ids=12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,
12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678


Some URL that will generate the Error:
http://zyb.com/core/contacts/export/?ids=12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,
12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678,12345678
Component: Security → Download Manager
Product: Firefox → Toolkit
QA Contact: firefox → download.manager
Version: unspecified → 1.9.0 Branch
Confirmed, using current trunk build on windows.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking1.9.0.3?
Flags: blocking1.9.0.2?
Version: 1.9.0 Branch → Trunk
Let's look at this for 1.9.0.3.
Flags: blocking1.9.0.3?
Flags: blocking1.9.0.3+
Flags: blocking1.9.0.2?
Flags: blocking1.9.0.2-
Shawn, can you look at this bug?
Assignee: nobody → sdwilsh
(In reply to comment #3)
> Shawn, can you look at this bug?
jimm has done all the work with this code in the past.  I don't really know windows APIs, which is what this is.
Jim, do you have time to look? :)
Assignee: sdwilsh → jmathies
sure. we'll have a patch that shunts off the security zone stuff, so there will be a work around. but maybe we can do something specific too for this.
Note we now have two prefs that allow users to disable security features that may enforce url length restrictions. The first is - 

browser.download.manager.skipWinSecurityPolicyChecks

Which disables security policy calls on windows. The second is

browser.download.manager.scanWhenDone

which disables all virus scanning. 

Both of the apis used here and the services they call into potentially place restrictions on url length.  I haven't had a chance to test this yet but my guess is skipWinSecurityPolicyChecks will probably solve the problem. I'm not a fan of filtering corner case long urls out before making these calls, so If this is the problem I'd prefer we rely on disabling the service so users know full well what security restrictions are in effect. I'll do some testing to confirm this.
The setting of browser.download.manager.scanWhenDone does not affect that error in the current Nightly Build (3.1b2pre.en-US) and the current release (Firefox/3.0.3), so I am going to test browser.download.manager.skipWinSecurityPolicyChecks
 as soon as I get a build that offers this setting.
Did a little testing, this is definitely caused by a url length restriction in the IAttachementExecute interface. Since it's an extreme case, I leaning toward leaving the code as is unless we get more complaints from additional sites. The functionality can be disabled through the skipWinSecurityPolicyChecks currently available on trunk.
Blocks: 443215
Depends on: 445158
Flags: blocking1.9.1?
Attached patch IAE invalid arg patch v.1 (obsolete) — Splinter Review
This patch smooths things out a bit by detecting invalid argument errors in the virus interface calls. I've also added a length check on the source that chops off uri path and cgi data before making the final Save() call. The specs don't require the full uri, so I think this is safe to do.
Attachment #344295 - Flags: review?(sdwilsh)
Attached patch IAE invalid arg patch v.1 (obsolete) — Splinter Review
Slight cleanup on the length check.
Attachment #344295 - Attachment is obsolete: true
Attachment #344296 - Flags: review?(sdwilsh)
Attachment #344295 - Flags: review?(sdwilsh)
Attached patch IAE invalid arg patch v.1 (obsolete) — Splinter Review
One more time, with white space removed.
Attachment #344296 - Attachment is obsolete: true
Attachment #344297 - Flags: review?(sdwilsh)
Attachment #344296 - Flags: review?(sdwilsh)
Too late to land in 1.9.0.4, request branch approval when it's been verified on mozilla-central.
Flags: blocking1.9.0.4+ → wanted1.9.0.x+
Comment on attachment 344297 [details] [diff] [review]
IAE invalid arg patch v.1 

>diff --git a/toolkit/components/downloads/src/nsDownloadScanner.cpp b/toolkit/components/downloads/src/nsDownloadScanner.cpp
>   nsCAutoString origin;
>-  rv = uri->GetSpec(origin);
>+  // Certain virus interfaces do not like extremely long uris.
>+  // Chop off the path and cgi data and just pass the base domain. 
>+  if (origin.Length() < 1683)
>+    rv = uri->GetSpec(origin);
>+  else
>+    rv = uri->GetPrePath(origin);
two things - origin.Length() is going to always be zero when you check it with the current code, and please pull out that number into a constant, with a comment explaining what it is.
Attachment #344297 - Flags: review?(sdwilsh) → review-
(In reply to comment #14)
> (From update of attachment 344297 [details] [diff] [review])
> >diff --git a/toolkit/components/downloads/src/nsDownloadScanner.cpp b/toolkit/components/downloads/src/nsDownloadScanner.cpp
> >   nsCAutoString origin;
> >-  rv = uri->GetSpec(origin);
> >+  // Certain virus interfaces do not like extremely long uris.
> >+  // Chop off the path and cgi data and just pass the base domain. 
> >+  if (origin.Length() < 1683)
> >+    rv = uri->GetSpec(origin);
> >+  else
> >+    rv = uri->GetPrePath(origin);
> two things - origin.Length() is going to always be zero when you check it with
> the current code, and please pull out that number into a constant, with a
> comment explaining what it is.

Doh! I'll go back to the first patch I submitted, that one was correct. I'll split the constant out and resubmit.
Attached patch IAE invalid arg patch v.2 (obsolete) — Splinter Review
updated.
Attachment #344297 - Attachment is obsolete: true
Attachment #344675 - Flags: review?(sdwilsh)
Comment on attachment 344675 [details] [diff] [review]
IAE invalid arg patch v.2

>+// Maximum length for URI's passed inot IAE
>+#define MAX_IAEURILENGTH 1683
I think you want "into"

r=sdwilsh
Attachment #344675 - Flags: review?(sdwilsh) → review+
Attached patch IAE invalid arg patch v.2 (obsolete) — Splinter Review
text touched up.
Attachment #344675 - Attachment is obsolete: true
Keywords: checkin-needed
Comment on attachment 344931 [details] [diff] [review]
IAE invalid arg patch v.2

abort: bad hunk #3 @@ -485,32 +491,40 @@ nsDownloadScanner::Scan::Start()
 (33 32 40 40)
Status: NEW → ASSIGNED
Keywords: checkin-needed
lets try again...
Attachment #344931 - Attachment is obsolete: true
Keywords: checkin-needed
Comment on attachment 345737 [details] [diff] [review]
IAE invalid arg patch v.2 resubmit
[Checkin: Comment 21]

http://hg.mozilla.org/mozilla-central/rev/cdb84fbfb5bb
Attachment #345737 - Attachment description: IAE invalid arg patch v.2 resubmit → IAE invalid arg patch v.2 resubmit [Checkin: Comment 21]
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.1b2
The URLs listed are actually 2083 and 2074 characters long, not 1683 and 1684 (count them). 2083 characters is the Maximum URL length in Internet Explorer. This appears to be an Internet Explorer issue which is why it's coming back with the Security Zone Policy error.

http://support.microsoft.com/kb/208427
FYI, I have the same issue on an internal site which uses a GET to post data to a PERL script. Smaller data posts go through (<2083), larger ones produce the same Security Zone Policy error (>=2083).
Flags: blocking1.9.1? → blocking1.9.1+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: