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

Address an AuthZ flaw #1610

Merged
merged 5 commits into from
May 2, 2024
Merged

Address an AuthZ flaw #1610

merged 5 commits into from
May 2, 2024

Conversation

tylerwowen
Copy link
Contributor

@tylerwowen tylerwowen commented May 1, 2024

Previously Teletraan looks for the request body for AuthZ resource identifier. However it has a security flaw for some endpoints. This PR address the issue by using the identifier from request path parameter for those affected resources.

Details of the issue

Some Teletraan endpoints follows a pattern that requires the resource identifier in the path parameter, while the request body also contains the same ID field. The ID in the path parameter is used for later processing. Therefore it's possible for a request to contain 2 resource IDs and the one used for authorization can be different from the resource being changed.

Changes

First of all some interface change. Previously the annotation ResourceAuthZInfo.type expects the type of the extracted resource. Now it's the type of the input resource. This will reduce some confusion because it matches the method it annotates.

When appropriate, a path resource extractor replaces the previously used body resource extractor. New implementations of resource extractors are added.

The most change happen in the EnvStageBodyExtractor.java. This is the result of the interface change. The implementation are split into individual extractors.

Tests and validation

Close to 100% test coverage for this change.

@tylerwowen tylerwowen requested a review from a team as a code owner May 1, 2024 23:38
@github-actions github-actions bot added the deploy-service Includes changes to deploy-service label May 1, 2024
@tylerwowen tylerwowen requested a review from yongwen May 2, 2024 17:39
@tylerwowen tylerwowen merged commit 3018b30 into master May 2, 2024
5 checks passed
@tylerwowen tylerwowen deleted the touyang/auth_flaw branch May 2, 2024 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-service Includes changes to deploy-service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants