A namespace declaration is not an attribute. encoding/xml reports xmlns:Name="..." as an attribute named Name, and exclusive canonicalization drops declarations that nothing uses, so one added to a signed element would otherwise replace the value of the field without invalidating the signature.
(t *testing.T)
| 29 | // signed element would otherwise replace the value of the field without |
| 30 | // invalidating the signature. |
| 31 | func TestAttributeNameIgnoresNamespaceDeclaration(t *testing.T) { |
| 32 | var a Attribute |
| 33 | unmarshalForTest(t, `<saml:Attribute `+assertionNS+` Name="displayName" xmlns:Name="role"><saml:AttributeValue>admin</saml:AttributeValue></saml:Attribute>`, &a) |
| 34 | assert.Check(t, is.Equal(a.Name, "displayName")) |
| 35 | assert.Assert(t, is.Len(a.Values, 1)) |
| 36 | assert.Check(t, is.Equal(a.Values[0].Value, "admin")) |
| 37 | } |
| 38 | |
| 39 | func TestAttributeNameNotReadFromNamespaceDeclarationAlone(t *testing.T) { |
| 40 | var a Attribute |
nothing calls this directly
no test coverage detected