Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken access control #1590

Merged
merged 2 commits into from
Jun 26, 2024
Merged

Fix broken access control #1590

merged 2 commits into from
Jun 26, 2024

Conversation

tanftw
Copy link
Contributor

@tanftw tanftw commented Jun 25, 2024

E thấy term sẽ visible với tất cả user nên e không fix, không biết có trường hợp nào cần limit không?

Hướng xử lý của e:

Post

  • Thêm perm vào query, mặc định là readable.
  • Không chấp nhận query perm qua ajax.

User

  • Ẩn user_emailuser_pass.
  • Không chấp nhận query fields qua ajax.
  • Nếu người dùng vẫn muốn lấy user_email thì dùng filter như sau:
// This filter accepts two paramters
add_filter ('rwmb_user_query_args_fields', function ($args, $field) {
	return [
		'ID',
		'user_login',
		'user_email',
		'user_nicename',
		'user_url',
		'user_registered',
		'user_status',
		'display_name',
	];
}, 10, 2);

P/S: Thực ra e thấy config fields qua settings của field hay hơn là dùng filter, nhưng trong phần ajax làm sao lấy được $field qua field id nhỉ? Dùng $field = rwmb_get_field_settings( $field_id ); thì với nhiều loại object_type, post type khác sợ ko chuẩn.

@tanftw tanftw requested a review from rilwis June 25, 2024 08:40
@rilwis rilwis changed the title BREAKING CHANGE: fix broken access control Fix broken access control Jun 26, 2024
@rilwis rilwis merged commit db1e61a into master Jun 26, 2024
1 check passed
@rilwis rilwis deleted the fix-broken-access-control branch June 26, 2024 07:28
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