Skip to content

Commit 65a59c3

Browse files
author
Jonathan D.A. Jewell
committed
Auto-commit: Sync changes [2026-02-18]
1 parent 3aa50f7 commit 65a59c3

19 files changed

Lines changed: 525 additions & 164 deletions

File tree

.cabal/config

Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
-- This is the configuration file for the 'cabal' command line tool.
2+
--
3+
-- The available configuration options are listed below.
4+
-- Some of them have default values listed.
5+
--
6+
-- Lines (like this one) beginning with '--' are comments.
7+
-- Be careful with spaces and indentation because they are
8+
-- used to indicate layout for nested sections.
9+
--
10+
-- This config file was generated using the following versions
11+
-- of Cabal and cabal-install:
12+
-- Cabal library version: 3.14.2.0
13+
-- cabal-install version: 3.14.2.0
14+
15+
16+
repository hackage.haskell.org
17+
url: http://hackage.haskell.org/
18+
-- secure: True
19+
-- root-keys:
20+
-- key-threshold: 3
21+
22+
-- ignore-expiry: False
23+
-- http-transport:
24+
-- nix:
25+
-- store-dir:
26+
-- active-repositories:
27+
-- local-no-index-repo:
28+
remote-repo-cache: /var/mnt/eclipse/repos/sanctify-php/.cabal/packages
29+
-- logs-dir: /var/mnt/eclipse/repos/sanctify-php/.cabal/logs
30+
-- default-user-config:
31+
-- verbose: 1
32+
-- cabal-file:
33+
-- compiler: ghc
34+
-- with-compiler:
35+
-- with-hc-pkg:
36+
-- program-prefix:
37+
-- program-suffix:
38+
-- library-vanilla: True
39+
-- library-profiling:
40+
-- shared:
41+
-- static:
42+
-- executable-dynamic: False
43+
-- executable-static: False
44+
-- profiling:
45+
-- profiling-shared:
46+
-- executable-profiling:
47+
-- profiling-detail:
48+
-- library-profiling-detail:
49+
-- optimization: True
50+
-- debug-info: False
51+
-- build-info:
52+
-- library-for-ghci:
53+
-- split-sections: False
54+
-- split-objs: False
55+
-- executable-stripping:
56+
-- library-stripping:
57+
-- configure-option:
58+
-- user-install: True
59+
-- package-db:
60+
-- flags:
61+
-- extra-include-dirs:
62+
-- deterministic:
63+
-- cid:
64+
-- extra-lib-dirs:
65+
-- extra-lib-dirs-static:
66+
-- extra-framework-dirs:
67+
-- extra-prog-path:
68+
-- instantiate-with:
69+
-- tests: False
70+
-- coverage: False
71+
-- library-coverage:
72+
-- exact-configuration: False
73+
-- benchmarks: False
74+
-- relocatable: False
75+
-- response-files:
76+
-- allow-depending-on-private-libs:
77+
-- coverage-for:
78+
-- ignore-build-tools:
79+
-- cabal-lib-version:
80+
-- append:
81+
-- backup:
82+
-- constraint:
83+
-- preference:
84+
-- solver: modular
85+
-- allow-older: False
86+
-- allow-newer: False
87+
-- write-ghc-environment-files:
88+
-- documentation: False
89+
-- doc-index-file: $datadir/doc/$arch-$os-$compiler/index.html
90+
-- only-download: False
91+
-- target-package-db:
92+
-- max-backjumps: 4000
93+
-- reorder-goals: False
94+
-- count-conflicts: True
95+
-- fine-grained-conflicts: True
96+
-- minimize-conflict-set: False
97+
-- independent-goals: False
98+
-- prefer-oldest: False
99+
-- shadow-installed-packages: False
100+
-- strong-flags: False
101+
-- allow-boot-library-installs: False
102+
-- reject-unconstrained-dependencies: none
103+
-- reinstall: False
104+
-- avoid-reinstalls: False
105+
-- force-reinstalls: False
106+
-- upgrade-dependencies: False
107+
-- index-state:
108+
-- root-cmd:
109+
-- symlink-bindir:
110+
build-summary: /var/mnt/eclipse/repos/sanctify-php/.cabal/logs/build.log
111+
-- build-log:
112+
remote-build-reporting: none
113+
-- report-planning-failure: False
114+
-- per-component: True
115+
-- run-tests:
116+
-- semaphore: False
117+
jobs: $ncpus
118+
-- keep-going: False
119+
-- offline: False
120+
-- lib: False
121+
-- package-env:
122+
-- overwrite-policy:
123+
-- install-method:
124+
installdir: /var/mnt/eclipse/repos/sanctify-php/.cabal/bin
125+
-- token:
126+
-- username:
127+
-- password:
128+
-- password-command:
129+
-- multi-repl:
130+
-- builddir:
131+
132+
haddock
133+
-- cabal-file:
134+
-- keep-temp-files: False
135+
-- hoogle: False
136+
-- html: False
137+
-- html-location:
138+
-- executables: False
139+
-- tests: False
140+
-- benchmarks: False
141+
-- foreign-libraries: False
142+
-- all:
143+
-- internal: False
144+
-- css:
145+
-- hyperlink-source: False
146+
-- quickjump: False
147+
-- hscolour-css:
148+
-- contents-location:
149+
-- index-location:
150+
-- base-url:
151+
-- resources-dir:
152+
-- output-dir:
153+
-- use-unicode: False
154+
155+
init
156+
-- interactive: False
157+
-- quiet: False
158+
-- no-comments: False
159+
-- minimal: False
160+
-- cabal-version: 3.0
161+
-- license:
162+
-- extra-doc-file:
163+
-- tests:
164+
-- test-dir:
165+
-- simple: False
166+
-- language: Haskell2010
167+
-- application-dir: app
168+
-- source-dir: src
169+
170+
install-dirs user
171+
-- prefix: /var/mnt/eclipse/repos/sanctify-php/.cabal
172+
-- bindir: $prefix/bin
173+
-- libdir: $prefix/lib
174+
-- libsubdir: $abi/$libname
175+
-- dynlibdir: $libdir/$abi
176+
-- libexecdir: $prefix/libexec
177+
-- libexecsubdir: $abi/$pkgid
178+
-- datadir: $prefix/share
179+
-- datasubdir: $abi/$pkgid
180+
-- docdir: $datadir/doc/$abi/$pkgid
181+
-- htmldir: $docdir/html
182+
-- haddockdir: $htmldir
183+
-- sysconfdir: $prefix/etc
184+
185+
install-dirs global
186+
-- prefix: /usr/local
187+
-- bindir: $prefix/bin
188+
-- libdir: $prefix/lib
189+
-- libsubdir: $abi/$libname
190+
-- dynlibdir: $libdir/$abi
191+
-- libexecdir: $prefix/libexec
192+
-- libexecsubdir: $abi/$pkgid
193+
-- datadir: $prefix/share
194+
-- datasubdir: $abi/$pkgid
195+
-- docdir: $datadir/doc/$abi/$pkgid
196+
-- htmldir: $docdir/html
197+
-- haddockdir: $htmldir
198+
-- sysconfdir: $prefix/etc
199+
200+
program-locations
201+
-- alex-location:
202+
-- ar-location:
203+
-- c2hs-location:
204+
-- cpphs-location:
205+
-- doctest-location:
206+
-- gcc-location:
207+
-- ghc-location:
208+
-- ghc-pkg-location:
209+
-- ghcjs-location:
210+
-- ghcjs-pkg-location:
211+
-- greencard-location:
212+
-- haddock-location:
213+
-- happy-location:
214+
-- haskell-suite-location:
215+
-- haskell-suite-pkg-location:
216+
-- hmake-location:
217+
-- hpc-location:
218+
-- hsc2hs-location:
219+
-- hscolour-location:
220+
-- jhc-location:
221+
-- ld-location:
222+
-- pkg-config-location:
223+
-- runghc-location:
224+
-- strip-location:
225+
-- tar-location:
226+
-- uhc-location:
227+
228+
program-default-options
229+
-- alex-options:
230+
-- ar-options:
231+
-- c2hs-options:
232+
-- cpphs-options:
233+
-- doctest-options:
234+
-- gcc-options:
235+
-- ghc-options:
236+
-- ghc-pkg-options:
237+
-- ghcjs-options:
238+
-- ghcjs-pkg-options:
239+
-- greencard-options:
240+
-- haddock-options:
241+
-- happy-options:
242+
-- haskell-suite-options:
243+
-- haskell-suite-pkg-options:
244+
-- hmake-options:
245+
-- hpc-options:
246+
-- hsc2hs-options:
247+
-- hscolour-options:
248+
-- jhc-options:
249+
-- ld-options:
250+
-- pkg-config-options:
251+
-- runghc-options:
252+
-- strip-options:
253+
-- tar-options:
254+
-- uhc-options:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ __pycache__/
5454
# Haskell
5555
/.stack-work/
5656
/dist-newstyle/
57+
/cabal/
5758

