Closed
Bug 45565
Opened 26 years ago
Closed 26 years ago
Make UA string customizable
Categories
(Core :: Networking, defect, P3)
Core
Networking
Tracking
()
VERIFIED
FIXED
M18
People
(Reporter: BenB, Assigned: BenB)
References
()
Details
Attachments
(2 files)
|
2.82 KB,
patch
|
Details | Diff | Splinter Review | |
|
2.44 KB,
patch
|
Details | Diff | Splinter Review |
"Mozilla/5.0" is hardcoded. Read from prefs. Some users want to change this.
Reading the whole beast from prefs would be even better.
Patch will follow. Jud, can you review, please?
Comment 1•26 years ago
|
||
this piece of the UA string is intentionally hardcoded. You can't browse without
that hardcoded string (modifications break the world).
Could the value be changed programatically via JS in a web page if it were a
pref?
| Assignee | ||
Comment 2•26 years ago
|
||
> this piece of the UA string is intentionally hardcoded. You can't browse
> without that hardcoded string (modifications break the world).
Sorry, but this is nonsense. People use very freaky UA-strings (sat by various
proxies). Even if some pages broke, this decision should be up to the user.
There is enough demand for this choice.
> Could the value be changed programatically via JS in a web page if it were a
> pref?
Webpage JS *should* not be able to set prefs - it would be a security problem in
many other cases as well. Note that you can currently set e.g. the security part
via pref.
Status: NEW → ASSIGNED
Target Milestone: --- → M17
| Assignee | ||
Comment 3•26 years ago
|
||
| Assignee | ||
Comment 4•26 years ago
|
||
3 new prefs: general.useragent.[appname|appversion|override]. With the first
two, you can change "Mozilla" and "5.0" (falling back to the previous hardcoded
defaults, if they are not sat), with the last one you can override the whole
useragent string at once, which allows to break out of the structure and even
override the OS etc. (which can be a security *feature*, if used well).
Comment 5•26 years ago
|
||
1. It ain't non-sense when modifying Mozilla/x.x results in dozens of emails
from people complaining about how they can't visit site foo.
2. Proxies, spiders, agents and various clients indeed use many random UA
strings. However, there's a reason 95% of the clients on the web hard code
"Mozilla/x.x" and that's because there's a lot of content out there that won't
service any other requests.
3. I've had this "discussion" a zillion times, and the same logic is always
used. I agree that the entire string *should* be modifiable, but what worries me
is someone cracking our JS security model somehow, putting up a page that
changes this setting, then that browser becomes useless until the user figures
out what went wrong. Maybe this is an unwaranted fear.
actually, on that last note, I'm going to ask that we *not* make this change. If
you (or someone else playing w/ this) change your agent and you starting getting
rejections (of many forms) from content, you could very easily file a bug that
is a result of your UA string being different, and someone (most often in
networking) will spend a good hunk of time (I've spent days chasing UA
string problems) chasing a phantom problem.
Comment 6•26 years ago
|
||
Cc'ing dbaron, who is user-agent owner for Mozilla, and waterson. Jud, I don't
think your objection #3 is valid: if someone cracks our security code, many bad
things can happen, but that doesn't mean we don't empower trusted scripts to do
useful things. We do and should.
I am not convinced a pref is the right way here at all. It's more a matter of
compile-time branding than user preference, I think. If we could use #ifndef
and #define to avoid hardwiring Mozilla/5.0 in a way that makes branders of the
source have to muck with an otherwise readonly source file, that would win.
/be
| Assignee | ||
Comment 7•26 years ago
|
||
Posted to .netlib "Should the UA string be settable per pref?"
<news://news.mozilla.org/3970C1EF.69BC94C9@bucksch.org>.
| Assignee | ||
Comment 8•26 years ago
|
||
> I am not convinced a pref is the right way here at all. It's more a matter of
> compile-time branding than user preference, I think. If we could use #ifndef
> and #define to avoid hardwiring Mozilla/5.0 in a way that makes branders of
> the source have to muck with an otherwise readonly source file, that would
> win.
I don't think, this is a problem. *All* Mozillas of this version propably should
have "Mozilla/5.0" in the beginning, for the reasons valeski and the spec name.
We have "vendor" fields for branding. But many *users* want to change the
string, without compiling.
Comment 9•26 years ago
|
||
> But many *users* want to change the string, without compiling.
First I've heard of this. I doubt Mom&Pop want to do any such thing. Can you
tell me more about such users? *Why* do they want to change the beginning of
the user-agent?
/be
| Assignee | ||
Comment 10•26 years ago
|
||
> I doubt Mom&Pop want to do any such thing.
lol, agreed.
> Can you tell me more about such users? *Why* do they want to change the
> beginning of the user-agent?
(Easiest ones first)
- Change for the sake of it
- "See, I'm cool. I can hack my browser."
- Security: If a webserver admin knows details about my platform (e.g. the
kernel version, as sent out for Unix), he can start a specific attack.
- Many exploits involve writing of certain files, which are of course
different across platforms.
- Certain OS versions may have known bugs, e.g. the remote-root-exploit bug of
the 2.2.14 kernel.
- Privacy
- I just may not want others to know my platform
- I may use an usual combination and want to set it to a more usual string
| Assignee | ||
Comment 11•26 years ago
|
||
(Mostly talking about the whole UA string, i.e. "general.useragent.override".)
| Assignee | ||
Comment 12•26 years ago
|
||
> I may use an usual combination
*un*usual (sorry for the spam.)
Comment 13•26 years ago
|
||
I want that setting, too :-)
Comment 14•26 years ago
|
||
You might want to change the user_agent because some websites don't like the browser version or OS. I have an online banking site that only likes Windows or MacOS browsers. It doesn't even like Opera unless you set it to spoof as netscape 4.73. Perhaps instead of fully customizable, there could be a few options known to work, such as the following prefs:
Pretend to be Netscape 4.08
Pretend to be Netscape 4.73
Pretend to be MSIE 5.0
Pretend to be Netscape 3.04
Pretend to be a Windows browser
Pretend to be a MacOS browser
| Assignee | ||
Comment 15•26 years ago
|
||
So, what do we do now?
Having a general override for the whole string seems like it does have some uses
for power users (as mentioned above), especially on uncommon platforms, and also
maybe for our QA, if we want to test if a layout "bug" is really the site's bad
browser-sniffing or test UA-string changes in advance. I don't see the value of
having separate overrides for AppName and AppVersion, unless that would affect
JS sniffing too.
However, messing with the UA string should be "unsupported" for end-users (since
we know a lot of things break if it's changed), and it shouldn't be possible to
do so accidentally or for a malicious web page to do so.
As far as the UA-string spec is concerned, I think all that matters is what the
default is that ships with the browser. That's what most people will use.
Furthermore, (almost) however that default is stored, it can be changed.
| Assignee | ||
Comment 17•26 years ago
|
||
> I don't see the value of
> having separate overrides for AppName and AppVersion
I could remove that.
> messing with the UA string should be "unsupported" for end-users
Agreed.
| Assignee | ||
Comment 18•26 years ago
|
||
I'll attach a new patch, which only adds the general.useragent.override prefs
and leaves Mozilla/5.0 hardcoded. Changing SUMMARY to reflect this.
Summary: Read AppName/AppVersion for useragent-string from prefs → Make UA string customizable
| Assignee | ||
Comment 19•26 years ago
|
||
Comment 20•26 years ago
|
||
Some websites will not allow Mozilla/5.0. I know, my online banking site won't
allow netscape 4.08 for linux, only windows. Perhaps 4.7 or 4.08 should be
allowed as well.
Comment 21•26 years ago
|
||
Ben, looks good to me except that now rv is uselessly initialized to NS_OK, then
immediately set to the result of CopyCharPref. I would remove the useless NS_OK
initializer. Anyone else want to give this an r=? I'll say a= once the NS_OK
nit is picked.
/be
| Assignee | ||
Comment 22•26 years ago
|
||
Brendan,
the needless initialization is preexistant, but I'll remove it before I check
in.
Please see <http://www.bucksch.org/1/projects/mozilla/review.html> before
reviewing.
| Assignee | ||
Comment 23•26 years ago
|
||
gagan, would you review, please?
Comment 24•26 years ago
|
||
Jud should review this.
Comment 25•26 years ago
|
||
ugh. user agents suck. we're about to rewrite all this stuff and I'd like to
deal w/ this kind of customization then/after that.
| Assignee | ||
Comment 26•26 years ago
|
||
Rewrite what?
Anyway, can't we just get this in now, and when you rewrite, you just maintain
that (override) functionality? I'd like to
- have this from my plate and
- make sure this is in the product
Comment 27•26 years ago
|
||
the ua stuff is being overhauled. r=valeski.
| Assignee | ||
Comment 28•26 years ago
|
||
> the ua stuff is being overhauled.
Can you cc me in that bug, please?
> r=valeski
Thanks
| Assignee | ||
Comment 29•26 years ago
|
||
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Target Milestone: M17 → M18
Comment 30•26 years ago
|
||
I realize the fix is already in, but since there seems to be quite a bit of
disagreement on its usefulness, I just thought I would mention another posible
use for it: To spoof other browsers. For example, there is quite a bit of
content out there that is unviewable with anything other than IE. This is a
long-running problem, but I blame it on IE in the first place, which started
this mess by pretending to be Mozilla, changing its UA string to "Mozilla/x.x
(compatible: MSIE x.x)", to work around sites in existence at the time that were
looking at the UA string and refusing to serve content to IE. With a pref for
the UA string, this could be solved.
BTW, for a GOOD example of it in action, check out the UA-string spoofing option
at the web page backward compatibility viewer, now playing at an URL near you:
http://www.delorie.com/web/wpbcv.html
Comment 31•25 years ago
|
||
VERIFIED:
I'd like to see further documentation of these preferences, but this feature is
clearly in and used all the time.
I compared logs of user agent to the relevant contents of
"$INSTALL/defaults/pref/*"
"Mozilla/5.0 (X11; U; Linux 2.2.16-22smp i686; en-US; rv:0.9) Gecko/20010505"
all.js:pref("general.useragent.locale",
"chrome://navigator/locale/navigator.properties");
all.js:pref("general.useragent.misc", "rv:0.9");
security-prefs.js:pref("general.useragent.security", "U");
"Mozilla/5.0 (X11; U; Linux 2.2.16-22smp i686; en-US; rv:0.8.1+) Gecko/20010416
Netscape6/6.5b0"
all.js:pref("general.useragent.locale",
"chrome://navigator/locale/navigator.properties");
all.js:pref("general.useragent.misc", "rv:0.8.1+");
all-ns.js:pref("general.useragent.vendor", "Netscape6");
all-ns.js:pref("general.useragent.vendorSub", "6.5b0");
security-prefs.js:pref("general.useragent.security", "U");
Status: RESOLVED → VERIFIED
QA Contact: tever → benc
| Assignee | ||
Comment 32•25 years ago
|
||
benc, the new pref here is general.useragent.override. Please test *that*.
| Assignee | ||
Comment 33•25 years ago
|
||
Bug 46029 is about a GUI for this pref.
| Assignee | ||
Comment 34•25 years ago
|
||
Adding mostfreq keyword for the many bugs that are dupped against bug 46029.
Keywords: mostfreq
You need to log in
before you can comment on or make changes to this bug.
Description
•