mirror of https://github.com/hashicorp/consul
Clarifies comment about name vs. ID.
parent
666619dfc9
commit
0bd7e82686
|
@ -68,9 +68,12 @@ func (s *StateStore) preparedQuerySetTxn(tx *memdb.Txn, idx uint64, query *struc
|
||||||
query.ModifyIndex = idx
|
query.ModifyIndex = idx
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify that the name doesn't alias any existing ID. If we didn't do
|
// Verify that the name doesn't alias any existing ID. We allow queries
|
||||||
// this then a bad actor could steal traffic away from an existing DNS
|
// to be looked up by ID *or* name so we don't want anyone to try to
|
||||||
// entry.
|
// register a query with a name equal to some other query's ID in an
|
||||||
|
// attempt to hijack it. We also look up by ID *then* name in order to
|
||||||
|
// prevent this, but it seems prudent to prevent these types of rogue
|
||||||
|
// queries from ever making it into the state store.
|
||||||
if query.Name != "" {
|
if query.Name != "" {
|
||||||
existing, err := tx.First("prepared-queries", "id", query.Name)
|
existing, err := tx.First("prepared-queries", "id", query.Name)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue