Skip to content

add --aup-check - #43

Open
jfouret wants to merge 2 commits into
WEHI-ResearchComputing:mainfrom
jfouret:main
Open

add --aup-check#43
jfouret wants to merge 2 commits into
WEHI-ResearchComputing:mainfrom
jfouret:main

Conversation

@jfouret

@jfouret jfouret commented Aug 7, 2026

Copy link
Copy Markdown
  • --aup-checked flag for the upload, upload-voucher, and invite commands. This is required when the FileSender instance has aup_enabled=true [#679]

@jfouret

jfouret commented Aug 7, 2026

Copy link
Copy Markdown
Author

also when by default get_a_link was set, the result was to prevent the send to recipients.
so I replaced the logic to set get_a_link to false by default and ensure recipients is applied (since it's a mandatory argument).

@multimeric

Copy link
Copy Markdown
Collaborator

This all looks good, but can I please have some more context about the AUP feature? What does it display in the web UI? I think we may have to find a way to print the message back to the user and then have them agree to it interactively to follow the spirit of the policy.

The get_a_link change ideally would have been a separate PR. I can review them together but it will mean one blocks the other. Can we instead make get_a_link configurable instead of hardcoding one way or the other? Can you add some tests for this?

@jfouret

jfouret commented Aug 10, 2026

Copy link
Copy Markdown
Author

Regarding AUP

AUP stands for Acceptable Use policy. In France, it seems that RENATER (who operates filesender for all universities and research institutions in France) impose that AUP is checked. Renater AUP are here.

This was the error:

[/xxx/FileSenderCli/filesender/api.py:508]
        transfer = await self.create_transfer(
            {
                "files": file_info,
                "options": {
                    "email_download_complete": True,
                },
                **transfer_args,
            }
        ) 

The RENATER FileSender instance (filesender.renater.fr) has aup_enabled=true (Acceptable Use Policy enabled). This is a known issue documented in GitHub Issue #679: https://github.com/filesender/filesender/issues/679

Could you update this project to add an option `--aup-checked` when necessary ?

The message appears already straightforward, no ?

Regarding get_a_link.

There was not error, but the e-mail were not recieved. Here the log:

xxx@xxx:~$ pixi r -m ~/xxx filesender --log-level DEBUG --base-url https://filesender.renater.fr upload --username xxx@xxx --aup-checked --apikey "xxx" --recipients "xxx@xxx" xxx
[17:25:08] DEBUG    Using selector: EpollSelector                                                                                                                        selector_events.py:64
[17:25:09] DEBUG    connect_tcp.started host='filesender.renater.fr' port=443 local_address=None timeout=None socket_options=None                                                 _trace.py:87
           DEBUG    connect_tcp.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0x7f618c67f080>                                                             _trace.py:87
           DEBUG    start_tls.started ssl_context=<ssl.SSLContext object at 0x7f618c444cd0> server_hostname='filesender.renater.fr' timeout=None                                  _trace.py:87
           DEBUG    start_tls.complete return_value=<httpcore._backends.anyio.AnyIOStream object at 0x7f618cd83500>                                                               _trace.py:87
           DEBUG    send_request_headers.started request=<Request [b'GET']>                                                                                                       _trace.py:87
           DEBUG    send_request_headers.complete                                                                                                                                 _trace.py:87
           DEBUG    send_request_body.started request=<Request [b'GET']>                                                                                                          _trace.py:87
           DEBUG    send_request_body.complete                                                                                                                                    _trace.py:87
           DEBUG    receive_response_headers.started request=<Request [b'GET']>                                                                                                   _trace.py:87
           DEBUG    receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Date', b'Fri, 07 Aug 2026 15:25:09 GMT'), (b'X-Frame-Options', b'SAMEORIGIN'),   _trace.py:87
                    (b'Expires', b'Thu, 19 Nov 1981 08:52:00 GMT'), (b'Cache-Control', b'no-store, no-cache, must-revalidate'), (b'Pragma', b'no-cache'), (b'X-Frame-Options',                
                    b'sameorigin'), (b'Strict-Transport-Security', b'max-age=31536000; includeSubDomains'), (b'Content-Length', b'147'), (b'Content-Type', b'application/json'),              
                    (b'Set-Cookie', b'PHPSESSID=xxx; path=/'), (b'Keep-Alive', b'timeout=5, max=97'), (b'Connection', b'Keep-Alive')])                                 
           INFO     HTTP Request: GET https://filesender.renater.fr/rest.php/info "HTTP/1.1 200 OK"                                                                            _client.py:1740
           DEBUG    receive_response_body.started request=<Request [b'GET']>                                                                                                      _trace.py:87
           DEBUG    receive_response_body.complete                                                                                                                                _trace.py:87
           DEBUG    response_closed.started                                                                                                                                       _trace.py:87
           DEBUG    response_closed.complete                                                                                                                                     _trace.py:87
           DEBUG    send_request_headers.started request=<Request [b'POST']>                                                                                                      _trace.py:87
           DEBUG    send_request_headers.complete                                                                                                                                 _trace.py:87
           DEBUG    send_request_body.started request=<Request [b'POST']>                                                                                                         _trace.py:87
           DEBUG    send_request_body.complete                                                                                                                                    _trace.py:87
           DEBUG    receive_response_headers.started request=<Request [b'POST']>                                                                                                  _trace.py:87