5859
# Chapel
5960
*.chpl.tmp.*

app/Main.hs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import System.IO (hFlush, stdout, hPutStrLn, stderr)
88
import Data.Text (Text)
99
import qualified Data.Text as T
1010
import qualified Data.Text.IO as TIO
11+
import qualified Data.ByteString.Lazy.Char8 as BL8
1112
import System.Directory (doesFileExist, doesDirectoryExist, listDirectory, getModificationTime)
1213
import System.FilePath ((</>), takeExtension)
13-
import Control.Monad (forM, filterM, when, unless, forever)
14+
import Control.Monad (forM, forM_, filterM, when, unless, forever)
1415
import Control.Concurrent (threadDelay)
1516
import Data.Either (partitionEithers)
1617
import Data.List (isPrefixOf, isSuffixOf)
@@ -21,14 +22,14 @@ import qualified Data.Map.Strict as Map
2122
import Sanctify.Parser
2223
import Sanctify.AST
2324
import Sanctify.Analysis.Security
24-
import Sanctify.Analysis.Types
25+
import Sanctify.Analysis.Types (emptyTypeContext)
2526
import Sanctify.WordPress.Constraints
2627
import Sanctify.Transform.StrictTypes
2728
import Sanctify.Transform.Sanitize
2829
import Sanctify.Transform.TypeHints
29-
import Sanctify.Emit
30+
import Sanctify.Emit (emitPhp, emitPhpIniRecommendations, emitNginxRules, emitGuixOverrides)
3031
import Sanctify.Config
31-
import Sanctify.Report
32+
import qualified Sanctify.Report as SReport
3233

