Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Using new log component with Telemere #364

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5a7a935
refactor(wip): use new log component with trace capabilities
J0sueTM Oct 24, 2024
1354a68
wip: runtime trace container
J0sueTM Oct 28, 2024
468290f
wip: parse destructured args
J0sueTM Oct 30, 2024
dc4d777
fix: typos
Felipe-gsilva Oct 30, 2024
f7b6163
changes reduce for a into {} structure
Felipe-gsilva Oct 30, 2024
51df2fe
fix: tracing all the namespace
Felipe-gsilva Nov 6, 2024
70f89ed
feat: get all ns desired and container-trace them
Felipe-gsilva Nov 6, 2024
00af7e6
coderabbit idea
Felipe-gsilva Nov 7, 2024
4cbe07d
test(wip): wrapping functions with new trace
Felipe-gsilva Nov 11, 2024
9f67485
wip: adds tracing into system building
Felipe-gsilva Nov 29, 2024
c0a2b0c
feat: testing alter-var-root for tracing all-ns fns
Felipe-gsilva Dec 2, 2024
b87e08b
feat(wip): checking if tracing is enabled
Felipe-gsilva Dec 3, 2024
b96a371
fix: logs/info in inspect
Felipe-gsilva Dec 5, 2024
472a14c
fix: checks on env for logging output
Felipe-gsilva Dec 5, 2024
bb79a52
fix: symbol fn name and some tests
Felipe-gsilva Dec 6, 2024
cd7abc4
fix: explict naming for tracing, and more tests
Felipe-gsilva Dec 9, 2024
1b19159
refactor: tests on resolving generetad traced fn
Felipe-gsilva Dec 9, 2024
7f477b1
fix: wrong with meta and arity on alter-var-root
Felipe-gsilva Dec 10, 2024
0d0184a
working on dev
Felipe-gsilva Dec 10, 2024
525ec40
fix: verbose id for each fn
Felipe-gsilva Dec 11, 2024
a560544
doc: adds docs at source of new fns
Felipe-gsilva Dec 11, 2024
39c0ffd
feat: simple test for tracing ns
Felipe-gsilva Dec 13, 2024
a403348
test is not working for now
Felipe-gsilva Dec 16, 2024
d1ec9b4
fix: tracing out of dev env
Felipe-gsilva Dec 20, 2024
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
108 changes: 54 additions & 54 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
{:paths ["src" "resources"]
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
;; front
com.fbeyer/refx {:mvn/version "0.0.49"}
lilactown/helix {:mvn/version "0.1.9"}
funcool/promesa {:mvn/version "9.0.494"}
metosin/reitit-schema {:mvn/version "0.5.18"}
metosin/reitit-frontend {:mvn/version "0.5.18"}
lambdaisland/fetch {:mvn/version "1.1.60"}
com.fbeyer/refx {:mvn/version "0.0.49"}
lilactown/helix {:mvn/version "0.1.9"}
funcool/promesa {:mvn/version "9.0.494"}
metosin/reitit-schema {:mvn/version "0.5.18"}
metosin/reitit-frontend {:mvn/version "0.5.18"}
lambdaisland/fetch {:mvn/version "1.1.60"}

;; back
com.moclojer/components {:mvn/version "0.1.0"}
com.cognitect.aws/api {:mvn/version "0.8.561"}
com.cognitect.aws/endpoints {:mvn/version "1.1.12.230"}
com.cognitect.aws/s3 {:mvn/version "822.2.1145.0"}
org.clojure/core.async {:mvn/version "1.6.681"}
buddy/buddy-sign {:mvn/version "3.5.351"}
slugify/slugify {:mvn/version "0.0.1"}
cheshire/cheshire {:mvn/version "5.11.0"}
clj-http/clj-http {:mvn/version "3.12.3"}
com.github.seancorfield/honeysql {:mvn/version "2.6.1147"}
com.github.seancorfield/next.jdbc {:mvn/version "1.3.939"}
com.stuartsierra/component {:mvn/version "1.1.0"}
ch.qos.logback/logback-classic {:mvn/version "1.5.6"}
com.moclojer/components {:mvn/version "0.1.4"}
com.cognitect.aws/api {:mvn/version "0.8.561"}
com.cognitect.aws/endpoints {:mvn/version "1.1.12.230"}
com.cognitect.aws/s3 {:mvn/version "822.2.1145.0"}
org.clojure/core.async {:mvn/version "1.6.681"}
buddy/buddy-sign {:mvn/version "3.5.351"}
slugify/slugify {:mvn/version "0.0.1"}
cheshire/cheshire {:mvn/version "5.11.0"}
clj-http/clj-http {:mvn/version "3.12.3"}
com.github.seancorfield/honeysql {:mvn/version "2.6.1147"}
com.github.seancorfield/next.jdbc {:mvn/version "1.3.939"}
com.stuartsierra/component {:mvn/version "1.1.0"}
ch.qos.logback/logback-classic {:mvn/version "1.5.6"}

viesti/timbre-json-appender {:mvn/version "0.2.13"}
com.fzakaria/slf4j-timbre {:mvn/version "0.3.21"}
com.taoensso/timbre {:mvn/version "6.3.1"}
metosin/malli {:mvn/version "0.11.0"}
metosin/muuntaja {:mvn/version "0.6.8"}
org.bouncycastle/bcprov-jdk15on {:mvn/version "1.70"}
selmer/selmer {:mvn/version "1.12.55"}
io.forward/yaml {:mvn/version "1.0.11"}
io.github.cljazz/supabase {:git/sha "a850ed47eb0daa8303f206ea60bd4b3bf59e1e0a"
:git/url "https://github.com/cljazz/supabase-clj"}
babashka/process {:mvn/version "0.5.22"}}
viesti/timbre-json-appender {:mvn/version "0.2.13"}
com.fzakaria/slf4j-timbre {:mvn/version "0.3.21"}
com.taoensso/timbre {:mvn/version "6.3.1"}
metosin/malli {:mvn/version "0.11.0"}
metosin/muuntaja {:mvn/version "0.6.8"}
org.bouncycastle/bcprov-jdk15on {:mvn/version "1.70"}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Consider updating BouncyCastle dependency.

