Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support m4 quoted strings in interface call arguments #291

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

cgzones
Copy link
Contributor

@cgzones cgzones commented Aug 24, 2024

Required for escaped strings, that would otherwise be replaced by m4, e.g. "interface":

filetrans_pattern(foo_t, bar_run_t, baz_run_t, dir, ``"interface"'')

Replaces: #289

Note: in contrast to #289 here the syntax is

``"interface"''

instead of

"``interface''"

Required for escaped strings, that would otherwise be replaced by m4,
e.g. "interface":

    filetrans_pattern(foo_t, bar_run_t, baz_run_t, dir, ``"interface"'')

Replaces: SELinuxProject#289
@dburgener
Copy link
Member

Is there a reason we can't do both this and #289? My inclination is to say that SELinux doesn't want to force either syntax on users, so it would be nice to handle both nesting options with quotes. I haven't tried putting them together, but it looks like both PRs would be compatible with each other.

@bachradsusi
Copy link
Member

I like this approach. #289 was a low effort which would allow to parse "interface''" but it would parse also "interface" which is not correct. I've closed it.

I'm going to propose using ``"interface"'' in fedora-selinux/selinux-policy as suggested in this PR. It looks better for me.

I'm also working on sepolgen-ifgen patch which would be based on this idea - bachradsusi/SELinuxProject-selinux@22b908e

@dburgener
Copy link
Member

If the syntax here works for you, I think that's fine with me. I don't want selint to be overly particular on matters of parsing - but that applies to what policy is used in practice rather than in theory. This version is certainly nicer from an SELint perspective, and wrapping the m4 quotes outside seems to me to make more sense anyways.

I'll go ahead and merge this. If anyone ever decides they actually want the syntax from #289 in practice, I'm happy to revisit that. From an SELint parser perspective, it's nice to parse too much rather than too little, since parser errors are non-recoverable as SELint exists today.

@dburgener dburgener merged commit 1157cb9 into SELinuxProject:main Aug 28, 2024
3 checks passed
@cgzones cgzones deleted the m4_quotes branch August 31, 2024 11:15
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