Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
lutece
lutece-build-plugin-releaser
Commits
0bf8b3bb
Commit
0bf8b3bb
authored
Jan 11, 2021
by
Francois Merlin
Browse files
RELEASER-10 :-anonymise scm password in release log
parent
e89c2459
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/java/fr/paris/lutece/plugins/releaser/service/WorkflowReleaseContextService.java
View file @
0bf8b3bb
...
...
@@ -9,6 +9,8 @@ import java.util.List;
import
java.util.Locale
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.xml.bind.JAXBException
;
...
...
@@ -34,6 +36,7 @@ import fr.paris.lutece.plugins.releaser.util.MapperJsonUtil;
import
fr.paris.lutece.plugins.releaser.util.PluginUtils
;
import
fr.paris.lutece.plugins.releaser.util.ReleaserUtils
;
import
fr.paris.lutece.plugins.releaser.util.github.GitUtils
;
import
fr.paris.lutece.plugins.releaser.util.maven.MavenUtils
;
import
fr.paris.lutece.plugins.releaser.util.pom.PomUpdater
;
import
fr.paris.lutece.portal.business.user.AdminUser
;
import
fr.paris.lutece.portal.service.datastore.DatastoreService
;
...
...
@@ -114,9 +117,11 @@ public class WorkflowReleaseContextService implements IWorkflowReleaseContextSer
try
{
String
strJsonContext
=
MapperJsonUtil
.
getJson
(
context
);
//clean PWD in log before save in history
String
strJsonContextClean
=
ReleaserUtils
.
cleanPWDInLog
(
strJsonContext
);
DatastoreService
.
setDataValue
(
ReleaserUtils
.
getWorklowContextDataKey
(
context
.
getComponent
(
)
!=
null
?
context
.
getComponent
(
).
getArtifactId
(
)
:
context
.
getSite
(
).
getArtifactId
(
),
context
.
getId
(
)
),
strJsonContext
);
strJsonContext
Clean
);
}
catch
(
IOException
e
)
...
...
src/java/fr/paris/lutece/plugins/releaser/util/ReleaserUtils.java
View file @
0bf8b3bb
...
...
@@ -3,6 +3,8 @@ package fr.paris.lutece.plugins.releaser.util;
import
java.io.File
;
import
java.util.Date
;
import
java.util.Locale
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
...
...
@@ -451,5 +453,19 @@ public class ReleaserUtils
return
cVersion1
.
compareTo
(
cVersion2
);
}
public
static
String
cleanPWDInLog
(
String
strLog
)
{
Pattern
pattern2
=
Pattern
.
compile
(
"(?<prot>https|http):\\/\\/(?<user>\\S+):(?<pwd>\\S+)@"
);
Matcher
matcher2
=
pattern2
.
matcher
(
strLog
);
return
matcher2
.
replaceAll
(
"${prot}${user}:cleanpwd@"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment