train-k8s-container-mitre 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3fb5eed626b5b0237f0b191baf0a6d9044c41c768a1fcf144e28163bb53e489
4
- data.tar.gz: 33208b23e20238d127a60db0e7165a6a4aa405a31b59ed66a80472d467755647
3
+ metadata.gz: af608609f892f66f0f7210823ce896919a01be49eacf9181be6b5ec451ad6e7f
4
+ data.tar.gz: 81f951dba94aca48878c00208baaada55af3e2f4b7fc614d48f23c85dc47cd84
5
5
  SHA512:
6
- metadata.gz: b5bd3221b2ca510b600c75994a777fa37eccec5fc4b208f0f1f03bac2f6f849a3bfcef4bef4d4c5fdc9d8abc35927430772cea1b64f20d848fc81f90944251be
7
- data.tar.gz: 9b1c7f1b4b4f96f87ab6eeeaad58f5f22a70476c3c659b5dae02f4b6b6e210ed67cef01809674c91d4b76c8e81593b66bdd2cd6607eba5015aec8ae4645dcb57
6
+ metadata.gz: 85ca8fb769a50ea96f91276822e171cbfdf2b43cc7debcbf4c2a5699953a6ec024535b50c0d7a9cd94f8511dd167e8168f7262fb23fb3a2f6f4811abfff7b8e5
7
+ data.tar.gz: d71d192ea3808b3879d78b44a3e292c516d8e70298ce012c97567605d8e059dbfb64948ee17d1d05da7e30885ac5115ee6d88e8ebdd6b85bed83eef1b80ec976
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "2.0.1"
3
+ }
data/CHANGELOG.md CHANGED
@@ -5,154 +5,142 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [Unreleased]
8
+ ## [2.0.0] - 2025-12-05
9
9
 
10
10
  ### Added
11
11
 
