MAC address text field on Power section accepts wrong format

Bug #1481261 reported by Livia
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Richard McCartney

Bug Description

MAC address text field on Power section accepts wrong format, should accept only MAC address format.

Tags: power ui

Related branches

Revision history for this message
Gavin Panella (allenap) wrote :

Can you give an example of a format that is accepted?

Changed in maas:
status: New → Incomplete
Revision history for this message
Livia (liviadtpereira) wrote :
Livia (liviadtpereira)
tags: added: ui ux
Revision history for this message
Gavin Panella (allenap) wrote :

Thanks!

Changed in maas:
importance: Undecided → Medium
status: Incomplete → Triaged
tags: added: power
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Ideally we should normalize MACs in a nice way. For example, if I copy/paste, sometimes I get cruft like:

90: 2b: 34: dc: 7e: 9d

As long as it has an appropriate number of hex digits, we should accept it. Some software also outputs MACs in the format:

0:b:34:dc:7e:9d

Note the 8-bit values less than 16 which are not zero-padded. (ugh)

So I guess if separators exist, we should first zero-fill the digits appropriately.

Note, that also means this is a "valid" MAC:

aaaaaaaaaaaa

(but only because there are exactly 12 'a's.) I could see us also accepting "aaaaaaaaaaa" (0a:aa:aa:aa:aa:aa).

Revision history for this message
Mike Pontillo (mpontillo) wrote :

Before I forget... I've also seen dotted notation (aa.aa.aa.aa.aa.aa), Cisco dotted notation (aaaa.aaaa.aaaa), and Microsoft-style dashes (aa-aa-aa-aa-aa-aa).

Anyway. If we're going to parse MACs, let's be liberal in what we accept. =)

Revision history for this message
Gavin Panella (allenap) wrote :

These MAC addresses should be validated by MACAddressFormField (see
src/maasserver/clusterrpc/power_parameters.py). This field uses the
following regular expression:

  ^\s*([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}\s*$

The example given by Livia should not be allowed by this. It seems that
the power parameter forms are being bypassed. This bug deserves more
immediate investigation as it may be a sign of a bigger problem.

Incidentally, Mike's other examples would also not be allowed by the
expression above.

Changed in maas:
importance: Medium → High
Changed in maas:
assignee: nobody → Richard McCartney (ricgard)
tags: removed: ux
Changed in maas:
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
Revision history for this message
Karl Williams (deadlight) wrote :

This has landed

Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.