You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2020/01/17 17:18:37 UTC

[GitHub] [trafficcontrol] mitchell852 opened a new pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)

mitchell852 opened a new pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305
 
 
   ## What does this PR (Pull Request) do?
   
   - [x] This PR fixes #4298 
   
   ## Which Traffic Control components are affected by this PR?
   
   - Traffic Ops
   - Traffic Portal
   
   ## What is the best way to verify this PR?
   1. Run the UI tests
   2. Run the API tests
   3. Manually verify in TP by trying to enter a line break in the `Raw Remap Text` delivery service form field for a DNS, HTTP or ANY_MAP delivery service.
   4. Attempt to create or update a delivery service using the API where remapText contains \n or \r. It should fail.
   
   ## If this is a bug fix, what versions of Traffic Control are affected?
   - master (6b11bd9)
   - 3.1.0
   - 4.0.0 (RC1)
   
   
   ## The following criteria are ALL met by this PR
   
   - [x] This PR includes tests OR I have explained why tests are unnecessary
   - [x] This PR includes documentation OR I have explained why documentation is unnecessary
   - [x] This PR includes an update to CHANGELOG.md OR such an update is not necessary
   - [x] This PR includes any and all required license headers
   - [x] This PR ensures that database migration sequence is correct OR this PR does not include a database migration
   - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://www.apache.org/security/) for details)
   
   <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICENSE-2.0
   
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
   -->
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] mitchell852 commented on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
mitchell852 commented on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#issuecomment-575796441
 
 
   > The regular expression you're using isn't multi-line; `^` and `$` match the beginning and end of a line, respectively. So I can still do this:
   > 
   > ```js
   > >> temp0.name
   > <- "remapText"
   > >> temp0.tagName
   > <- "TEXTAREA"
   > >> temp0.attributes[4]
   > <- ng-pattern="/^[^\\n\\r]*$/"
   > >> temp0.value
   > <- "
   > this is a test
   > "
   > >> temp0.validity.patternMismatch
   > <- false
   > >> temp0.classList.contains("ng-invalid")
   > <- false
   > >> temp0.classList.contains("ng-valid")
   > <- true
   > ```
   
   well in the UI i am unable to enter anything on 2 lines so that's what i was going for

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] mitchell852 edited a comment on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
mitchell852 edited a comment on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#issuecomment-576718819
 
 
   > so this value would still exhibit the problem. So it ought to not be considered correct - especially since submission will result in an error.
   
   hmm. i can't replicate. this submits fine in both chrome and firefox.
   
   ![image](https://user-images.githubusercontent.com/251272/72815169-756fbb00-3c23-11ea-8b2a-9eb1b0acae8e.png)
   
   it makes it past the api so it appears to be getting trimmed. it's only when i added a value on a 2nd line that the field becomes invalid which is what i want.
   
   ![image](https://user-images.githubusercontent.com/251272/72815363-c5e71880-3c23-11ea-8d32-bee567eb62e9.png)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] mitchell852 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
mitchell852 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#discussion_r368105460
 
 

 ##########
 File path: traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.DNS.tpl.html
 ##########
 @@ -534,7 +534,8 @@ <h3>Current Value</h3>
                         </div>
                         </label>
                         <div class="col-md-10 col-sm-10 col-xs-12">
-                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" rows="3"></textarea>
+                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" ng-pattern="/^[^\n\r]*$/" rows="3"></textarea>
 
 Review comment:
   remap text gets long and i want the word wrapability of a TA.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] mitchell852 edited a comment on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
mitchell852 edited a comment on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#issuecomment-576718819
 
 
   > so this value would still exhibit the problem. So it ought to not be considered correct - especially since submission will result in an error.
   
   hmm. i can't replicate. this submits fine in both chrome and firefox as i would hope.
   
   ![image](https://user-images.githubusercontent.com/251272/72815169-756fbb00-3c23-11ea-8b2a-9eb1b0acae8e.png)
   
   it makes it past the api so it appears to be getting trimmed. it's only when i added a value on a 2nd line that the field becomes invalid which is what i want.
   
   ![image](https://user-images.githubusercontent.com/251272/72815363-c5e71880-3c23-11ea-8d32-bee567eb62e9.png)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] mitchell852 edited a comment on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
mitchell852 edited a comment on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#issuecomment-575796441
 
 
   > The regular expression you're using isn't multi-line; `^` and `$` match the beginning and end of a line, respectively. So I can still do this:
   > 
   > ```js
   > >> temp0.name
   > <- "remapText"
   > >> temp0.tagName
   > <- "TEXTAREA"
   > >> temp0.attributes[4]
   > <- ng-pattern="/^[^\\n\\r]*$/"
   > >> temp0.value
   > <- "
   > this is a test
   > "
   > >> temp0.validity.patternMismatch
   > <- false
   > >> temp0.classList.contains("ng-invalid")
   > <- false
   > >> temp0.classList.contains("ng-valid")
   > <- true
   > ```
   
   well in the UI i am unable to enter anything on 2+ lines so that's what i was going for. for example
   
   ![image](https://user-images.githubusercontent.com/251272/72646451-6cd16900-3933-11ea-9951-27cf5ce61b9c.png)
    
   ^^ is fine as it appears to get trimmed
   
   ![image](https://user-images.githubusercontent.com/251272/72646484-84105680-3933-11ea-97b4-aa60ebfde9e9.png)
   
   2 lines with content isn't allowed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] mitchell852 edited a comment on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
mitchell852 edited a comment on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#issuecomment-576718819
 
 
   > so this value would still exhibit the problem. So it ought to not be considered correct - especially since submission will result in an error.
   
   hmm. i can't replicate. this submits fine in both chrome and firefox as i would hope.
   
   ![image](https://user-images.githubusercontent.com/251272/72815169-756fbb00-3c23-11ea-8b2a-9eb1b0acae8e.png)
   
   it makes it past the api so it appears to be getting trimmed. also, remap.config looks fine when i submit that value ^^
   
   it's only when i added a value on a 2nd line that the field becomes invalid which is what i want.
   
   ![image](https://user-images.githubusercontent.com/251272/72815363-c5e71880-3c23-11ea-8d32-bee567eb62e9.png)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] ocket8888 commented on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#issuecomment-575799300
 
 
   No, you still can.
   
   ![Depiction of the problem](https://i.postimg.cc/NjpCQzKj/Screenshot-from-2020-01-17-14-15-24.png)
   
   That'll get rejected by the API but the form shows no problems. According to the issue, the content of this field is:
   
   > _"appended to the one line [in remap.config for most Delivery Services]"_
   
   so this value would still exhibit the problem. So it ought to not be considered correct - especially since submission will result in an error.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#discussion_r368096853
 
 

 ##########
 File path: traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.DNS.tpl.html
 ##########
 @@ -534,7 +534,8 @@ <h3>Current Value</h3>
                         </div>
                         </label>
                         <div class="col-md-10 col-sm-10 col-xs-12">
-                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" rows="3"></textarea>
+                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" ng-pattern="/^[^\n\r]*$/" rows="3"></textarea>
 
 Review comment:
   if this can't have multiple lines, why not just make it an `input[type="text"]`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] ocket8888 merged pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
ocket8888 merged pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] rawlinp commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
rawlinp commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#discussion_r368119404
 
 

 ##########
 File path: traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.DNS.tpl.html
 ##########
 @@ -534,7 +534,8 @@ <h3>Current Value</h3>
                         </div>
                         </label>
                         <div class="col-md-10 col-sm-10 col-xs-12">
-                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" rows="3"></textarea>
+                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" ng-pattern="/^[^\n\r]*$/" rows="3"></textarea>
 
 Review comment:
   I think because it's easier to read long inputs with text-wrapping.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] mitchell852 commented on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
mitchell852 commented on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#issuecomment-576741992
 
 
   retest this please

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#discussion_r368111813
 
 

 ##########
 File path: traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.DNS.tpl.html
 ##########
 @@ -534,7 +534,8 @@ <h3>Current Value</h3>
                         </div>
                         </label>
                         <div class="col-md-10 col-sm-10 col-xs-12">
-                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" rows="3"></textarea>
+                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" ng-pattern="/^[^\n\r]*$/" rows="3"></textarea>
 
 Review comment:
   Yeah, I suppose that makes sense. You _could_ make the number of rows dynamic so that it's always exactly big enough to contain its contents. But I won't make you do that to fix a bug.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#discussion_r368097301
 
 

 ##########
 File path: traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.anyMap.tpl.html
 ##########
 @@ -262,7 +262,8 @@ <h3>Current Value</h3>
                         </div>
                         </label>
                         <div class="col-md-10 col-sm-10 col-xs-12">
-                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" rows="3" required></textarea>
+                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" ng-pattern="/^[^\n\r]*$/" rows="3" required></textarea>
 
 Review comment:
   and one more time

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] mitchell852 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
mitchell852 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#discussion_r368115079
 
 

 ##########
 File path: traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.DNS.tpl.html
 ##########
 @@ -534,7 +534,8 @@ <h3>Current Value</h3>
                         </div>
                         </label>
                         <div class="col-md-10 col-sm-10 col-xs-12">
-                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" rows="3"></textarea>
+                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" ng-pattern="/^[^\n\r]*$/" rows="3"></textarea>
 
 Review comment:
   textareas are stretchable so i suppose if the content goes over the 3 rows, they can stretch the TA

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] mitchell852 edited a comment on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
mitchell852 edited a comment on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#issuecomment-575796441
 
 
   > The regular expression you're using isn't multi-line; `^` and `$` match the beginning and end of a line, respectively. So I can still do this:
   > 
   > ```js
   > >> temp0.name
   > <- "remapText"
   > >> temp0.tagName
   > <- "TEXTAREA"
   > >> temp0.attributes[4]
   > <- ng-pattern="/^[^\\n\\r]*$/"
   > >> temp0.value
   > <- "
   > this is a test
   > "
   > >> temp0.validity.patternMismatch
   > <- false
   > >> temp0.classList.contains("ng-invalid")
   > <- false
   > >> temp0.classList.contains("ng-valid")
   > <- true
   > ```
   
   well in the UI i am unable to enter anything on 2+ lines so that's what i was going for

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#discussion_r368093287
 
 

 ##########
 File path: traffic_ops/testing/api/v14/deliveryservices_test.go
 ##########
 @@ -189,6 +190,39 @@ func UpdateNullableTestDeliveryServices(t *testing.T) {
 	}
 }
 
+// UpdateDeliveryServiceWithInvalidRemapText ensures that a delivery service can't be updated with a remap text value with a line break in it
 
 Review comment:
   nit: GoDoc missing period

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
ocket8888 commented on a change in pull request #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#discussion_r368097208
 
 

 ##########
 File path: traffic_portal/app/src/common/modules/form/deliveryService/form.deliveryService.HTTP.tpl.html
 ##########
 @@ -534,7 +534,8 @@ <h3>Current Value</h3>
                         </div>
                         </label>
                         <div class="col-md-10 col-sm-10 col-xs-12">
-                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" rows="3"></textarea>
+                            <textarea id="remapText" name="remapText" class="form-control" ng-model="deliveryService.remapText" ng-pattern="/^[^\n\r]*$/" rows="3"></textarea>
 
 Review comment:
   same as above RE `textarea` vs `input[type="text"]`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [trafficcontrol] mitchell852 commented on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)

Posted by GitBox <gi...@apache.org>.
mitchell852 commented on issue #4305: Prevents line breaks in delivery service remapText field (UI and API)
URL: https://github.com/apache/trafficcontrol/pull/4305#issuecomment-576718819
 
 
   > so this value would still exhibit the problem. So it ought to not be considered correct - especially since submission will result in an error.
   
   hmm. i can't replicate. this submits fine in both chrome and firefox.
   
   ![image](https://user-images.githubusercontent.com/251272/72815169-756fbb00-3c23-11ea-8b2a-9eb1b0acae8e.png)
   
   it makes it past the api so it appears to be getting trimmed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services