3334
-- | CLI options
3435
data Options = Options
@@ -490,7 +491,7 @@ fixCommand path = fixOnce (Options (Fix path) False False FormatText [] [] False
490491
applyTransforms :: PhpFile -> PhpFile
491492
applyTransforms = addStrictTypes . addAbspathCheck . addTypeHintsFile
492493
where
493-
addTypeHintsFile file = addAllTypeHints emptyContext file
494+
addTypeHintsFile file = addAllTypeHints emptyTypeContext file
494495

495496
-- | Enhanced report command with multiple output formats
496497
reportCommandNew :: Options -> FilePath -> IO ()
@@ -503,29 +504,29 @@ reportCommandNew opts path = do
503504
fileReports <- forM files $ \file -> do
504505
content <- TIO.readFile file
505506
case parsePhpString file content of
506-
Left _ -> pure $ generateFileReport file [] [] 0 0 False
507+
Left _ -> pure $ SReport.generateFileReport file [] [] 0 0 False
507508
Right ast -> do
508509
let secIssues = filterIssues opts $ analyzeSecurityIssues ast
509510
let wpIssues = if isWordPressCode ast
510511
then checkWordPressConstraints ast
511512
else []
512513
let autoFixed = length $ filter (canAutoFix . issueType) secIssues
513514
let manual = length secIssues - autoFixed
514-
pure $ generateFileReport file secIssues wpIssues autoFixed manual False
515+
pure $ SReport.generateFileReport file secIssues wpIssues autoFixed manual False
515516

516517
case optFormat opts of
517518
FormatText -> do
518-
report <- generateReport defaultConfig fileReports
519-
TIO.putStrLn $ renderText report
519+
report <- SReport.generateReport defaultConfig fileReports
520+
TIO.putStrLn $ SReport.renderText report
520521
FormatJSON -> do
521-
report <- generateReport defaultConfig fileReports
522-
TIO.putStrLn $ renderJSON report
522+
report <- SReport.generateReport defaultConfig fileReports
523+
BL8.putStrLn $ SReport.renderJson report
523524
FormatSARIF -> do
524-
report <- generateReport defaultConfig fileReports
525-
TIO.putStrLn $ renderSARIF report
525+
report <- SReport.generateReport defaultConfig fileReports
526+
BL8.putStrLn $ SReport.renderSarif report
526527
FormatHTML -> do
527-
report <- generateReport defaultConfig fileReports
528-
TIO.putStrLn $ renderHTML report
528+
report <- SReport.generateReport defaultConfig fileReports
529+
TIO.putStrLn $ SReport.renderHtml report
529530
where
530531
canAutoFix :: IssueType -> Bool
531532
canAutoFix MissingStrictTypes = True

sanctify-php.cabal

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ description:
1212
* Multiple output formats (text, JSON, SARIF, HTML)
1313
* Interactive fix mode and watch mode for development
1414
* Infrastructure export (php.ini, nginx, Guix/Nix)
15-
license: PMPL-1.0-or-later
15+
license: LicenseRef-PMPL-1.0-or-later
1616
license-file: LICENSE
1717
author: Jonathan D.A. Jewell
1818
maintainer: jonathan.jewell@gmail.com
@@ -50,7 +50,7 @@ library
5050
Sanctify.Parser.Lexer
5151
Sanctify.Parser.Token
5252
build-depends:
53-
base ^>=4.17,
53+
base >=4.17,
5454
text >=2.0,
5555
containers >=0.6,
5656
mtl >=2.3,
@@ -65,7 +65,8 @@ library
6565
vector >=0.13,
6666
unordered-containers >=0.2,
6767
prettyprinter >=1.7,
68-
optparse-applicative >=0.18
68+
optparse-applicative >=0.18,
69+
time >=1.12
6970
hs-source-dirs: src
7071
default-language: GHC2021
7172
default-extensions:
@@ -79,7 +80,7 @@ executable sanctify
7980
import: warnings
8081
main-is: Main.hs
8182
build-depends:
82-
base ^>=4.17,
83+
base >=4.17,
8384
sanctify-php,
8485
text,
8586
containers,
@@ -109,7 +110,7 @@ test-suite sanctify-php-test
109110
SecuritySpec
110111
TransformSpec
111112
build-depends:
112-
base ^>=4.17,
113+
base >=4.17,
113114
sanctify-php,
114115
hspec >=2.10,
115116
hspec-discover >=2.10,

0 commit comments

Comments
 (0)