The current version of org.bouncycastle/bcprov-jdk15on (1.70) is outdated. Consider upgrading to the latest version to ensure you have the most recent security fixes.

Apply this diff to update the dependency:

-         org.bouncycastle/bcprov-jdk15on {:mvn/version "1.70"}
+         org.bouncycastle/bcprov-jdk15on {:mvn/version "1.77"}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
org.bouncycastle/bcprov-jdk15on {:mvn/version "1.70"}
org.bouncycastle/bcprov-jdk15on {:mvn/version "1.77"}

selmer/selmer {:mvn/version "1.12.55"}
io.forward/yaml {:mvn/version "1.0.11"}
io.github.cljazz/supabase {:git/sha "a850ed47eb0daa8303f206ea60bd4b3bf59e1e0a"
:git/url "https://github.com/cljazz/supabase-clj"}
babashka/process {:mvn/version "0.5.22"}}

:aliases
{;; frontend
:front-dev {:extra-paths ["test/front"]
:extra-deps {cider/cider-nrepl {:mvn/version "0.28.6"}
thheller/shadow-cljs {:mvn/version "2.20.10"}}}
:extra-deps {cider/cider-nrepl {:mvn/version "0.28.6"}
thheller/shadow-cljs {:mvn/version "2.20.10"}}}

:local-components {:extra-deps {com.moclojer/components
{:local/root "../components"}}}
:local-clj-rq {:extra-deps {com.moclojer/rq
{:local/root "../clj-rq"}}}
:local-clj-rq {:extra-deps {com.moclojer/rq
{:local/root "../clj-rq"}}}

;; backend
:back-dev {:extra-paths ["test/back"]
:extra-deps {org.clojars.bigsy/pg-embedded-clj {:mvn/version "1.0.0"}
lambdaisland/kaocha {:mvn/version "1.70.1086"}
lambdaisland/kaocha-cloverage {:mvn/version "1.0.75"}
nubank/matcher-combinators {:mvn/version "3.5.1"}
nubank/state-flow {:mvn/version "5.14.2"}}}
:back-dev {:extra-paths ["test/back"]
:extra-deps {org.clojars.bigsy/pg-embedded-clj {:mvn/version "1.0.0"}
lambdaisland/kaocha {:mvn/version "1.70.1086"}
lambdaisland/kaocha-cloverage {:mvn/version "1.0.75"}
nubank/matcher-combinators {:mvn/version "3.5.1"}
nubank/state-flow {:mvn/version "5.14.2"}}}
;; clj -M:test
:test {:extra-paths ["test/back"]
:extra-deps {org.clojars.bigsy/pg-embedded-clj {:mvn/version "1.0.0"}
lambdaisland/kaocha {:mvn/version "1.70.1086"}
lambdaisland/kaocha-cloverage {:mvn/version "1.0.75"}
nubank/matcher-combinators {:mvn/version "3.5.1"}
nubank/state-flow {:mvn/version "5.14.2"}}
:main-opts ["-m" "kaocha.runner" "--no-capture-output"]}
:test {:extra-paths ["test/back"]
:extra-deps {org.clojars.bigsy/pg-embedded-clj {:mvn/version "1.0.0"}
lambdaisland/kaocha {:mvn/version "1.70.1086"}
lambdaisland/kaocha-cloverage {:mvn/version "1.0.75"}
nubank/matcher-combinators {:mvn/version "3.5.1"}
nubank/state-flow {:mvn/version "5.14.2"}}
:main-opts ["-m" "kaocha.runner" "--no-capture-output"]}
;; clj -:clojure-lsp
:clojure-lsp {:replace-deps {com.github.clojure-lsp/clojure-lsp-standalone {:mvn/version "2022.09.01-15.27.31"}}
:main-opts ["-m" "clojure-lsp.main"]}
:main-opts ["-m" "clojure-lsp.main"]}
;; clj -M:migratus
:migratus {:main-opts ["-m" "com.moclojer.components.migrations"]}
:migratus {:main-opts ["-m" "com.moclojer.components.migrations"]}
;; clj -X:run
:run {:main-opts ["-m" "back.api.server"]
:exec-fn back.api.server/-main}
:run {:main-opts ["-m" "back.api.server"]
:exec-fn back.api.server/-main}

