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

could not sync assets for container image #1952

Closed
czunker opened this issue Sep 27, 2023 · 2 comments
Closed

could not sync assets for container image #1952

czunker opened this issue Sep 27, 2023 · 2 comments
Assignees
Labels
bug Something isn't working v9
Milestone

Comments

@czunker
Copy link
Contributor

czunker commented Sep 27, 2023

Describe the bug

cnspec scan container image alpine:3.8.4 --config ~/demo.agent.credentials.json 
! CLI pre-processing encountered an issue error="unknown flag: --config"
→ loaded configuration from /home/christian/demo.agent.credentials.json using source --config
→ using service account credentials
→ discover related assets for 1 asset(s)
→ synchronize assets
FTL failed to run scan error="rpc error: code = Internal desc = could not sync assets"

Works with v8 cnspec, so credentials seem fine.

I also tried it with edge. Same result.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Select '....'
  3. Scroll down to '....'
  4. Note the error

Expected behavior
cnspec should sync the scanned assets.

Aditional context
For a vagrant scan it looks good:

→ synchronize assets
DBG initialize client authentication issuer=mondoo/ams kid=//agents.api.mondoo.app/spaces/dazzling-golick-767384/serviceaccounts/2AyMRoi8pfJa6gOqq16QWstmKPK
DBG got assets details assets=2
DBG asset mapping asset=//assets.api.mondoo.app/spaces/dazzling-golick-767384/assets/2VyU5e8hHEY6zi9ETy00UtvNmiW platform-mrn=de7443b8b43d48c3b1fe5bb543137fba
DBG asset mapping asset=//assets.api.mondoo.app/spaces/dazzling-golick-767384/assets/2VyU5e8hHEY6zi9ETy00UtvNmiW platform-mrn=localhost.localdomain
DBG update asset asset=default platform-ids=["localhost.localdomain","de7443b8b43d48c3b1fe5bb543137fba"]
DBG connecting to asset default (Rocky Linux 8.8 (Green Obsidian))
@czunker czunker added bug Something isn't working v9 labels Sep 27, 2023
@czunker czunker changed the title could not sync assets could not sync assets for container image Sep 27, 2023
@czunker czunker added this to the v9 milestone Sep 27, 2023
@czunker czunker transferred this issue from mondoohq/cnspec Sep 27, 2023
czunker added a commit that referenced this issue Sep 27, 2023
When scanning a single image which isn't present in the local docker daemon, the platformID was missing.

Fixes #1952

Signed-off-by: Christian Zunker <[email protected]>
@czunker czunker self-assigned this Sep 27, 2023
@preslavgerchev
Copy link
Contributor

preslavgerchev commented Sep 27, 2023

I just tried v8 versus v9,
v9:

TRC curl -X 'POST' -d '{"space_mrn":"//captain.api.mondoo.app/spaces/peaceful-lewin-815181","list":[{"platform":{"name":"alpine","arch":"amd64","title":"Alpine Linux v3.8","family":["linux","unix","os"],"version":"3.8.4","kind":"container-image","runtime":"docker-image"},"connections":[{"backend":"tar","host":"alpine:3.8.4","id":1,"type":"docker-image","discover":{"targets":["auto"]},"capabilities":["file"]}],"id_detector":["hostname"]}]}' -H 'Accept: application/json' -H 'Content-Length: 419' -H 'Content-Type: application/json' 'https://api.edge.mondoo.com/QueryConductor/SynchronizeAssets'

v8:

TRC curl -X 'POST' -d '{"space_mrn":"//captain.api.mondoo.app/spaces/peaceful-lewin-815181","list":[{"name":"index.docker.io/library/alpine@04696b491e0c","platform_ids":["//platformid.api.mondoo.app/runtime/docker/images/04696b491e0cc3c58a75bace8941c14c924b9f313b03ce5029ebbc040ed9dcd9"],"state":9,"platform":{"name":"alpine","arch":"amd64","title":"Alpine Linux v3.8","family":["linux","unix","os"],"version":"3.8.4","kind":2,"runtime":"docker-image"},"connections":[{"backend":6,"host":"index.docker.io/library/alpine@sha256:04696b491e0cc3c58a75bace8941c14c924b9f313b03ce5029ebbc040ed9dcd9","options":{"platform-override":""},"kind":2,"runtime":"docker-registry","platform_id":"//platformid.api.mondoo.app/runtime/docker/images/04696b491e0cc3c58a75bace8941c14c924b9f313b03ce5029ebbc040ed9dcd9"}],"labels":{"docker.io/digest":"sha256:04696b491e0cc3c58a75bace8941c14c924b9f313b03ce5029ebbc040ed9dcd9","docker.io/tags":"3.8.4"}}]}' -H 'Accept: application/json' -H 'Content-Length: 906' -H 'Content-Type: application/json' 'https://api.edge.mondoo.com/PolicyResolver/SynchronizeAssets'

One's hitting the query conductor and the other one is hitting the policy resolver, this might be the issue

@vjeffrey
Copy link
Contributor

most likely now fixed, needs to be retested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v9
Projects
None yet
Development

No branches or pull requests

3 participants