[17:25:10] DEBUG    receive_response_headers.complete return_value=(b'HTTP/1.1', 201, b'Created', [(b'Date', b'Fri, 07 Aug 2026 15:25:09 GMT'), (b'X-Frame-Options',              _trace.py:87
                    b'SAMEORIGIN'), (b'X-Frame-Options', b'sameorigin'), (b'Strict-Transport-Security', b'max-age=31536000; includeSubDomains'), (b'Location',                                
                    b'https://filesender.renater.fr/rest.php/transfer/13379386'), (b'Content-Length', b'959'), (b'Content-Type', b'application/json'), (b'Keep-Alive',                        
                    b'timeout=5, max=96'), (b'Connection', b'Keep-Alive')])                                                                                                                   
           INFO     HTTP Request: POST                                                                                                                                         _client.py:1740
                    https://filesender.renater.fr/rest.php/transfer?remote_user=xxx%40xxx&timestamp=1786116309&signature=xxx "HTTP/1.1 201 Created"                                                  
           DEBUG    receive_response_body.started request=<Request [b'POST']>                                                                                                     _trace.py:87
           DEBUG    receive_response_body.complete                                                                                                                                _trace.py:87
           DEBUG    response_closed.started                                                                                                                                       _trace.py:87
           DEBUG    response_closed.complete                                                                                                                                     _trace.py:87
xxx:   0%|                                                                                                                                                 | 0/1 [00:00<?, ?it/s]           DEBUG    send_request_headers.started request=<Request [b'PUT']>                                                                                                       _trace.py:87
           DEBUG    send_request_headers.complete                                                                                                                                 _trace.py:87
           DEBUG    send_request_body.started request=<Request [b'PUT']>                                                                                                          _trace.py:87
           DEBUG    send_request_body.complete                                                                                                                                    _trace.py:87
           DEBUG    receive_response_headers.started request=<Request [b'PUT']>                                                                                                   _trace.py:87
           DEBUG    receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Date', b'Fri, 07 Aug 2026 15:25:10 GMT'), (b'X-Frame-Options', b'SAMEORIGIN'),   _trace.py:87
                    (b'X-Frame-Options', b'sameorigin'), (b'Strict-Transport-Security', b'max-age=31536000; includeSubDomains'), (b'Content-Length', b'25'), (b'Content-Type',                
                    b'application/json'), (b'Keep-Alive', b'timeout=5, max=100'), (b'Connection', b'Keep-Alive')])                                                                            
           INFO     HTTP Request: PUT                                                                                                                                          _client.py:1740
                    https://filesender.renater.fr/rest.php/file/76295154/chunk/0?key=xxx&remote_user=xxx%40xxx&roundtriptoken=xxx&timestamp=1786116310&signature=xxx "HTTP/1.1 200 OK"                                                 
           DEBUG    receive_response_body.started request=<Request [b'PUT']>                                                                                                      _trace.py:87
           DEBUG    receive_response_body.complete                                                                                                                                _trace.py:87
           DEBUG    response_closed.started                                                                                                                                       _trace.py:87
           DEBUG    response_closed.complete                                                                                                                                     _trace.py:87
