api-preview-docs icon indicating copy to clipboard operation
api-preview-docs copied to clipboard

List projects API (v2) is missing

Open vinitshahdeo opened this issue 3 years ago • 7 comments

Hello 👋

I am looking for an endpoint which can help us list all the projects within an organization (or the projects the user has access to). However we have an endpoint(v1/projects) in CircleCI API (v1) which returns the projects followed by the user.

A route like GET /v2/projects should list all the projects the user has access to.

vinitshahdeo avatar Apr 13 '21 05:04 vinitshahdeo

if it helps

$ curl --location --request GET 'https://circleci.com/api/v2/insights/gh/$ORG_SLUG/summary' --header 'Circle-Token: $CIRCLE_TOKEN'

it has a key in response all_projects with list of project slugs

stiyyagura0901 avatar Feb 24 '22 03:02 stiyyagura0901

This endpoint seems to be limited in the amount of projects it returns

NicolaiLolansen avatar Jan 05 '23 10:01 NicolaiLolansen

Yes, doesn't list all my projects. :(

alrodgers avatar Jan 06 '23 15:01 alrodgers

We're trying to rotate all our secrets per the recent security incident, and lacking this capability is bringing us down a lot.

pinko-fowle avatar Jan 06 '23 19:01 pinko-fowle

We're trying to rotate all our secrets per the recent security incident, and lacking this capability is bringing us down a lot.

I was looking for this functionality as well and not having it is definitely slowing us down. While there is a tool that was posted to track down secrets it does not provide the ability to list all projects with SSH keys.

nslusher-sf avatar Jan 09 '23 02:01 nslusher-sf

We ended up going the other way, using the Github API to list all projects with a token called "CircleCi", then used those slugs to first delete, then add them again with the CircleCI API. Also deleting the deploy key on circleCI does not propagate and delete it on Github, you have to also take care of that. It does however require a personal-token that has access to all those organizations.

You can use the same "trick" to pull env-variables as you now have the project slugs needed to look them up one by one.

NicolaiLolansen avatar Jan 09 '23 06:01 NicolaiLolansen

Update: our SecOps team were able to obtain a list of all our configured projects by contacting CircleCI directly.

Nicolai's approach wouldn't have worked well for us, as we also had some obsolete projects that had secrets configured as env vars but didn't have tokens configured in GitHub any more.

alrodgers avatar Jan 09 '23 15:01 alrodgers