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

Release 07/05/2023 #942

Merged
merged 33 commits into from
Jul 7, 2023
Merged

Release 07/05/2023 #942

merged 33 commits into from
Jul 7, 2023

Conversation

russtuck
Copy link
Member

@russtuck russtuck commented Jul 5, 2023

@russtuck russtuck requested a review from EjPlatzer July 5, 2023 13:04
Comment on lines 86 to 100
/// <summary>
/// Gets the memberships of the given user
/// </summary>
/// <param name="username"> username filter </param>
/// <returns>The number of followers of the activity</returns>
[HttpGet]
[Route("student/{username}")]
[StateYourBusiness(operation = Operation.READ_ONE, resource = Resource.MEMBERSHIP)] // not sure why
public ActionResult<int> GetMembershipsOfUser(string username)
{
var result = _membershipService.GetMemberships(username: username, sessionCode: "*");

return Ok(result);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why this route was added. All it does is implement d subset of the base /memberships route, in basically the same way as the /profiles/{username}/memberships route. The latter is better in terms of REST API design, but it was marked obsolete because the base /memberships route already covers all it's possible use cases with optional query params.

It looks like this was added for gordon-cs/gordon-360-ui#1083, but the better route to use for that should be /profiles/{username}/memberships-history, the same way it's currently used for the Experience Transcript.

Copy link
Member Author

Choose a reason for hiding this comment

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

Antonia and Amos confirmed that the new endpoint is not needed, and in the process found an apparent security flaw in the recommended endpoint: if given no username, it returns all involvements for all users, without filtering to only public involvements. Antonia is working on a fix for both issues.

Copy link
Contributor

Choose a reason for hiding this comment

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

Antonia and Amos confirmed that the new endpoint is not needed, and in the process found an apparent security flaw in the recommended endpoint: if given no username, it returns all involvements for all users, without filtering to only public involvements. Antonia is working on a fix for both issues.

If you're talking about the GetMembershipHistory method that I recommended (route /profiles/{username}/memberships-history), I'm fairly certain it can't be called without the username param. If you try, the API sends back this error:

{
  "errors": {
    "username": [
      "The username field is required."
    ]
  },
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "traceId": "00-b582e79374a558d2ff3c822dc9ba1d2a-ddb6eacb502fbb4c-00"
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, it's the base /memberships route which appears to have a security flaw.

Gordon360/Controllers/MembershipsController.cs Outdated Show resolved Hide resolved
/// Gets the memberships of the given user
/// </summary>
/// <param name="username"> username filter </param>
/// <returns>The number of followers of the activity</returns>
Copy link
Member Author

Choose a reason for hiding this comment

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

If we don't delete this endpoint, then the comment will need improving. The returns explanation looks wrong, and the summary should be more explicit about what's included: all memberships over all terms? just public? just those visible to the current user (so different for own profile than public profiles)?

@russtuck
Copy link
Member Author

russtuck commented Jul 5, 2023

We won't push this. If the fixes can be done today, we'll test them for a day on train and consider pushing tomorrow.

@russtuck russtuck marked this pull request as draft July 5, 2023 20:19
@russtuck russtuck marked this pull request as ready for review July 6, 2023 14:28
@russtuck
Copy link
Member Author

russtuck commented Jul 6, 2023

Late removal of unused endpoint (never used in prod, and only briefly in train).

antoniavonto and others added 3 commits July 6, 2023 17:29
…-info

changed patch to put in both routes
Change 2 new endpoints to put, which is more accurate than patch.
@russtuck
Copy link
Member Author

russtuck commented Jul 6, 2023

I think we've addressed all the issues. But we don't want to merge until tomorrow morning, during working hours, to be sure it doesn't cause problems.

@russtuck russtuck merged commit cb305cb into master Jul 7, 2023
3 checks passed
@russtuck russtuck deleted the release_07052023 branch July 7, 2023 13:38
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.

6 participants