github.com/google/osv-scalibr@v0.4.1/extractor/filesystem/containers/podman/podman.go (about) 1 // Copyright 2025 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Package podman extracts container inventory from podman database. 16 package podman 17 18 import ( 19 "github.com/google/osv-scalibr/extractor/filesystem" 20 "github.com/google/osv-scalibr/plugin" 21 ) 22 23 const ( 24 // Name is the unique name of this extractor. 25 Name = "containers/podman" 26 ) 27 28 // Config defines the configuration options for the Extractor. 29 type Config struct { 30 // IncludeStopped specifies whether to list all containers, including those that are not currently running. 31 IncludeStopped bool 32 } 33 34 // DefaultConfig returns the default configuration for the podman extractor. 35 func DefaultConfig() Config { 36 return Config{} 37 } 38 39 // Extractor extracts containers from the podman db file. 40 type Extractor struct { 41 cfg Config 42 } 43 44 // New returns a podman container inventory extractor. 45 func New(cfg Config) *Extractor { 46 return &Extractor{cfg: cfg} 47 } 48 49 // NewDefault returns an extractor with the default config settings. 50 func NewDefault() filesystem.Extractor { return New(DefaultConfig()) } 51 52 // Config returns the configuration of the extractor. 53 func (e Extractor) Config() Config { 54 return Config{} 55 } 56 57 // Name of the extractor. 58 func (e Extractor) Name() string { return Name } 59 60 // Version of the extractor. 61 func (e Extractor) Version() int { return 0 } 62 63 // Requirements of the extractor. 64 func (e Extractor) Requirements() *plugin.Capabilities { 65 return &plugin.Capabilities{ 66 OS: plugin.OSLinux, 67 DirectFS: true, 68 RunningSystem: true, 69 } 70 }