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

Make API token optional for user api routes #159

Merged
merged 7 commits into from
Feb 6, 2025

Conversation

chuckadams
Copy link
Contributor

Pull Request

What changed?

  • Made the API token optional, but validated if present.

  • Removed the app.aspirecloud.api_authentication_enable option. It's always enabled and optional now, except for admin routes where it's always been mandatory.

  • Unrelated change: sets the default error_reporting level to E_ALL & ~E_DEPRECATED.

Why did it change?

We should remove the speedbumps on adoption, plus it creates a privacy headache, being linked to registration email and all that. We can start throttling unauthenticated users if we need to.

We also don't need deprecation notices spamming up stderr on production.

Did you fix any specific issues?

Closes: #157

CERTIFICATION

By opening this pull request, I do agree to abide by the Code of Conduct and be bound by the terms of the Contribution Guidelines in effect on the date and time of my contribution as proven by the revision information in GitHub.

@chuckadams chuckadams requested review from namithj and costdev February 6, 2025 18:47
$response = $this->getjson('/plugins/info/1.1?action=query_plugins');
$response->assertStatus(200);
})->skip(fn() => config('app.aspirecloud.api_authentication_enable'), 'API authentication is enabled');
// TODO: write tests for real and and bad auth tokens
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// TODO: write tests for real and and bad auth tokens
// TODO: write tests for real and bad auth tokens

Double "and". Possibly jittery from too much coffee 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

☕️☕️☕️ + 🌲🌲 = 😳

Anyway I already tested a bad token so I just need to generate and use a real one, and hopefully I'll have that knocked out before I merge this (it's already getting deployed to .io before then)

Copy link
Collaborator

@costdev costdev left a comment

Choose a reason for hiding this comment

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

Looks good aside from the style error 👍

@chuckadams
Copy link
Contributor Author

I decided to kick pint to the curb in CI, it's too slow to be worth it. If prettier can do PER-CS, I'll consider switching to it (I don't know about its php 8.4 support but we're not using any 8.4 syntax yet)

@chuckadams chuckadams merged commit 5933325 into main Feb 6, 2025
1 check passed
@chuckadams chuckadams deleted the chuck/ac-157/drop-api-keys branch February 6, 2025 20:10
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.

Drop API Key requirements for wp.org API routes
2 participants