alopresto commented on issue #4125: NIFI-7153 Adds ContentLengthFilter and 
DoSFilter
URL: https://github.com/apache/nifi/pull/4125#issuecomment-602970413
 
 
   I am able to verify some behavior but I am not able to see the log output in 
`nifi-app.log`. I followed the steps below:
   
   _Successful case:_ 
   
   1. Start NiFi as normal. 
   1. Run the following curl command (assume a valid 10KB file containing a 
valid template in XML at the listed location): `curl 
'http://localhost:8080/nifi-api/process-groups/09c4c19d-0171-1000-5cd1-d637f8154dea/templates/upload'
 \
   -F 
"template=@/Users/alopresto/Workspace/scratch/templates/2020-03-23-NIFI-7153-small-template.xml"
 \
   -vvv`
   
   *Result:* The template is successfully uploaded. 
   
   ```
   🔒 0s @ 18:54:02 $ curl 
'http://localhost:8080/nifi-api/process-groups/09c4c19d-0171-1000-5cd1-d637f8154dea/templates/upload'
 -F 
"template=@/Users/alopresto/Workspace/scratch/templates/2020-03-23-NIFI-7153-small-template.xml"
 -vvv
   *   Trying 127.0.0.1...
   * TCP_NODELAY set
   * Connected to localhost (127.0.0.1) port 8080 (#0)
   > POST 
/nifi-api/process-groups/09c4c19d-0171-1000-5cd1-d637f8154dea/templates/upload 
HTTP/1.1
   > Host: localhost:8080
   > User-Agent: curl/7.54.0
   > Accept: */*
   > Content-Length: 10641
   > Expect: 100-continue
   > Content-Type: multipart/form-data; 
boundary=------------------------20e80121221a51f6
   >
   < HTTP/1.1 100 Continue
   < HTTP/1.1 201 Created
   < Date: Tue, 24 Mar 2020 02:08:16 GMT
   < X-Frame-Options: SAMEORIGIN
   < Content-Security-Policy: frame-ancestors 'self'
   < X-XSS-Protection: 1; mode=block
   < Location: 
http://localhost:8080/nifi-api/templates/253f8230-9046-4e9a-8f8b-ee10acefdab0
   < Content-Type: application/xml
   < Vary: Accept-Encoding
   < Vary: User-Agent
   < Content-Length: 433
   < Server: Jetty(9.4.19.v20190610)
   <
   * Connection #0 to host localhost left intact
   <?xml version="1.0" encoding="UTF-8" 
standalone="yes"?><templateEntity><template 
encoding-version="1.3"><description>GFF -&gt; 
LA</description><groupId>09c4c19d-0171-1000-5cd1-d637f8154dea</groupId><id>253f8230-9046-4e9a-8f8b-ee10acefdab0</id><name>Simple
 Template</name><timestamp>03/23/2020 19:08:16 
PDT</timestamp><uri>http://localhost:8080/nifi-api/templates/253f8230-9046-4e9a-8f8b-ee10acefdab0</uri></template></templateEntity>
   ```
   
   _Failing case (default max length is 20 MB):_
   
   1. Modify `conf/logback.xml` to include a `logger` entry for `<logger 
name="org.apache.nifi.web.security.requests" level="DEBUG" />`
   1. Run the following curl command (assume a 21 MB file containing a valid 
template in XML at the listed location): `curl 
'http://localhost:8080/nifi-api/process-groups/09c4c19d-0171-1000-5cd1-d637f8154dea/templates/upload'
 \
   -F 
"template=@/Users/alopresto/Workspace/scratch/templates/2020-03-23-NIFI-7153-small-template-21MB.xml"
 \
   -vvv`
   
   *Result:* The application replies with HTTP 413 Payload Too Large but there 
is no warning printed in the log
   
   ```
   🔓 4s @ 19:13:21 $ curl 
'http://localhost:8080/nifi-api/process-groups/09c4c19d-0171-1000-5cd1-d637f8154dea/templates/upload'
 -F 
"template=@/Users/alopresto/Workspace/scratch/templates/2020-03-23-NIFI-7153-small-template-21MB.xml"
 -vvv
   *   Trying 127.0.0.1...
   * TCP_NODELAY set
   * Connected to localhost (127.0.0.1) port 8080 (#0)
   > POST 
/nifi-api/process-groups/09c4c19d-0171-1000-5cd1-d637f8154dea/templates/upload 
HTTP/1.1
   > Host: localhost:8080
   > User-Agent: curl/7.54.0
   > Accept: */*
   > Content-Length: 21235140
   > Expect: 100-continue
   > Content-Type: multipart/form-data; 
boundary=------------------------6941ef9b1246d1eb
   >
   * Done waiting for 100-continue
   < HTTP/1.1 413 Payload Too Large
   < Date: Tue, 24 Mar 2020 02:14:26 GMT
   < X-Frame-Options: SAMEORIGIN
   < Content-Security-Policy: frame-ancestors 'self'
   < X-XSS-Protection: 1; mode=block
   < Content-Type: text/plain
   < Content-Length: 17
   < Connection: close
   < Server: Jetty(9.4.19.v20190610)
   <
   * we are done reading and this is set to close, stop send
   * Closing connection 0
   Payload Too large
   ```
   
   @natural can you reproduce this? Am I missing a required step? Even with the 
log level set to DEBUG, I do not see the `logger.debug()` lines either. I am 
able to see the code execution through remote debugging, and it appears to 
execute those lines. 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to