Edgewall Software

Ticket #511 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

bitten slave sends wrong url as referrer when logging in

Reported by: Felix Schwarz <felix.schwarz@…> Owned by: osimons
Priority: blocker Milestone: 0.6
Component: Build slave Version: dev
Keywords: Cc:
Operating System:

Description

Since r793 the bitten slave sends 'http://domain/builds' as a referrer when logging in (see #459). However that URL only allows POST requests. The correct URL is 'http://domain/build' (no 's').

Attachments

511_send_correct_referrer_for_login.patch Download (0.7 KB) - added by Felix Schwarz <felix.schwarz@…> 3 years ago.
proposed patch which has the disadvantage that BUILD_VIEW privileges are needed. Maybe redirecting to /about is more sensible as this is always allowed(?).

Change History

Changed 3 years ago by Felix Schwarz <felix.schwarz@…>

proposed patch which has the disadvantage that BUILD_VIEW privileges are needed. Maybe redirecting to /about is more sensible as this is always allowed(?).

  Changed 3 years ago by osimons

  • version set to dev
  • milestone changed from 0.6.1 to 0.6

Is it a problem? The whole idea was to redirect to a minimal page that takes no load to render and is really only intended for machine-to-machine communication (slave-master). That is also what the /builds url is seeing it is only protocol talk there. Does it matter that it returns a simple error? The idea was also to render a simple message - and not needing to make the full request processing, with chrome and template rendering that makes no sense for machine communication.

Also if we redirect anywhere outside our control, we cannot really be sure. Others may implement special permissions (using security policies, or request filters), or for instance my setup contains this in trac.ini:

[components]
trac.about.* = disabled

... I got not 'About Trac' page in my projects.

Propose 'wontfix' unless I can be convinced that current code is actually a problem... Is it really a 'blocker' issue at your end?

  Changed 3 years ago by Felix Schwarz <felix.schwarz@…>

The problem for me was that no build started because of the 405 error message. I should have been more clear about this. In my environment the bitten slave only had 'BUILD_EXEC' permission (authenticated: TICKET_CREATE, TICKET_MODIFY, TICKET_VIEW, WIKI_CREATE, WIKI_MODIFY, WIKI_VIEW, no privileges for anonymous users).

To me the problem is quite obvious from the code:

follow-up: ↓ 4   Changed 3 years ago by osimons

Got it now - it seems your master (Trac plugin) does not make the expected response. It should not raise a 405, it should just make a regular response (200) if master is also updated to same version running code like this:

            if req.method != 'POST':
                self._send_response(req,
                                body='Only POST allowed for build creation.')

So, the real problem here is actually that I forgot to increment my 'protocol version' counter that should ensure that master and slave speaks the same language... - or that slave outputs a useful error message if not:

  • bitten/__init__.py

     
    1919        pass 
    2020 
    2121# The master-slave protocol/configuration version 
    22 PROTOCOL_VERSION = 2 
     22PROTOCOL_VERSION = 3 

If you want to try it, you can update the slave code and see that it outputs a useful error about version mismatch - it should, I hope :-)

in reply to: ↑ 3   Changed 3 years ago by Felix Schwarz <felix.schwarz@…>

Good catch - sorry for that. My master runs 790 and I did not notice the revision number mismatch (which causes the subtle, but important difference between '_send_error()' and '_send_message()').

  Changed 3 years ago by osimons

  • owner set to osimons

I'll update the protocol version and improve the console logging to make the error message appear without needing verbose logging.

  Changed 3 years ago by osimons

  • status changed from new to closed
  • resolution set to fixed

Committed in [797]. Will merge to 0.6.x soon.

Add/Change #511 (bitten slave sends wrong url as referrer when logging in)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.