mainAutoconf - Support: sr #111048, Add a syntax check to code snippets

 
 

sr #111048: Add a syntax check to code snippets

Submitter:  None
Submitted:  Fri 05 Apr 2024 07:44:13 AM UTC
Votes: 1
 
Priority:  * 5 - Unprioritized Severity:  3 - Normal
Status:  None Privacy:  Public
Assigned to:  None Originator Email:  -email is unavailable-
Open/Closed:  Open Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 09 Apr 2024 11:44:46 PM UTC, comment #5: 

comment #4:

> Note that adding a syntax check before each check will certainly make "configure" somewhat slower.  Should we prefer increasing security at the cost of something slower?


You only need to run the syntax checker if the test fails to compile.

Martin Nilsson <nilsson>
Fri 05 Apr 2024 08:19:58 AM UTC, comment #4: 

Note that adding a syntax check before each check will certainly make "configure" somewhat slower.  Should we prefer increasing security at the cost of something slower?

Fabrice BAUZAC-STEHLY <libnoon>
Fri 05 Apr 2024 08:17:32 AM UTC, comment #3: 

I agree, it's not so easy.

On CMake side, I think they are considering adding an "escape hatch" that would not go unnoticed either.

For Autoconf, maybe we could add a separate macro (with a very explicit name) for syntax checks like "case 0 ... 5".  A malicious contributor would have a harder time explaining why they would create a syntax check for checking the availability of a system feature like landlock, as was the case with XZ Utils.
https://www.man7.org/linux/man-pages/man7/landlock.7.html

My 2 cents...

Fabrice BAUZAC-STEHLY <libnoon>
Fri 05 Apr 2024 08:10:26 AM UTC, comment #2: 

original submission:

> So the CMake project is considering adding a preliminary syntax check
> (with a verbose error message) in addition to the full check (which
> fails rather silently), so that such disabling does not go unnoticed:


Feel free to correct me if I am missing something, but I don't see how that is possible.

How would you check for certain compiler extensions which may cause syntax errors if unsupported?

Something like GCC case ranges:


int
main (void)
{
  switch (2)
    {
    case 0 ... 5:
      return 0;
    default:
      return 1;
    }
}


Would cause a syntax error on other compilers. I don't see a way of differentiating that from a case like that CMake script.

Collin Funk <collinfunk>
Fri 05 Apr 2024 08:03:15 AM UTC, comment #1: 

Sorry, this SR was from me.

Fabrice BAUZAC-STEHLY <libnoon>
Fri 05 Apr 2024 07:44:13 AM UTC, original submission:  

Hello,

As you may know, an attack related to XZ Utils (lzma) has been
discovered:

https://gist.github.com/thesamesam/223949d5a074ebc3dce9ee78baad9e27

The malicious account has disabled a feature by sneakily forging an
always-failing code.  This has been done by introducing a syntax error
in a CMake file (a dot at the beginning of a line):

https://git.tukaani.org/?p=xz.git;a=commitdiff;h=328c52da8a2bbb81307644efdb58db2c422d9ba7

So the CMake project is considering adding a preliminary syntax check
(with a verbose error message) in addition to the full check (which
fails rather silently), so that such disabling does not go unnoticed:

https://gitlab.kitware.com/cmake/cmake/-/issues/25846

This makes me think that Autoconf does compilation checks similar to
that of CMake, and therefore an attacker could similarly, sneakily
disable a feature.

Should Autoconf similarly add a syntax check?  I'm leaving this open
question to the community.

Thanks!

Best regards
Fabrice

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nilsson (Posted a comment)
  • -email is unavailable- added by collinfunk (Posted a comment)
  • -email is unavailable- added by libnoon (Posted a comment)
  • -email is unavailable- added by libnoon (Voted in favor of this item)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There is 1 vote so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-04-05 libnoon Carbon-Copy- Added libnoon

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code