Skip to content

fix(query): improve "last user is root" dockerfile query coverage - #8123

Merged
cx-artur-ribeiro merged 86 commits into
masterfrom
AST-179935-Improve-Last-User-is-root-coverage
Oct 1, 2026
Merged

cx-artur-ribeiro merged 86 commits into
masterfrom
AST-179935-Improve-Last-User-is-root-coverage

Conversation

@cx-andre-pereira

@cx-andre-pereira cx-andre-pereira commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Reason for Proposed Changes

Proposed Changes

  • The query now checks only the user part of USER and flags root or any all-zero UID, regardless of group. A non-root user in the root group (e.g. 1000:0) is still not flagged. Added positive and negative test samples for these cases.

I submit this contribution under the Apache-2.0 license.

…es and all files with prefix 'dockerfile.' as well as all files with the '.dockerfile' extension type in a case insensitive matter (improvement on first commit)
…sion, added support for all ubi8/debian files in case of valid dockerfile structure, added support for lower case dockerfile commands - most queries will have issues with this but relevant text files are properly detected as a 'dockerfile' as intended
…rors, fixed 'gitignore' files exclusion, docker parser will handle said case like before but with explicit 'gitignore' extension rather than 'possibleDockerfile' like before
…sion so that it 1- gets detected regardless of syntax inside 2- gets detected withouth checking syntax inside through the code optimizing detection speed for said files
…wice and minor simplificaton of query arguments
…test 105, improved uni tests to include new case insensitive samples
… unnecessary 'gitignore' case in analyzer's workers
…have to be explicitly set as unwanted to allign with '.gitignore' behaviour
@cx-artur-ribeiro cx-artur-ribeiro changed the title fix(query): mprove "last user is root" dockerfile query coverage fix(query): improve "last user is root" dockerfile query coverage Sep 16, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

✅ No secrets detected

TruffleHog found no secrets in the current commits of this PR.

@cx-andre-pereira cx-andre-pereira added dockerfile docker Docker query accuracy Query accuracy (FN and FP) labels Sep 30, 2026
@cx-artur-ribeiro
cx-artur-ribeiro marked this pull request as ready for review October 1, 2026 11:02
@cx-artur-ribeiro
cx-artur-ribeiro requested a review from a team October 1, 2026 11:02

@cx-rui-araujo cx-rui-araujo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cx-artur-ribeiro
cx-artur-ribeiro merged commit 8a0f0bb into master Oct 1, 2026
32 of 35 checks passed
@cx-artur-ribeiro
cx-artur-ribeiro deleted the AST-179935-Improve-Last-User-is-root-coverage branch October 1, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accuracy Query accuracy (FN and FP) docker Docker query dockerfile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants