首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用exec-maven-plugin从azure管道运行具有安全令牌的外部程序。

使用exec-maven-plugin从azure管道运行具有安全令牌的外部程序。
EN

Stack Overflow用户
提问于 2022-01-14 14:00:29
回答 1查看 126关注 0票数 0

这里有许多关于exec-maven-plugin的问题,但这是不同的。我试图在maven中使用带有exec目标的exec-maven-plugin运行一个外部程序。要传递的参数之一是在azure管道上定义的安全令牌。

问题是,如果我硬编码令牌,即不保护令牌的实际令牌值,并且运行mvn :exec命令,它就能工作。但是,当我从azure管道传递安全令牌时,它无法与外部程序通信。

在将此安全令牌作为参数传递到exec-maven-plugin中之前,是否有方法对其进行解密,或者是否有其他方法使其工作?

pom的相关部分是:

代码语言:javascript
运行
复制
<groupId>org.codehaus.mojo</groupId>
              <artifactId>exec-maven-plugin</artifactId>
              <version>3.0.0</version>
              <executions>
                  <execution>
                      <phase>package</phase>
                      <goals>
                          <goal>exec</goal>
                      </goals>
                  </execution>
              </executions>
              <configuration>
                  <executable>java</executable>
                  <arguments>
                      <argument>-Djavax.net.ssl.trustStore=$(env.MAVEN_TRUST_STORE)</argument>
                      <argument>-jar</argument>
                      <argument>                            ${settings.localRepository}/com/github/externalprogram/ddd/$(ddd.version)/ddd-$(ddd.version).jar
                      </argument>
                      <argument>--externalprogram.url=https://xxxx.yyyy.com/</argument>
                      <argument>--externalprogram.proxy.host=${someproxy}</argument>
                      <argument>--externalprogram.proxy.port=0000</argument>
                      <argument>--externalprogram.api.token=$**(secure-token)**</argument>
                      <argument>--detect.maven.path=$(env.M2_HOME)/bin/$(mvn)</argument>
                      <argument>--detect.maven.include.plugins=true</argument>
                      <argument>--detect.maven.build.command=-s $(env.MAVEN_SETTINGS_XML) -Djavax.net.ssl.trustStore=$(env.MAVEN_TRUST_STORE)
                      </argument>
                      <argument>--detect.included.detector.types=maven,pip,npm</argument>
                      <argument>
                          --detect.externalprogram.signature.scanner.exclusion.name.patterns=*target*,*/target,*\target
                      </argument>
                      <argument>--detect.bdio2.enabled=false</argument>
                      <argument>--detect.project.version.phase=$(versionPhase)</argument>
                      <argument>--detect.code.location.name=${project.version}</argument>
                  </arguments>
              </configuration>
          </plugin>

因此,如果我用实际值替换安全令牌,它就能工作。但当我使用受保护的值时,它会出现错误:无法与外部程序通信。未经授权..。

EN

回答 1

Stack Overflow用户

发布于 2022-01-29 18:40:31

您是如何定义安全令牌的?

注意:默认情况下,秘密变量不会传递给环境变量。

参考文献: https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#secret-variables

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70711740

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档