mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
fix: 500 on bad url (#466)
This commit is contained in:
@@ -69,6 +69,11 @@ COPY --from=build /usr/lib/git-core /usr/lib/git-core
|
||||
RUN groupadd --system --gid 1000 rails && \
|
||||
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
|
||||
chown -R rails:rails db log storage tmp
|
||||
|
||||
# Global git safeguards
|
||||
RUN git config --system http.timeout 30 && \
|
||||
git config --system http.lowSpeedLimit 1000 && \
|
||||
git config --system http.lowSpeedTime 10
|
||||
USER 1000:1000
|
||||
|
||||
# Entrypoint prepares the database.
|
||||
|
||||
@@ -26,6 +26,10 @@ COPY entrypoint.dev.sh /usr/bin/
|
||||
RUN chmod +x /usr/bin/entrypoint.dev.sh
|
||||
ENTRYPOINT ["entrypoint.dev.sh"]
|
||||
|
||||
# Global git safeguards
|
||||
RUN git config --system http.timeout 30 && \
|
||||
git config --system http.lowSpeedLimit 1000 && \
|
||||
git config --system http.lowSpeedTime 10
|
||||
EXPOSE 3000
|
||||
|
||||
# Start the main process
|
||||
|
||||
@@ -67,6 +67,11 @@ COPY --from=build /usr/lib/git-core /usr/lib/git-core
|
||||
RUN groupadd --system --gid 1000 rails && \
|
||||
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
|
||||
chown -R rails:rails db log storage tmp
|
||||
|
||||
# Configure git settings globally
|
||||
RUN git config --system http.timeout 30 && \
|
||||
git config --system http.lowSpeedLimit 1000 && \
|
||||
git config --system http.lowSpeedTime 10
|
||||
USER 1000:1000
|
||||
|
||||
# Entrypoint prepares the database.
|
||||
|
||||
@@ -8,7 +8,7 @@ class GitRemote
|
||||
# Only allow safe protocols
|
||||
return false unless repo_url.match?(/\A(https?|git|ssh):\/\//)
|
||||
|
||||
safe_repo_url = URI.parse(repo_url).to_s.gsub(" ", "").gsub("'", "")
|
||||
Open3.capture2e("git", "ls-remote", safe_repo_url).last.success?
|
||||
safe_repo_url = URI.parse(repo_url).to_s.gsub(" ", "").gsub("'", "") rescue (return false)
|
||||
Open3.capture2e("git", "ls-remote", "--", safe_repo_url).last.success?
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user