Skip to content

[CWS] Add declared hardening infos - #519

Open
mftoure wants to merge 9 commits into
masterfrom
momar/hardening-declared
Open

mftoure wants to merge 9 commits into
masterfrom
momar/hardening-declared

Conversation

@mftoure

@mftoure mftoure commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Add declared Kubernetes security context to CWS activity dumps and security profiles

Motivation

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

Reviewer's Checklist

Reviewers: please see the review guidelines.

@mftoure mftoure changed the title Momar/hardening declared [CWS] Add declared hardening infos Sep 10, 2026
@mftoure
mftoure marked this pull request as ready for review September 10, 2026 11:55
@mftoure
mftoure requested a review from a team as a code owner September 10, 2026 11:55
Comment thread proto/cws/dumpsv1/activity_dump.proto Outdated
optional string localhost_profile = 2;
}

message HardeningDeclared {

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.

Sorry for the bikeshedding but should this be something like SecurityContext ?

Comment thread proto/cws/dumpsv1/activity_dump.proto Outdated
@mftoure
mftoure force-pushed the momar/hardening-declared branch from 12158e2 to 44bb6d8 Compare September 10, 2026 15:23
Comment thread proto/cws/dumpsv1/activity_dump.proto Outdated
}

Type type = 1;
// Set iff type == TYPE_LOCALHOST.

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.

nit: s/iff/if/

Comment on lines +64 to +66
optional bool run_as_non_root = 5;
optional bool allow_privilege_escalation = 6;
optional bool read_only_root_filesystem = 7;

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.

I don't think we should add those, as the raw information is already present on the profile itself, and we kind of agree with the backend to only share raw data

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.

ok I wasn't aware we could directly got those intel from workload meta, and I don't have a strong opinion about adding them or not 🤔

Add a new SeccompFilter proto message carrying the effective seccomp
filter extracted at runtime via ptrace:
- default_action: the fallback action for unmatched syscalls
- syscalls: map of syscall name to its action (ALLOW, ERRNO, etc.)

The filter is an optional field on SeccompProfile (field 3).

Co-authored-by: Cursor <cursoragent@cursor.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 949802a991

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// Set if type == TYPE_LOCALHOST.
optional string localhost_profile = 2;
// Effective filter extracted at runtime via ptrace.
optional SeccompFilter filter = 3;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Regenerate the Java bindings for the filter field

The checked-in SecDumpProto.java was generated before this field and message were added: it contains neither SeccompFilter nor SeccompProfile.hasFilter()/getFilter(), and its embedded descriptor still defines SeccompProfile with only fields 1 and 2. Consequently Java consumers treat field 3 as unknown and cannot inspect it, while Java producers cannot populate the new effective filter; regenerate the Java output from the final proto.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ca032512da

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread proto/cws/dumpsv1/activity_dump.proto Outdated
// Comparison operator: "==", "!=", "&", ">", ">=", "<", "<=".
string op = 2;
// Constant value compared against.
uint32 value = 3;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use a 64-bit value for seccomp argument conditions

For filters comparing an argument with a constant above 0xffffffff, such as a 64-bit mask or pointer-valued argument, this field cannot encode the effective condition. Linux exposes every seccomp syscall argument as a 64-bit value, and this model has no separate high-word marker, so a producer must truncate or reject such a comparison and the receiver reconstructs a different filter. Use uint64 for the comparison value.

Useful? React with 👍 / 👎.

}

message SecurityContext {
bool privileged = 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve presence of the privileged declaration

When a workload omits securityContext.privileged, this proto3 scalar decodes identically to an explicit privileged: false. Because these entries describe declared security settings, consumers cannot tell whether the workload explicitly disabled privileged mode or merely inherited the Kubernetes default; the neighboring nullable Kubernetes booleans preserve that distinction with optional. Make this field optional as well.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c4f68376c5

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// Base action (evaluated with args=0).
string action = 1;
// Argument-level conditions extracted from the BPF filter.
repeated ArgCondition conditions = 2;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve compound seccomp predicates

When an effective BPF rule reaches an action only after multiple argument checks (for example, arg0 == x && arg1 == y), this flat condition list cannot record the conjunction or decision-tree edges: every ArgCondition contains only one comparison and its terminal action. A consumer therefore cannot distinguish the compound rule from independent branches and may reconstruct a filter that allows the syscall too broadly; represent condition grouping or the BPF decision structure explicitly.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants