How to check if a snap is installed in dangerous mode

Hi There,

I was wondering if there is way to check if a snap was installed with --dangerous flag, the sanp list command gives at-least a hint for devmode but not for dangerous . I even tried the snapd api /v2/snaps but the output also did not gave any info .

san

There’s two things indicating that a snap is “local”:

$ snap list
Name                 Version                  Rev   Developer       Notes
spread               2017.09.21               x1                    -

$ snap info spread
[...]
publisher: 

The revision number is prefixed with “x” and there is no publisher. I think the revision number could be like that if the store you got the snap from used such revision numbers, but the lack of publisher should be clear indication the snap was installed with the --dangerous option.

I think it should be possible to add a little info that the snap is local in the notes (rightmost column).

1 Like

How about this? (using spread snap as an example):

$ ./test-snap list                                              
Name         Version     Rev   Developer     Notes
core         16-2.30     3887  canonical     core
hello-world  6.3         27    canonical     -
ohmygiraffe  1.1.0a      3     popey         -
spread       2018.01.23  x1                  dangerous
wormhole     0.10.3      23    snapcrafters  -

And snap info:

$ ./test-snap info --verbose spread 
name:      spread
summary:   Convenient full-system test (task) distribution
publisher: 
license:   unknown
description: |
  Spread is a plesant way distribute full-system integration tests and
  similar tasks. A few simple and concrete concepts that are fun to play
  with and fix the exact piece missing in the puzzle. It's not Jenkins,
  it's not Travis, it's not a library, not a language, and it's not even
  specific to testing. It's a simple way to express what to run and
  where, what to do before and after it runs, and how to duplicate jobs
  with minor variations without copy & paste.
commands:
  - spread
notes:               
  private:           false
  confinement:       strict
  devmode:           false
  jailmode:          false
  trymode:           false
  enabled:           true
  broken:            false
  dangerous:         true
  ignore-validation: false
tracking:            
installed:           2018.01.23 (x1) 2MB 
refreshed:           2018-01-24 03:13:24 +0100 CET
channels:                            
  stable:            2018.01.23 (34) 2MB -
  candidate:         2018.01.23 (34) 2MB -
  beta:              2018.01.23 (34) 2MB -
  edge:              2018.01.23 (34) 2MB -

Thanks guys. That would be great if snap list or snap info can provide
that info explicitly.

ಅವರು ಬರೆದಿದ್ದಾರೆ:

A quick PR with the change:
https://github.com/snapcore/snapd/pull/4649