Skip to content

Feat/redirect to original page after login - #64

Open
scoufal wants to merge 3 commits into
arnost00:masterfrom
scoufal:feat/redirect-to-original-page-after-login
Open

scoufal wants to merge 3 commits into
arnost00:masterfrom
scoufal:feat/redirect-to-original-page-after-login

Conversation

@scoufal

@scoufal scoufal commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Allow external links direct to specific page.

The possible redirections are whitelisted for non-modifying pages to reduce security risk.

Access to following pages is tightened: claim.php, fin_bank_orphan_assign.php, view_adm_user_detail.php

Primary redirection targets:

  • race registration pages
  • finance claim pages
  • members finance page

Preserve validated protected-page URLs when anonymous users are sent to
the login form, then redirect them back after successful authentication.

Centralize resumable access checks, restrict forwarded URLs and query
parameters through an allowlist, and retain existing authorization rules
after login. Tighten access to payment claims, finance actions, and
administrator member details.

Update the login Playwright coverage for allowed, forbidden, and
role-specific direct routes, and remove obsolete small-manager callback
parameters.

Modifiing GET requests are not changed to POST, this change would be
too large.
Add a serial Playwright workflow covering member 4444 from creation through deletion.

The workflow verifies:
- Profile updates by club admin, administrator, manager, small manager, and member
- Small-manager assignment
- Member finance credit
- Disable and enable behavior
- Account creation and administrative locking
- Account and member deletion

Also add the member fixture and reusable helpers for profile updates, visibility changes, and deletion.
Comment thread www/ads_directory.inc.php Outdated
$row = array();
$row[] = $i++;
$row[] = '<a href="javascript:open_win(\'./view_adm_user_detail.php?id='.$zaznam['id'].'\',\'\')" class="adr_name">'.$zaznam['prijmeni'].'</a>';
$row[] = IsLoggedAdmin()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is for small admin - why test for admin ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here was the link to unsecured page available for anybody.
It was not possible to deduce the rights, the highest has been chosen.

The page title is "adminova stranka - editace clenu oddilu".

If small admin is appropriate, I have no problem with this.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

view_adm_user_detail.php is page primary for small admin. Sorry for ambiguous description

Comment thread www/export_directory.php
Comment thread www/find_reg.php
Comment thread www/mns_user_login_edit.php
Comment thread www/mns_user_edit.php
Comment thread www/news_edit.php
Comment thread www/race_boss.php
Comment thread www/sess.inc.php
Comment thread www/user_edit.php
Comment thread www/user_login_edit.php

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internal page, no reason to call login. Possible security risk

@scoufal scoufal Aug 18, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is definitely not right. In current implementation anybody can change anybody.

How to reproduce:
Login in TST as tnov_5 or any unprivileged user
Change the URL to: https://members.eob.cz/tst/view_adm_user_detail.php?id=12
Or direct change with:
Change Libor

With RequirePageAccess the user is authentificated first, then authorized.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this is not good, we missed this somewhere and the access rights must be higher.
Correct access rights are : small admin

@xkenia - please look at this file, it was added by you - what do you think about it ?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file need more attention. As @scoufal mentioned, it has security problems.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes should be done only with Big Admin priviledge, imho.

Comment thread www/categ_predef.php
Comment thread www/categ_predef_edit.php
Comment thread www/fin_type_edit.php
Comment thread www/race_edit.php
Comment thread www/race_imports.php
Comment thread www/race_finance_view.php
Comment thread www/race_imports_update.php
Comment thread www/race_kat.php
Comment thread www/race_new.php
Comment thread www/race_reg_chip.php
Comment thread www/race_reg_form.php
Comment thread www/user_finance_type.php
@arnost00

Copy link
Copy Markdown
Owner

My suggestion - use the file sys_log.php instead of index.php for logging in via the RequirePageAccess function.
And maybe we could add some label to sys_log.php with information about the source page for the login request.

@arnost00

Copy link
Copy Markdown
Owner

We should discuss what to do with "internal" pages in case of access without proper rights, whether to require login or write an error (as was the case originally).

Only user race registration, claim and user finance page are allowed to be forwarded to after login.
Comment thread www/fin_bank_orphan_assign.php Outdated

require_once ("./connect.inc.php");
require_once ("./sess.inc.php");
RequirePageAccess(IsLoggedFinance());

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No access right check here now ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A access check would be desirable, open question is if with login&forwarding (part of this PR) or just with check (rather a faster fix)

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.

3 participants