Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ img/schedules/*.png

# Ignore node_modules dependencies
node_modules/*
package-lock.json

# Ignore built files
assets/prod/*
Expand Down Expand Up @@ -37,3 +36,4 @@ web.config
vwd.webinfo
WebEssentials-Settings.json
vendor
.vscode
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM docker.io/node:12-buster-slim as builder
FROM docker.io/node:12-buster-slim AS builder
LABEL author="Devin Matte <matted@csh.rit.edu>"

WORKDIR /usr/src/schedule
COPY package.json ./
COPY package.json package-lock.json ./

RUN npm install

Expand All @@ -11,10 +11,10 @@ COPY assets ./assets
RUN npm run-script build


FROM docker.io/php:7.3-apache
FROM docker.io/php:8.4-apache

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Low: Healthcheck instruction missing

Containers should expose an explicit `HEALTHCHECK` so runtimes and orchestrators can detect unhealthy applications and automatically restart or replace failing containers. Without a health check, internal failures may go... (...read more)

Containers should expose an explicit HEALTHCHECK so runtimes and orchestrators can detect unhealthy applications and automatically restart or replace failing containers. Without a health check, internal failures may go unnoticed and lead to reduced availability and slower incident recovery.

This rule verifies each Dockerfile build stage (each FROM) and requires a HEALTHCHECK instruction to be present in the stage's instruction set. Stages missing a HEALTHCHECK will be flagged.

Implement the HEALTHCHECK using the CMD form and sensible options (for example, --interval, --timeout, --start-period, --retries) so the probe is lightweight and accurately reflects service health.

Secure example:

FROM alpine:3.14
# application setup...

HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
  CMD wget -q -O /dev/null http://localhost:8080/health || exit 1

Helpful? 👍/👎 View in Datadog  Leave us feedback  Documentation
🚩 Report as false positive. Flags the rule for review to improve detection accuracy.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 High: Missing user instruction

Specify a non-root user in the Dockerfile so containers do not run as root by default, which reduces the blast radius of a compromise and prevents easy privilege escalation.

This check inspects every build stage (exclud... (...read more)


Specify a non-root user in the Dockerfile so containers do not run as root by default, which reduces the blast radius of a compromise and prevents easy privilege escalation.

This check inspects every build stage (excluding stages based on scratch) and flags the Dockerfile when no USER instruction appears in any stage. The Dockerfile must include a USER instruction that names a non-root user (username or numeric UID), preferably set in the final stage. Resources missing USER will be flagged.

This rule detects the absence of a USER instruction but does not validate the value—ensure the user is not root or UID 0 and that the user account is created in the image before switching to it.

Secure example:

FROM python:3.11-slim AS builder
# build steps...
FROM python:3.11-slim
RUN groupadd -r app && useradd -r -g app app
COPY --from=builder /app /app
USER app
CMD ["python", "/app/app.py"]

Helpful? 👍/👎 View in Datadog  Leave us feedback  Documentation
🚩 Report as false positive. Flags the rule for review to improve detection accuracy.

LABEL author="Devin Matte <matted@csh.rit.edu>"

RUN echo "deb-src http://archive.debian.org/debian buster main" >> /etc/apt/sources.list
RUN echo "deb-src http://deb.debian.org/debian trixie main" >> /etc/apt/sources.list

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Medium: Avoid HTTP

Dockerfile `RUN` commands must not fetch resources over unencrypted HTTP, because clear-text downloads can be intercepted or modified in transit. This increases the risk of supply-chain compromise or execution of malicio... (...read more)

Dockerfile RUN commands must not fetch resources over unencrypted HTTP, because clear-text downloads can be intercepted or modified in transit. This increases the risk of supply-chain compromise or execution of malicious code in the built image.

This rule inspects dockerfile_container resources' RUN entries and flags tokens containing http:// (matches http: but not https:). URLs must use https:// instead of http://. Localhost addresses (http://localhost, http://127.0.0.1, http://[::1]) are excluded from detection.

When switching to HTTPS, also verify artifact integrity (for example, with checksums or signatures) or use trusted TLS-protected registries to further reduce tampering risk.

Secure example using HTTPS and checksum verification:

RUN curl -fsSL https://example.com/artifact.tar.gz -o /tmp/artifact.tar.gz && \
    echo "3b7d6f...  /tmp/artifact.tar.gz" | sha256sum -c -

Helpful? 👍/👎 View in Datadog  Leave us feedback  Documentation
🚩 Report as false positive. Flags the rule for review to improve detection accuracy.


RUN apt-get -yq update && \
apt-get -yq install \
Expand All @@ -36,6 +36,7 @@ RUN apt-get -yq update && \
libxml2-dev \
unzip \
wget \
fonts-roboto \
--no-install-recommends

RUN apt-get -yq build-dep imagemagick
Expand All @@ -44,10 +45,9 @@ RUN wget https://github.com/ImageMagick/ImageMagick6/archive/6.9.11-22.tar.gz &&
tar -xzvf 6.9.11-22.tar.gz && \
cd ImageMagick6-6.9.11-22 && \
./configure && \
make && \
make -j16 && \
make install && \
ldconfig /usr/local/lib && \
make check
ldconfig /usr/local/lib

RUN docker-php-ext-install mysqli && \
yes '' | pecl install imagick && docker-php-ext-enable imagick
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Available at [schedule.csh.rit.edu](https://schedule.csh.rit.edu)
- If you wish to see images locally, you will also need S3 credentials, either supply your own or reach out.

### Run Locally
In order to run locally youre going to need [docker](https://www.docker.com/).
In order to run locally you're going to need [docker](https://www.docker.com/).

```
docker build -t schedulemaker .
Expand Down
9 changes: 6 additions & 3 deletions api/entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
}

// Do the query
$query = "SELECT c.title, c.course, c.description, c.id, d.number, d.code
$query = "SELECT c.title, c.course, c.description, c.id, d.number, d.code, c.prerequisites, c.typically_offered, c.contact_hours
FROM sections AS s
JOIN courses AS c ON s.course = c.id
JOIN departments AS d ON d.id = c.department
Expand All @@ -62,7 +62,10 @@
"course" => $course['course'],
"department" => ["code" => $course['code'], "number" => $course['number']],
"title" => $course['title'],
"description" => htmlentities($course['description'])
"description" => htmlentities($course['description']),
"prerequisites" => $course['prerequisites'],
"typically_offered" => $course['typically_offered'],
"contact_hours" => $course['contact_hours']
];
}

Expand Down Expand Up @@ -114,7 +117,7 @@
"id" => $department['id'],
"title" => $department['title'],
"code" => isset($department['code']) ? $department['code'] : null,
"number" => trim($department['number'], " ,")
"number" => $department['number'] ? trim($department['number'], " ,") : null,
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ angular.module('sm').directive('scheduleActions', function ($http, $q, shareServ
const popup = openPopup(true)

getSavedInfo().then(function (data) {
popup.location = ('http://' + window.location.hostname +
popup.location = (window.location.origin +
'/img/schedules/' + parseInt(data.id, 16) + '.png')
})
},
Expand All @@ -174,7 +174,7 @@ angular.module('sm').directive('scheduleActions', function ($http, $q, shareServ

popup.localStorage.setItem('reloadSchedule', angular.toJson(reloadSchedule))
popup.document.title = 'My Schedule'
popup.location = 'http://' + window.location.hostname + '/schedule/render/print'
popup.location = window.location.origin + '/schedule/render/print'
},

hide: function () {
Expand Down
Loading
Loading