Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

#511 closed defect (fixed)

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 (1)

511_send_correct_referrer_for_login.patch (762 bytes) - added by Felix Schwarz <felix.schwarz@…> 15 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(?).

Download all attachments as: .zip

Change History (7)

Changed 15 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(?).

comment:1 Changed 15 years ago by osimons

  • Milestone changed from 0.6.1 to 0.6
  • Version set to dev

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?

comment:2 Changed 15 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:

comment:3 follow-up: Changed 15 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 :-)

comment:4 in reply to: ↑ 3 Changed 15 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()').

comment:5 Changed 15 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.

comment:6 Changed 15 years ago by osimons

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.