Opened 20 years ago

Closed 20 years ago

#802 closed defect (fixed)

[WMS Server] metadata not encoded in GetCapabilities

Reported by: pspencer@… Owned by: mapserverbugs
Priority: highest Milestone:
Component: WMS Server Version: 4.3
Severity: major Keywords:
Cc: dgadoury@…

Description

If a WMS Server map file contains metadata to control the title of the map and
layers, and the metadata contains invalid XML characters (specifically the & in
this case), utilities that parse the capabilities document will fail because &
is an invalid character.  For example:

"wms_title" "Rivers & Streams"

will produce:

<title>Rivers & Streams</title>

which will cause xerces to dump on that line.

It is probable that all metadata that ends up in the capabilities document will
have the same problem.

Change History (7)

comment:1 by dmorissette, 20 years ago

Status: newassigned
The simplefix for this would bo to HTML-encode all metadata values that we
output in Capabilities. There is a single location to change to do that:
msOWSPrintMetadata().

The question is whether that could break existing mapfiles in which all metadata
were already HTML-encoded. OTOH if MapServer doesn't take care of encoding
itself then that opens the possibility of generating broken capabilities
documents as what happens here. So the safe way to go is to have MapServer
HTML-encode all metadata in capabilities, and to document that behavior in the
HOWTOs.

I think I'll run that by the mapserver-dev list before I makethe change though,
just to make sure nobody has a problem with that.

comment:2 by dmorissette, 20 years ago

Actually, there is already msOWSPrintEncodeMetadata() function, so it's mostly a
matter of walking through all calls to msOWSPrintMetadata() and replacing the
ones that need to be replaced.

comment:3 by jlacroix, 20 years ago

I've start work on this.

Should I modify WFS code at the same time?

comment:4 by dmorissette, 20 years ago

Assefa: do you see any problem with Julien updating the WFS code to
automatically encode about everything in capabilities? I told him that it was ok
to do it, so please let us know ASAP if you expect a problem.

comment:5 by assefa, 20 years ago

I do not see any problem on that.

comment:6 by dmorissette, 20 years ago

blocked: 883

comment:7 by jlacroix, 20 years ago

Resolution: fixed
Status: assignedclosed
I have put code in 4.3 cvs that encode all metadatas and mapfile parameters when
outputed to a XML document.

I have changed Map Context, WFS, WMS and GML code.

The remaining issues will be in WCS and maybe in SLD code. A new bug have been
opened for both issue.
WCS: Bug 891
SLD: Bug 892

Note: See TracTickets for help on using tickets.