12
- - **ci**: Real STIG profile execution (canonical-ubuntu-22.04-lts-stig-baseline)
13
- - **ci**: Same-pod container-to-container scanning test
14
- - **ci**: Pod-to-pod scanning with cinc-scanner Docker image
12
+ - Migrate to Train plugin v2 with multi-platform support and security improvements ([#1](https://github.com/mitre/train-k8s-container/issues/1))
13
+ - Migrate to Train plugin v2 with multi-platform support and security improvements
14
+ - Fix platform detection using Detect + Context pattern
15
+ - **ci**: Add real STIG profile and same-pod container-to-container tests
15
16
 
16
17
  ### Documentation
17
18
 
18
- - MITRE standards documentation (LICENSE.md, NOTICE.md, CODE_OF_CONDUCT.md)
19
- - CONTRIBUTING.md with development workflow
20
- - DEVELOPMENT.md with local testing guide (kind cluster setup)
21
- - README.md rewrite with MITRE branding and comprehensive usage docs
22
- - SECURITY.md with MITRE SAF contact info
19
+ - Add MITRE standards documentation and release workflow
20
+ - Update CHANGELOG.md with git-cliff format
21
+ - Rewrite CHANGELOG with accurate v2.0.0 content
23
22
 
24
23
  ### Fixed
25
24
 
26
- - **ci**: Use pre-built cinc-scanner:local image for same-pod testing
27
- - **platform**: Detect+Context pattern for accurate OS detection
25
+ - **ci**: Fix distroless test, Dockerfile, and shellcheck warnings
26
+ - **ci**: Fix kubectl cp glob pattern for same-pod test
27
+ - **ci**: Use pre-built cinc-scanner:local for same-pod testing
28
+ - Remove gemspec warnings for RubyGems publishing
28
29
 
29
30
  ### Miscellaneous Tasks
30
31
 
31
- - Switch from InSpec to Cinc Auditor (open source, license-free)
32
- - Add git-cliff configuration for automated changelog generation
33
- - Add release-tag.yml workflow for RubyGems publication
32
+ - Switch from InSpec to Cinc Auditor (license-free)
33
+ - Add git-cliff configuration for changelog generation
34
+ - Add git-cliff to release workflow for automated changelog
35
+ - Use official git-cliff-action for changelog generation
36
+ - Rename gem to train-k8s-container-mitre for RubyGems publishing
34
37
 
35
- ## [2.0.0] - 2025-10-04
38
+ ### Refactor
36
39
 
37
- ### Breaking Changes
40
+ - DRY improvements, CI enhancements, and distroless support
38
41
 
39
- - **BREAKING**: Namespace changed from `Train::K8s::Container` to `TrainPlugins::K8sContainer` (Train v2 standard)
40
- - **BREAKING**: File structure changed from `lib/train/k8s/container/*` to `lib/train-k8s-container/*`
41
- - Ruby requirement: >= 3.1
42
+ ### Testing
42
43
 
43
- ### Added
44
+ - **integration**: Update platform tests for Detect+Context pattern
44
45
 
45
- - **Platform Detection**: Detect+Context pattern using `Train::Platforms::Detect.scan(self)`
46
- - Returns actual OS (ubuntu, alpine, centos) so InSpec resources work correctly
47
- - Adds `kubernetes` and `container` families for transport awareness
48
- - Fallback platform for distroless/minimal containers
49
- - **Shell Detection**: Tiered detection with automatic fallback
50
- - Unix: bash → sh → ash → zsh
51
- - Windows: cmd.exe → powershell.exe → pwsh.exe (scaffolded, not tested)
52
- - Linux family detection from /etc/os-release
53
- - **Security Hardening**:
54
- - ANSI escape sequence sanitization (CVE-2021-25743 mitigation)
55
- - Command injection prevention with Shellwords.escape
56
- - RFC 1123 validation for pod/container names
57
- - **Error Handling**:
58
- - Custom error classes (ConnectionError, CommandError, ValidationError)
59
- - Retry logic with exponential backoff for transient failures
60
- - **CI/CD Pipeline**:
61
- - GitHub Actions with kind cluster integration tests
62
- - Multi-version Ruby (3.1, 3.2, 3.3) and Kubernetes (1.29, 1.30, 1.31) matrix
63
- - Security scanning (TruffleHog, bundler-audit, SBOM generation)
64
- - Pod-to-pod testing with InSpec running inside cluster
65
- - **Code Quality**:
66
- - Cookstyle linting (replaced deprecated chefstyle)
67
- - 95%+ test coverage with SimpleCov
68
- - Unit tests (mocked) and integration tests (real kubectl)
69
-
70
- ### Changed
71
-
72
- - Transport: Proper Train v2 plugin API implementation
73
- - Connection: Lazy initialization of kubectl client
74
- - Platform: Uses Train's built-in detection instead of force_platform!
46
+ ## [1.3.1] - 2024-03-05
75
47
 
76
48
  ### Fixed
77
49
 
78
- - Shell detection command escaping
79
- - Platform detection accuracy (returns real OS, not generic k8s-container)
80
- - Thread safety in session management
50
+ - Fix run command to be run with Bourne shell to execute commands
81
51
 
82
- ### Security
52
+ This is to make sure we are able to run all OS resource commands
83
53
 
84
- - ANSI injection prevention (sanitizes terminal escape sequences)
85
- - Command escaping with Shellwords
86
- - Input validation for Kubernetes resource names
54
+ Signed-off-by: Sathish Babu <sbabu@progress.com>
87
55
 
88
- ### Components
89
-
90
- | File | Purpose |
91
- |------|---------|
92
- | `transport.rb` | Train v2 plugin registration |
93
- | `connection.rb` | URI parsing, connection management |
94
- | `kubectl_exec_client.rb` | kubectl command execution |
95
- | `platform.rb` | Detect+Context platform detection |
96
- | `shell_detector.rb` | Shell availability detection |
97
- | `ansi_sanitizer.rb` | CVE-2021-25743 mitigation |
98
- | `kubernetes_name_validator.rb` | RFC 1123 validation |
99
- | `retry_handler.rb` | Exponential backoff retry logic |
100
-
101
- ## [1.3.1] - 2024-03-05
56
+ ## [1.3.0] - 2024-01-31
102
57
 
103
- ### Fixed
58
+ ### Testing
104
59
 
105
- - Fix run command to use Bourne shell for OS resource commands ([#21](https://github.com/inspec/train-k8s-container/pull/21))
60
+ - Test file connections
106
61
 
107
- ## [1.3.0] - 2024-01-31
62
+ Signed-off-by: Sathish Babu <sbabu@progress.com>
108
63
 
109
- ### Added
64
+ ## [1.2.1] - 2024-01-18
110
65
 
111
- - Add support for file connections ([#19](https://github.com/inspec/train-k8s-container/pull/19))
66
+ ## [1.2.0] - 2024-01-16
112
67
 
113
- ## [1.2.1] - 2024-01-18
68
+ ## [1.1.2] - 2024-01-16
114
69
 
115
70
  ### Fixed
116
71
 
117
- - Fix for undefined method presence ([#17](https://github.com/inspec/train-k8s-container/pull/17))
118
-
119
- ## [1.2.0] - 2024-01-16
72
+ - Fix connection spec
120
73
 
121
- ### Changed
74
+ Signed-off-by: Sathish Babu <sbabu@progress.com>
75
+ - Fix specs to use mocks over real connections
122
76
 
123
- - Update README and InSpec compatibility ([#15](https://github.com/inspec/train-k8s-container/pull/15))
77
+ Signed-off-by: Sathish Babu <sbabu@progress.com>
124
78
 
125
- ## [1.1.2] - 2024-01-16
79
+ ## [1.1.1] - 2024-01-15
126
80
 
127
81
  ### Fixed
128
82
 
129
- - Connection to container improvements ([#14](https://github.com/inspec/train-k8s-container/pull/14))
83
+ - Fix typo with spec
130
84
 
131
- ## [1.1.1] - 2024-01-15
85
+ Signed-off-by: Sathish Babu <sbabu@progress.com>
132
86
 
133
87
  ### Testing
134
88
 
135
- - Specs for transporter ([#13](https://github.com/inspec/train-k8s-container/pull/13))
89
+ - Test connection
90
+
91
+ Signed-off-by: Sathish Babu <sbabu@progress.com>
136
92
 
137
93
  ## [1.1.0] - 2024-01-11
138
94
 
139
- ### Added
95
+ ### Testing
96
+
97
+ - Test kubectl exec client
140
98
 
141
- - kubectl exec client implementation ([#10](https://github.com/inspec/train-k8s-container/pull/10))
99
+ Signed-off-by: Sathish Babu <sbabu@progress.com>
100
+ - Test connection and platform
101
+
102
+ Signed-off-by: Sathish Babu <sbabu@progress.com>
142
103
 
143
104
  ## [1.0.0] - 2024-01-11
144
105
 
145
- ### Added
106
+ ## [0.0.7] - 2024-01-11
107
+
108
+ ## [0.0.6] - 2024-01-09
109
+
110
+ ## [0.0.5] - 2024-01-02
111
+
112
+ ## [0.0.4] - 2023-11-20
113
+
114
+ ## [0.0.3] - 2023-11-15
115
+
116
+ ### DELETE
117
+
118
+ - Remove files not required for the library
119
+
120
+ ### ENHANCE
121
+
122
+ - Minor improvement with gemspec and rakefile
123
+
124
+ ### GEM
125
+
126
+ - Initialize repo with bundle gem train-k8s-container
127
+
128
+ ### Miscellaneous Tasks
129
+
130
+ - Add doc dir with a sample readme
131
+
132
+ ## [0.0.2] - 2023-11-15
133
+
134
+ ### CONFIG
146
135
 
147
- - Initial transporter for k8s container ([#9](https://github.com/inspec/train-k8s-container/pull/9))
136
+ - Add basic expeditor config
137
+ - Add basic verify pipeline
138
+ - Add subscriptions to expeditor config
139
+ - Add basic coverage pipeline template
140
+ - Add configurations for sonarscanner in verify and update coverage pipeline
148
141
 
149
- ## Pre-1.0 Releases
142
+ ### DOC
150
143
 
151
- - **0.0.7** - Pipeline updates
152
- - **0.0.6** - Version bumper
153
- - **0.0.5** - Apache v2.0 license
154
- - **0.0.4** - SonarQube integration
155
- - **0.0.3** - Initial repo setup
156
- - **0.0.2** - Expeditor configuration
144
+ - Add empty changelog required for expeditor
157
145
 
158
146
  <!-- generated by git-cliff -->
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.1
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Shim file for gem name compatibility
4
+ # The gem is named 'train-k8s-container-mitre' for RubyGems publishing,
5
+ # but the internal library structure uses 'train-k8s-container'.
6
+ # This allows `require 'train-k8s-container-mitre'` to work when
7
+ # InSpec/Cinc loads the plugin by gem name.
8
+
9
+ require_relative 'train-k8s-container'
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3
+ "release-type": "ruby",
4
+ "packages": {
5
+ ".": {
6
+ "package-name": "train-k8s-container-mitre",
7
+ "changelog-path": "CHANGELOG.md",
8
+ "bump-minor-pre-major": true,
9
+ "bump-patch-for-minor-pre-major": true,
10
+ "extra-files": [
11
+ "VERSION"
12
+ ],
13
+ "version-file": "lib/train-k8s-container/version.rb"
14
+ }
15
+ },
16
+ "changelog-sections": [
17
+ {"type": "feat", "section": "Features"},
18
+ {"type": "fix", "section": "Bug Fixes"},
19
+ {"type": "perf", "section": "Performance Improvements"},
20
+ {"type": "revert", "section": "Reverts"},
21
+ {"type": "docs", "section": "Documentation"},
22
+ {"type": "style", "section": "Styles"},
23
+ {"type": "chore", "section": "Miscellaneous Chores"},
24
+ {"type": "refactor", "section": "Code Refactoring"},
25
+ {"type": "test", "section": "Tests"},
26
+ {"type": "build", "section": "Build System"},
27
+ {"type": "ci", "section": "Continuous Integration"}
28
+ ]
29
+ }
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: train-k8s-container-mitre
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - MITRE SAF Team
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2025-12-05 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: base64
@@ -45,6 +46,7 @@ files:
45
46
  - ".expeditor/coverage.pipeline.yml"
46
47
  - ".expeditor/update_version.sh"
47
48
  - ".expeditor/verify.pipeline.yml"
49
+ - ".release-please-manifest.json"
48
50
  - ".rspec"
49
51
  - ".rubocop.yml"
50
52
  - CHANGELOG.md
@@ -58,8 +60,8 @@ files:
58
60
  - Rakefile
59
61
  - SECURITY.md
60
62
  - VERSION
61
- - cliff.toml
62
63
  - docs/README.md
64
+ - lib/train-k8s-container-mitre.rb
63
65
  - lib/train-k8s-container.rb
64
66
  - lib/train-k8s-container/ansi_sanitizer.rb
65
67
  - lib/train-k8s-container/connection.rb
@@ -75,6 +77,7 @@ files:
75
77
  - lib/train-k8s-container/shell_detector.rb
76
78
  - lib/train-k8s-container/transport.rb
77
79
  - lib/train-k8s-container/version.rb
80
+ - release-please-config.json
78
81
  - sonar-project.properties
79
82
  - train-k8s-container.gemspec
80
83
  homepage: https://github.com/mitre/train-k8s-container
@@ -86,6 +89,7 @@ metadata:
86
89
  changelog_uri: https://github.com/mitre/train-k8s-container/blob/main/CHANGELOG.md
87
90
  bug_tracker_uri: https://github.com/mitre/train-k8s-container/issues
88
91
  documentation_uri: https://github.com/mitre/train-k8s-container#readme
92
+ post_install_message:
89
93
  rdoc_options: []
90
94
  require_paths:
91
95
  - lib
@@ -100,7 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
104
  - !ruby/object:Gem::Version
101
105
  version: '0'
102
106
  requirements: []
103
- rubygems_version: 3.7.2
107
+ rubygems_version: 3.5.22
108
+ signing_key:
104
109
  specification_version: 4
105
110
  summary: Train transport plugin for scanning Kubernetes containers with InSpec/Cinc
106
111
  Auditor.
data/cliff.toml DELETED
@@ -1,80 +0,0 @@
1
- # git-cliff configuration for train-k8s-container
2
- # See: https://git-cliff.org/docs/configuration
3
-
4
- [changelog]
5
- # changelog header
6
- header = """
7
- # Changelog
8
-
9
- All notable changes to this project will be documented in this file.
10
-
11
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
12
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
13
-
14
- """
15
- # template for the changelog body
16
- body = """
17
- {% if version %}\
18
- ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
19
- {% else %}\
20
- ## [Unreleased]
21
- {% endif %}\
22
- {% for group, commits in commits | group_by(attribute="group") %}
23
- ### {{ group | striptags | trim | upper_first }}
24
- {% for commit in commits %}
25
- - {% if commit.scope %}**{{ commit.scope }}**: {% endif %}{{ commit.message | upper_first }}\
26
- {% endfor %}
27
- {% endfor %}\n
28
- """
29
- # remove the leading and trailing whitespace from the template
30
- trim = true
31
- # changelog footer
32
- footer = """
33
- <!-- generated by git-cliff -->
34
- """
35
-
36
- [git]
37
- # parse the commits based on https://www.conventionalcommits.org
38
- conventional_commits = true
39
- # filter out the commits that are not conventional
40
- filter_unconventional = false
41
- # process each line of a commit as an individual commit
42
- split_commits = false
43
- # regex for preprocessing the commit messages
44
- commit_preprocessors = [
45
- # Extract issue numbers from commit messages
46
- { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/mitre/train-k8s-container/issues/${2}))"},
47
- ]
48
- # regex for parsing and grouping commits
49
- commit_parsers = [
50
- { message = "^feat", group = "Added" },
51
- { message = "^fix", group = "Fixed" },
52
- { message = "^doc", group = "Documentation" },
53
- { message = "^perf", group = "Performance" },
54
- { message = "^refactor", group = "Refactor" },
55
- { message = "^style", group = "Styling" },
56
- { message = "^test", group = "Testing" },
57
- { message = "^chore\\(release\\): prepare for", skip = true },
58
- { message = "^chore\\(deps\\)", skip = true },
59
- { message = "^chore\\(pr\\)", skip = true },
60
- { message = "^chore\\(pull\\)", skip = true },
61
- { message = "^chore|^ci", group = "Miscellaneous Tasks" },
62
- { body = ".*security", group = "Security" },
63
- { message = "^revert", group = "Revert" },
64
- ]
65
- # protect breaking changes from being skipped due to matching a skipping commit_parser
66
- protect_breaking_commits = false
67
- # filter out the commits that are not matched by commit parsers
68
- filter_commits = false
69
- # glob pattern for matching git tags
70
- tag_pattern = "v[0-9]*"
71
- # regex for skipping tags
72
- skip_tags = ""
73
- # regex for ignoring tags
74
- ignore_tags = ""
75
- # sort the tags topologically
76
- topo_order = false
77
- # sort the commits inside sections by oldest/newest order
78
- sort_commits = "oldest"
79
- # limit the number of commits included in the changelog.
80
- # limit_commits = 42