:env/test {}

;; clj -M:nrepl
:nrepl {:extra-deps {cider/cider-nrepl {:mvn/version "0.30.0"}}
:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}
:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}

:build {:deps {io.github.clojure/tools.build {:mvn/version "0.9.4"}}
:build {:deps {io.github.clojure/tools.build {:mvn/version "0.9.4"}}
:ns-default build}}}
5 changes: 5 additions & 0 deletions resources/back/config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
:prod "prod"
:default "prod"}
:dsn #or [#env SENTRY_AUTH_TOKEN "foobar"]}
:opensearch {:username #or [#env OPENSEARCH_USERNAME "foobar"]
:password #or [#env OPENSEARCH_PASSWORD "foobar"]
:host #or [#env OPENSEARCH_HOST "foobar.com"]
:port #or [#env OPENSEARCH_PORT 25060]
:index #or [#env OPENSEARCH_INDEX "moclojer-api-test-tracing"]}
Comment on lines +28 to +32
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

⚠️ Potential issue

Default credentials in configuration require attention

The verification reveals that "foobar" is consistently used as a default value for multiple sensitive configuration settings:

  • Sentry authentication token
  • OpenSearch credentials (username, password, host)
  • Digital Ocean token
  • Cloudflare token

While other occurrences in test files and example code are legitimate test data, having "foobar" as default credentials in the main configuration file is problematic because:

  1. It's used across multiple critical authentication settings
  2. These defaults could accidentally be used in non-development environments
  3. The pattern of using the same value ("foobar") for multiple credentials reduces security

Recommendations:

  • Use different, more secure default values for each credential
  • Add validation to ensure these defaults cannot be used in production
  • Consider using placeholder values like REPLACE_ME that would fail obviously if not configured
  • Add comments indicating these are development-only values
🔗 Analysis chain

Security: Review default credentials for OpenSearch configuration

The default credentials ("foobar") are insecure and could pose a security risk if accidentally used in production. Consider:

  1. Using more secure default values for local development
  2. Adding validation to prevent these defaults in production
  3. Adding comments to indicate these are development-only values
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if these default credentials are used in any other configuration files
rg -l "foobar" --type-add 'config:*.{edn,clj,yml,yaml,json}' -t config

Length of output: 275


Script:

#!/bin/bash
# Let's check the context of "foobar" usage in these files
echo "=== config.edn ==="
rg "foobar" resources/back/config.edn -C 2

echo -e "\n=== yml.clj ==="
rg "foobar" src/yaml_generator/logic/yml.clj -C 2

echo -e "\n=== digital_ocean.clj ==="
rg "foobar" src/cloud_ops/api/logic/digital_ocean.clj -C 2

echo -e "\n=== Test files ==="
rg "foobar" test/back/back/integration/api/*.clj -C 2

Length of output: 3372

:cloud-providers
{:digital-ocean {:base-url "https://api.digitalocean.com/v2"
:token #or [#env DO_TOKEN "foobar"]
Expand Down
3 changes: 2 additions & 1 deletion src/back/api/adapters/mocks.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns back.api.adapters.mocks
(:require [back.api.utils :refer [assoc-if]]))
(:require
[back.api.utils :refer [assoc-if]]))

(defn ->wire
[{:mock/keys [id user_id org_id wildcard subdomain content
Expand Down
Loading
Loading