Compare commits

...

2 Commits

Author SHA1 Message Date
sto
ec2eaf5535 Fix public contestant form URLs creations (token -> contestant_id)
All checks were successful
CI / scan_ruby (push) Successful in 22s
CI / scan_js (push) Successful in 14s
CI / lint (push) Successful in 13s
CI / test (push) Successful in 39s
2026-01-21 11:30:41 +01:00
sto
5a49f14e04 Merge 658c989d8b
All checks were successful
CI / scan_ruby (push) Successful in 17s
CI / scan_js (push) Successful in 14s
CI / lint (push) Successful in 14s
CI / test (push) Successful in 38s
2026-01-17 09:49:02 +01:00
2 changed files with 10 additions and 11 deletions

View File

@@ -51,19 +51,18 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
# Final stage for app image # Final stage for app image
FROM base FROM base
# Run and own only the runtime files as a non-root user for security
RUN groupadd --system --gid 1000 rails && \
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash
USER 1000:1000
# Copy built artifacts: gems, application # Copy built artifacts: gems, application
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" COPY --chown=rails:rails --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
COPY --from=build /rails /rails COPY --chown=rails:rails --from=build /rails /rails
# TODO: find how not to depend on this hack to include the compiled SCSS. # TODO: find how not to depend on this hack to include the compiled SCSS.
RUN cp app/assets/builds/application.css `ls public/assets/application-*.css` RUN cp app/assets/builds/application.css `ls public/assets/application-*.css`
# Run and own only the runtime files as a non-root user for security
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
USER 1000:1000
# Entrypoint prepares the database. # Entrypoint prepares the database.
ENTRYPOINT ["/rails/bin/docker-entrypoint"] ENTRYPOINT ["/rails/bin/docker-entrypoint"]

View File

@@ -154,7 +154,7 @@ class ContestantsController < ApplicationController
@completion.completed = true @completion.completed = true
@public = true @public = true
render "completions/_form", locals: { completion: @completion, submit_text: t("helpers.buttons.create"), method: :post, url: "/public/p/#{params[:token]}" } render "completions/_form", locals: { completion: @completion, submit_text: t("helpers.buttons.create"), method: :post, url: "/public/p/#{params[:contestant_id]}" }
end end
def post_public_completion def post_public_completion
@@ -176,14 +176,14 @@ class ContestantsController < ApplicationController
end end
if @completion.save if @completion.save
extend_completions!(@completion.contestant) extend_completions!(@completion.contestant)
redirect_to "/public/p/#{params[:token]}/updated" redirect_to "/public/p/#{params[:contestant_id]}/updated"
else else
@puzzles = @contest.puzzles @puzzles = @contest.puzzles
@public = true @public = true
if to_modify if to_modify
@completion.code = nil @completion.code = nil
end end
render "completions/_form", locals: { completion: @completion, submit_text: t("helpers.buttons.create"), method: :post, url: "/public/p/#{params[:token]}" }, status: :unprocessable_entity render "completions/_form", locals: { completion: @completion, submit_text: t("helpers.buttons.create"), method: :post, url: "/public/p/#{params[:contestant_id]}" }, status: :unprocessable_entity
end end
end end