func SecureRule(networkID string, rule *rulefmt.Rule) error {
	networkLabels := map[string]string{metrics.NetworkLabelName: networkID}
	restrictor := security.NewQueryRestrictor(networkLabels)

	restrictedExpression, err := restrictor.RestrictQuery(rule.Expr)
	if err != nil {
		return err
	}
	rule.Expr = restrictedExpression
	if rule.Labels == nil {
		rule.Labels = make(map[string]string)
	}
	rule.Labels[metrics.NetworkLabelName] = networkID
	return nil
}
// SecureRule attaches a label for networkID to the given alert expression to
// to ensure that only metrics owned by this network can be alerted on
SecureRule attaches a label for networkID to the given alert expression to
to ensure that only metrics owned by this network can be alerted on
// SecureRule attaches a label for networkID to the given alert expression to // to ensure that only metrics owned by this network can be alerted on
func SecureRule(networkID string, rule *rulefmt.Rule) error {
	networkLabels := map[string]string{metrics.NetworkLabelName: networkID}
	restrictor := security.NewQueryRestrictor(networkLabels)
	restrictedExpression, err := restrictor.RestrictQuery(rule.Expr)
	if err != nil {
		return err
	}
	rule.Expr = restrictedExpression
	if rule.Labels == nil {
		rule.Labels = make(map[string]string)
	}
	rule.Labels[metrics.NetworkLabelName] = networkID
	return nil
}
func SecureRule ( networkID string , rule * rulefmt . Rule ) error { networkLabels := map [ string ] string { metrics . NetworkLabelName : networkID } restrictor := security . NewQueryRestrictor ( networkLabels ) restrictedExpression , err := restrictor . RestrictQuery ( rule . Expr ) if err != nil { return err } rule . Expr = restrictedExpression if rule . Labels == nil { rule . Labels = make ( map [ string ] string ) } rule . Labels [ metrics . NetworkLabelName ] = networkID return nil }
SecureRule attaches a label for networkID to the given alert expression to
to ensure that only metrics owned by this network can be alerted on
SecureRule attaches a label for networkID to the given alert expression to to ensure that only metrics owned by this network can be alerted on