@@ -328,6 +328,58 @@ def test_grammar10(self):
328328 results [0 ].message ,
329329 )
330330
331+ def test_grammar11 (self ):
332+ nasl_file = Path (__file__ ).parent / "test.nasl"
333+ content = (
334+ ' script_tag(name:"cvss_base", value:"4.0");\n '
335+ ' script_tag(name:"impact", value:"Inadequate checks in '
336+ "com_contact could allowed mail submission\n "
337+ ' script_tag(name:"solution_type", value:"VendorFix");\n '
338+ )
339+
340+ fake_context = self .create_file_plugin_context (
341+ nasl_file = nasl_file , file_content = content
342+ )
343+ plugin = CheckGrammar (fake_context )
344+
345+ results = list (plugin .run ())
346+
347+ self .assertEqual (len (results ), 1 )
348+ self .assertIsInstance (results [0 ], LinterError )
349+ self .assertEqual (
350+ "VT/Include has the following grammar problem:\n "
351+ "- Hit: could allowed\n "
352+ '- Full line: script_tag(name:"impact", value:"Inadequate checks '
353+ "in com_contact could allowed mail submission" ,
354+ results [0 ].message ,
355+ )
356+
357+ def test_grammar12 (self ):
358+ nasl_file = Path (__file__ ).parent / "test.nasl"
359+ content = (
360+ ' script_tag(name:"cvss_base", value:"4.0");\n '
361+ ' script_tag(name:"impact", value:"This allow an attacker to gain '
362+ "administrative access to the\n "
363+ ' script_tag(name:"solution_type", value:"VendorFix");\n '
364+ )
365+
366+ fake_context = self .create_file_plugin_context (
367+ nasl_file = nasl_file , file_content = content
368+ )
369+ plugin = CheckGrammar (fake_context )
370+
371+ results = list (plugin .run ())
372+
373+ self .assertEqual (len (results ), 1 )
374+ self .assertIsInstance (results [0 ], LinterError )
375+ self .assertEqual (
376+ "VT/Include has the following grammar problem:\n "
377+ "- Hit: This allow\n "
378+ '- Full line: script_tag(name:"impact", value:"This allow an '
379+ "attacker to gain administrative access to the" ,
380+ results [0 ].message ,
381+ )
382+
331383 def test_grammar_fp (self ):
332384 nasl_file = Path (__file__ ).parent / "test.nasl"
333385 content = (
@@ -383,3 +435,21 @@ def test_grammar_fp2(self):
383435 results = list (plugin .run ())
384436
385437 self .assertEqual (len (results ), 0 )
438+
439+ def test_grammar_fp3 (self ):
440+ nasl_file = Path (__file__ ).parent / "test.nasl"
441+ content = (
442+ ' script_tag(name:"cvss_base", value:"4.0");\n '
443+ ' script_tag(name:"insight", value:"*snip* connection string to '
444+ 'provide\n properties that are not on this allow list.");\n '
445+ ' script_tag(name:"solution_type", value:"VendorFix");\n '
446+ ' script_tag(name:"solution", value:"meh");\n '
447+ )
448+ fake_context = self .create_file_plugin_context (
449+ nasl_file = nasl_file , file_content = content
450+ )
451+ plugin = CheckGrammar (fake_context )
452+
453+ results = list (plugin .run ())
454+
455+ self .assertEqual (len (results ), 0 )
0 commit comments