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

feat(3266): add authn for banner list and get endpoints #3278

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

VonnyJap
Copy link
Member

@VonnyJap VonnyJap commented Feb 5, 2025

Context

The current banner endpoints for list and get do not require user authentication, which is unintended behavior.

Objective

The change aims to enforce token-based authentication for both API endpoints.

References

#3266

License

I confirm that this contribution is made under a BSD license and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@coveralls
Copy link

coveralls commented Feb 5, 2025

Coverage Status

coverage: 95.317%. remained the same
when pulling 646dbc1 on banner-authz
into 87dfd38 on master.

plugins/banners/get.js Outdated Show resolved Hide resolved
plugins/banners/list.js Outdated Show resolved Hide resolved
@@ -13,6 +13,10 @@ module.exports = () => ({
description: 'Get a single banner',
notes: 'Return a banner record',
tags: ['api', 'banners'],
auth: {
strategies: ['token'],
scope: ['user']
Copy link
Member

Choose a reason for hiding this comment

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

Banners with GLOBAL scope are currently being fetched without the user being authenticated.
image

This change makes it backward incompatible. We are unable fetch 'GLOBAL' banners when the user is not authenticated.
image

Auth check may need to be done selectively based on the scope. GLOBAL can be accessed by anyone like before. But, PIPELINE should be accessed by a user with valid token.

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