diff mbox

[Branch,~linaro-image-tools/linaro-image-tools/trunk] Rev 510: Prevent repository private key from entering logs

Message ID 20120420094516.10548.37216.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

James Tunnicliffe April 20, 2012, 9:45 a.m. UTC
Merge authors:
  Ricardo Salveti (rsalveti)
Related merge proposals:
  https://code.launchpad.net/~rsalveti/linaro-image-tools/remove-pkey-log/+merge/102783
  proposed by: Ricardo Salveti (rsalveti)
  review: Approve - James Tunnicliffe (dooferlad)
------------------------------------------------------------
revno: 510 [merge]
committer: James Tunnicliffe <james.tunnicliffe@linaro.org>
branch nick: trunk
timestamp: Fri 2012-04-20 10:41:35 +0100
message:
  Prevent repository private key from entering logs
modified:
  linaro_image_tools/hwpack/packages.py


--
lp:linaro-image-tools
https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk

You are subscribed to branch lp:linaro-image-tools.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'linaro_image_tools/hwpack/packages.py'
--- linaro_image_tools/hwpack/packages.py	2011-11-14 13:32:51 +0000
+++ linaro_image_tools/hwpack/packages.py	2012-04-20 00:27:08 +0000
@@ -702,6 +702,9 @@ 
             return fetched.values()
         acq = apt_pkg.Acquire(DummyProgress())
         acqfiles = []
+        # re to remove the repo private key
+        deb_url_auth_re = re.compile(
+                    r"(?P<transport>.*://)(?P<user>.*):.*@(?P<path>.*$)")
         for package in self.cache.cache.get_changes():
             if (package.marked_delete or package.marked_keep):
                 continue
@@ -717,7 +720,12 @@ 
                 acq, candidate.uri, candidate.md5, candidate.size,
                 base, destfile=destfile)
             acqfiles.append((acqfile, result_package, destfile))
-            logger.debug(" ... from %s" % acqfile.desc_uri)
+            # check if we have a private key in the pkg url
+            deb_url_auth = deb_url_auth_re.match(acqfile.desc_uri)
+            if deb_url_auth:
+                logger.debug(" ... from %s%s:***@%s" % deb_url_auth.groups())
+            else:
+                logger.debug(" ... from %s" % acqfile.desc_uri)
         self.cache.cache.clear()
         acq.run()
         for acqfile, result_package, destfile in acqfiles: