Skip to content

Commit d144d55

Browse files
feat: enhance version matching to skip Docker image tags with extended build identifiers
1 parent 236f51c commit d144d55

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ The project follows [Semantic Versioning](https://semver.org/) and adheres to th
88

99
- Nothing yet.
1010

11+
## [1.6.1] - 2025-10-14
12+
13+
### Fixed
14+
15+
- Stop treating Docker image tags with additional dotted build metadata (such as AWS Lambda runtimes) as CPython patch pins, preventing invalid tag rewrites (#8).
16+
1117
## [1.6.0] - 2025-10-10
1218

1319
### Added

src/scanning/patterns/python-version.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ export function findPythonVersionMatches(filePath: string, content: string): Ver
183183

184184
const relativeIndex = match[0].indexOf(version);
185185
const versionIndex = match.index + (relativeIndex >= 0 ? relativeIndex : 0);
186+
const patchContinuationIndex = versionIndex + version.length;
187+
const nextChar = content[patchContinuationIndex];
188+
const nextNextChar = content[patchContinuationIndex + 1];
189+
190+
if (nextChar === '.' && nextNextChar && /\d/.test(nextNextChar)) {
191+
continue;
192+
}
193+
186194
const position = indexToPosition(content, versionIndex);
187195

188196
results.push({

tests/python-version-patterns.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ describe('findPythonVersionMatches', () => {
2929
expect(matches.map((match) => match.matched)).toEqual(['3.13.2', '3.12.8', '3.12.8']);
3030
});
3131

32+
it('skips Docker image tags with extended build identifiers', () => {
33+
const content = `FROM public.ecr.aws/lambda/python:3.13.2025.08.15.14\n`;
34+
35+
const matches = findPythonVersionMatches('Dockerfile', content);
36+
37+
expect(matches).toHaveLength(0);
38+
});
39+
3240
it('reads the version from .python-version files', () => {
3341
const matches = findPythonVersionMatches('.python-version', '3.10.14\n');
3442

0 commit comments

Comments
 (0)