chiark / gitweb /
lint: ban all dangerous HTML tags
[fdroidserver.git] / fdroidserver / lint.py
index 18bd3d47ea0145c78104a43ac23d1737ce50a723..b0a5cad76f93f52fb33752519bd98602e5605cf9 100644 (file)
@@ -135,6 +135,8 @@ regex_checks = {
     'Donate': http_checks + [
         (re.compile(r'.*flattr\.com'),
          _("Flattr donation methods belong in the FlattrID flag")),
+        (re.compile(r'.*liberapay\.com'),
+         _("Liberapay donation methods belong in the LiberapayID flag")),
     ],
     'Changelog': http_checks,
     'Author Name': [
@@ -162,6 +164,10 @@ regex_checks = {
          _("Unnecessary leading space")),
         (re.compile(r'.*\s$'),
          _("Unnecessary trailing space")),
+        (re.compile(r'.*<(applet|base|body|button|embed|form|head|html|iframe|img|input|link|object|picture|script|source|style|svg|video).*', re.IGNORECASE),
+         _("Forbidden HTML tags")),
+        (re.compile(r'''.*\s+src=["']javascript:.*'''),
+         _("Javascript in HTML src attributes")),
     ],
 }
 
@@ -363,10 +369,13 @@ def check_builds(app):
                 yield _("Branch '{branch}' used as commit in build '{versionName}'")\
                     .format(branch=s, versionName=build.versionName)
             for srclib in build.srclibs:
-                ref = srclib.split('@')[1].split('/')[0]
-                if ref.startswith(s):
-                    yield _("Branch '{branch}' used as commit in srclib '{srclib}'")\
-                        .format(branch=s, srclib=srclib)
+                if '@' in srclib:
+                    ref = srclib.split('@')[1].split('/')[0]
+                    if ref.startswith(s):
+                        yield _("Branch '{branch}' used as commit in srclib '{srclib}'")\
+                            .format(branch=s, srclib=srclib)
+                else:
+                    yield _('srclibs missing name and/or @') + ' (srclibs: ' + srclib + ')'
         for key in build.keys():
             if key not in supported_flags:
                 yield _('%s is not an accepted build field') % key