xxx: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 21.24it/s]
           DEBUG    send_request_headers.started request=<Request [b'PUT']>                                                                                                       _trace.py:87
           DEBUG    send_request_headers.complete                                                                                                                                 _trace.py:87
           DEBUG    send_request_body.started request=<Request [b'PUT']>                                                                                                          _trace.py:87
           DEBUG    send_request_body.complete                                                                                                                                    _trace.py:87
           DEBUG    receive_response_headers.started request=<Request [b'PUT']>                                                                                                   _trace.py:87
           DEBUG    receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Date', b'Fri, 07 Aug 2026 15:25:10 GMT'), (b'X-Frame-Options', b'SAMEORIGIN'),   _trace.py:87
                    (b'X-Frame-Options', b'sameorigin'), (b'Strict-Transport-Security', b'max-age=31536000; includeSubDomains'), (b'Content-Length', b'4'), (b'Content-Type',                 
                    b'application/json'), (b'Keep-Alive', b'timeout=5, max=99'), (b'Connection', b'Keep-Alive')])                                                                             
           INFO     HTTP Request: PUT                                                                                                                                          _client.py:1740
                    https://filesender.renater.fr/rest.php/file/76295154?key=xxx&remote_user=xxx%40xxx&roundtriptoken=xxx&timestamp=1786116310&signature=xxx "HTTP/1.1 200 OK"                                                         
           DEBUG    receive_response_body.started request=<Request [b'PUT']>                                                                                                      _trace.py:87
           DEBUG    receive_response_body.complete                                                                                                                                _trace.py:87
           DEBUG    response_closed.started                                                                                                                                       _trace.py:87
           DEBUG    response_closed.complete                                                                                                                                     _trace.py:87
           DEBUG    send_request_headers.started request=<Request [b'PUT']>                                                                                                       _trace.py:87
           DEBUG    send_request_headers.complete                                                                                                                                 _trace.py:87
           DEBUG    send_request_body.started request=<Request [b'PUT']>                                                                                                          _trace.py:87
           DEBUG    send_request_body.complete                                                                                                                                    _trace.py:87
           DEBUG    receive_response_headers.started request=<Request [b'PUT']>                                                                                                   _trace.py:87
           DEBUG    receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Date', b'Fri, 07 Aug 2026 15:25:10 GMT'), (b'X-Frame-Options', b'SAMEORIGIN'),   _trace.py:87
                    (b'X-Frame-Options', b'sameorigin'), (b'Strict-Transport-Security', b'max-age=31536000; includeSubDomains'), (b'Content-Length', b'914'), (b'Content-Type',               
                    b'application/json'), (b'Keep-Alive', b'timeout=5, max=98'), (b'Connection', b'Keep-Alive')])                                                                             
           INFO     HTTP Request: PUT                                                                                                                                          _client.py:1740
                    https://filesender.renater.fr/rest.php/transfer/13379386?remote_user=xxx%40xxx&roundtriptoken=xxx&timestamp=1786116310&signature=xxx "HTTP/1.1 200 OK"                                                                                              
           DEBUG    receive_response_body.started request=<Request [b'PUT']>                                                                                                      _trace.py:87
           DEBUG    receive_response_body.complete                                                                                                                                _trace.py:87
           DEBUG    response_closed.started                                                                                                                                       _trace.py:87
           DEBUG    response_closed.complete                                                                                                                                     _trace.py:87
           VERBOSE  {                                                                                                                                                              main.py:275
                        'id': 13379386,                                                                                                                                                       
                        'userid': 1003066,                                                                                                                                                    
                        'user_email': 'xxx@xxx',                                                                                                                                
                        'subject': None,                                                                                                                                                      
                        'message': None,                                                                                                                                                      
                        'created': {'raw': 1786116309, 'formatted': '07/08/2026'},                                                                                                            
                        'expires': {'raw': 1787412309, 'formatted': '22/08/2026'},                                                                                                            
                        'expiry_date_extension': 0,                                                                                                                                           
                        'options': {                                                                                                                                                          
                            'get_a_link': True,                                                                                                                                               
                            'email_recipient_when_transfer_expires': False,                                                                                                                   
                            'hide_sender_email': False,                                                                                                                                       
                            'email_download_complete': True,                                                                                                                                  
                            'encryption': False                                                                                                                                               
                        },                                                                                                                                                                    
                        'salt': 'xxx',                                                                                                                           
                        'roundtriptoken': '',                                                                                                                                                 
                        'files': [                                                                                                                                                            
                            {                                                                                                                                                                 
                                'id': 76295154,                                                                                                                                               
                                'transfer_id': 13379386,                                                                                                                                      
                                'uid': 'xxx',                                                                                                                                               
                                'name': 'xxx',                                                                                                                                    
                                'size': 12,                                                                                                                                                   
                                'sha1': None                                                                                                                                                  
                            }                                                                                                                                                                 
                        ],                                                                                                                                                                    
                        'recipients': [                                                                                                                                                       
                            {                                                                                                                                                                 
                                'id': 14837792,                                                                                                                                               
                                'transfer_id': 13379386,                                                                                                                                      
                                'token': 'xxx',                                                                                                              
                                'email': '',                                                                                                                                                  
                                'created': {'raw': 1786116309, 'formatted': '07/08/2026'},                                                                                                    
                                'last_activity': None,                                                                                                                                        
                                'options': None,                                                                                                                                              
                                'download_url': 'https://filesender.renater.fr/?s=download&token=xxx',                                                       
                                'errors': []                                                                                                                                                  
                            }                                                                                                                                                                 
                        ]                                                                                                                                                                     
                    }                                                                                                                                                                         
           FEEDBACK Upload completed successfully         

You see the verbose in main.py:275 Whereas I asked for recipient in the CLI. It was not not present.

Here the Analysis I got when I ask an LLM to analyse the filesender code:

Cause chain, from FileSender source:

  • Transfer.class.php:976 — if get_a_link option set, server runs addRecipient('') (anonymous, empty email) instead of your email list.
  • Transfer.class.php:1631if (!$this->getOption(GET_A_LINK)) { send transfer_available ... } → in get_a_link mode no transfer emails are sent at all.
  • Why get_a_link is True: RestEndpointTransfer.class.php:634-639 takes defaults from Transfer::allOptions(); renater ships get_a_link default = True.
  • Your client only sends options = {"email_download_complete": true} (api.py:512) — it never sets get_a_link, so the server default (True) sticks. Hence anonymous link-only transfer, zero mail.

Regarding review

It's not a problem for me if it's blocked, I use source install.

Regarding the tests

I will provide them if/when I have time, if the brought solution is approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants